j?j:g+f));return 1===d?(b=a[c-1],e.push(k[b>>2]+k[63&b<<4]+"==")):2===d&&(b=(a[c-2]<<8)+a[c-1],e.push(k[b>>10]+k[63&b>>4]+k[63&b<<2]+"=")),e.join("")}c.byteLength=function(a){var b=d(a),c=b[0],e=b[1];return 3*(c+e)/4-e},c.toByteArray=f,c.fromByteArray=j;for(var k=[],l=[],m="undefined"==typeof Uint8Array?Array:Uint8Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,p=n.length;o 0) {
+ throw new Error('Invalid string. Length must be a multiple of 4')
+ }
+
+ // Trim off extra bytes after placeholder bytes are found
+ // See: https://github.com/beatgammit/base64-js/issues/42
+ var validLen = b64.indexOf('=')
+ if (validLen === -1) validLen = len
+
+ var placeHoldersLen = validLen === len
+ ? 0
+ : 4 - (validLen % 4)
+
+ return [validLen, placeHoldersLen]
+}
+
+// base64 is 4/3 + up to two characters of the original data
+function byteLength (b64) {
+ var lens = getLens(b64)
+ var validLen = lens[0]
+ var placeHoldersLen = lens[1]
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
+}
+
+function _byteLength (b64, validLen, placeHoldersLen) {
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
+}
+
+function toByteArray (b64) {
+ var tmp
+ var lens = getLens(b64)
+ var validLen = lens[0]
+ var placeHoldersLen = lens[1]
+
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
+
+ var curByte = 0
+
+ // if there are placeholders, only get up to the last complete 4 chars
+ var len = placeHoldersLen > 0
+ ? validLen - 4
+ : validLen
+
+ var i
+ for (i = 0; i < len; i += 4) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 18) |
+ (revLookup[b64.charCodeAt(i + 1)] << 12) |
+ (revLookup[b64.charCodeAt(i + 2)] << 6) |
+ revLookup[b64.charCodeAt(i + 3)]
+ arr[curByte++] = (tmp >> 16) & 0xFF
+ arr[curByte++] = (tmp >> 8) & 0xFF
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ if (placeHoldersLen === 2) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 2) |
+ (revLookup[b64.charCodeAt(i + 1)] >> 4)
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ if (placeHoldersLen === 1) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 10) |
+ (revLookup[b64.charCodeAt(i + 1)] << 4) |
+ (revLookup[b64.charCodeAt(i + 2)] >> 2)
+ arr[curByte++] = (tmp >> 8) & 0xFF
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ return arr
+}
+
+function tripletToBase64 (num) {
+ return lookup[num >> 18 & 0x3F] +
+ lookup[num >> 12 & 0x3F] +
+ lookup[num >> 6 & 0x3F] +
+ lookup[num & 0x3F]
+}
+
+function encodeChunk (uint8, start, end) {
+ var tmp
+ var output = []
+ for (var i = start; i < end; i += 3) {
+ tmp =
+ ((uint8[i] << 16) & 0xFF0000) +
+ ((uint8[i + 1] << 8) & 0xFF00) +
+ (uint8[i + 2] & 0xFF)
+ output.push(tripletToBase64(tmp))
+ }
+ return output.join('')
+}
+
+function fromByteArray (uint8) {
+ var tmp
+ var len = uint8.length
+ var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
+ var parts = []
+ var maxChunkLength = 16383 // must be multiple of 3
+
+ // go through the array every three bytes, we'll deal with trailing stuff later
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
+ }
+
+ // pad the end with zeros, but make sure to not forget the extra bytes
+ if (extraBytes === 1) {
+ tmp = uint8[len - 1]
+ parts.push(
+ lookup[tmp >> 2] +
+ lookup[(tmp << 4) & 0x3F] +
+ '=='
+ )
+ } else if (extraBytes === 2) {
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1]
+ parts.push(
+ lookup[tmp >> 10] +
+ lookup[(tmp >> 4) & 0x3F] +
+ lookup[(tmp << 2) & 0x3F] +
+ '='
+ )
+ }
+
+ return parts.join('')
+}
diff --git a/node_modules/base64-js/package.json b/node_modules/base64-js/package.json
new file mode 100644
index 0000000..c3972e3
--- /dev/null
+++ b/node_modules/base64-js/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "base64-js",
+ "description": "Base64 encoding/decoding in pure JS",
+ "version": "1.5.1",
+ "author": "T. Jameson Little ",
+ "typings": "index.d.ts",
+ "bugs": {
+ "url": "https://github.com/beatgammit/base64-js/issues"
+ },
+ "devDependencies": {
+ "babel-minify": "^0.5.1",
+ "benchmark": "^2.1.4",
+ "browserify": "^16.3.0",
+ "standard": "*",
+ "tape": "4.x"
+ },
+ "homepage": "https://github.com/beatgammit/base64-js",
+ "keywords": [
+ "base64"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/beatgammit/base64-js.git"
+ },
+ "scripts": {
+ "build": "browserify -s base64js -r ./ | minify > base64js.min.js",
+ "lint": "standard",
+ "test": "npm run lint && npm run unit",
+ "unit": "tape test/*.js"
+ },
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+}
diff --git a/node_modules/big-integer/BigInteger.d.ts b/node_modules/big-integer/BigInteger.d.ts
new file mode 100644
index 0000000..168ba5f
--- /dev/null
+++ b/node_modules/big-integer/BigInteger.d.ts
@@ -0,0 +1,2393 @@
+/**
+ * Type definitions for BigInteger.js
+ * Definitions by: Tommy Frazier
+ */
+export = bigInt;
+export as namespace bigInt;
+
+declare var bigInt: bigInt.BigIntegerStatic;
+
+declare namespace bigInt {
+ type BigNumber = number | bigint | string | BigInteger;
+
+ interface BigIntegerStatic {
+ /**
+ * Equivalent to bigInt(0).
+ */
+ (): BigInteger;
+
+ /**
+ * Parse a Javascript number into a bigInt.
+ */
+ (number: number): BigInteger;
+
+ /**
+ * Parse a Javascript native bigint into a bigInt.
+ */
+ (number: bigint): BigInteger;
+
+ /**
+ * Parse a string into a bigInt.
+ * Default base is 10.
+ * Default alphabet is "0123456789abcdefghijklmnopqrstuvwxyz".
+ * caseSensitive defaults to false.
+ */
+ (string: string, base?: BigNumber, alphabet?: string, caseSensitive?: boolean): BigInteger;
+
+ /**
+ * no-op.
+ */
+ (bigInt: BigInteger): BigInteger;
+
+ /**
+ * Constructs a bigInt from an array of digits in specified base.
+ * The optional isNegative flag will make the number negative.
+ */
+ fromArray: (digits: BigNumber[], base?: BigNumber, isNegative?: boolean) => BigInteger;
+
+ /**
+ * Finds the greatest common denominator of a and b.
+ */
+ gcd: (a: BigNumber, b: BigNumber) => BigInteger;
+
+
+ /**
+ * Returns true if x is a BigInteger, false otherwise.
+ */
+ isInstance: (x: any) => x is BigInteger;
+
+ /**
+ * Finds the least common multiple of a and b.
+ */
+ lcm: (a: BigNumber, b: BigNumber) => BigInteger;
+
+ /**
+ * Returns the largest of a and b.
+ */
+ max: (a: BigNumber, b: BigNumber) => BigInteger;
+
+ /**
+ * Returns the smallest of a and b.
+ */
+ min: (a: BigNumber, b: BigNumber) => BigInteger;
+
+ /**
+ * Equivalent to bigInt(-1).
+ */
+ minusOne: BigInteger;
+
+ /**
+ * Equivalent to bigInt(1).
+ */
+ one: BigInteger;
+
+ /**
+ * Returns a random number between min and max.
+ */
+ randBetween: (min: BigNumber, max: BigNumber, rng?: () => number) => BigInteger;
+
+ /**
+ * Equivalent to bigInt(0).
+ */
+ zero: BigInteger;
+ }
+
+ interface BigInteger {
+ /**
+ * Returns the absolute value of a bigInt.
+ */
+ abs(): BigInteger;
+
+ /**
+ * Performs addition.
+ */
+ add(number: BigNumber): BigInteger;
+
+ /**
+ * Performs the bitwise AND operation.
+ */
+ and(number: BigNumber): BigInteger;
+
+ /**
+ * Returns the number of digits required to represent a bigInt in binary.
+ */
+ bitLength(): BigInteger;
+
+ /**
+ * Performs a comparison between two numbers. If the numbers are equal, it returns 0.
+ * If the first number is greater, it returns 1. If the first number is lesser, it returns -1.
+ */
+ compare(number: BigNumber): number;
+
+ /**
+ * Performs a comparison between the absolute value of two numbers.
+ */
+ compareAbs(number: BigNumber): number;
+
+ /**
+ * Alias for the compare method.
+ */
+ compareTo(number: BigNumber): number;
+
+ /**
+ * Performs integer division, disregarding the remainder.
+ */
+ divide(number: BigNumber): BigInteger;
+
+ /**
+ * Performs division and returns an object with two properties: quotient and remainder.
+ * The sign of the remainder will match the sign of the dividend.
+ */
+ divmod(number: BigNumber): { quotient: BigInteger, remainder: BigInteger };
+
+ /**
+ * Alias for the equals method.
+ */
+ eq(number: BigNumber): boolean;
+
+ /**
+ * Checks if two numbers are equal.
+ */
+ equals(number: BigNumber): boolean;
+
+ /**
+ * Alias for the greaterOrEquals method.
+ */
+ geq(number: BigNumber): boolean;
+
+ /**
+ * Checks if the first number is greater than the second.
+ */
+ greater(number: BigNumber): boolean;
+
+ /**
+ * Checks if the first number is greater than or equal to the second.
+ */
+ greaterOrEquals(number: BigNumber): boolean;
+
+ /**
+ * Alias for the greater method.
+ */
+ gt(number: BigNumber): boolean;
+
+ /**
+ * Returns true if the first number is divisible by the second number, false otherwise.
+ */
+ isDivisibleBy(number: BigNumber): boolean;
+
+ /**
+ * Returns true if the number is even, false otherwise.
+ */
+ isEven(): boolean;
+
+ /**
+ * Returns true if the number is negative, false otherwise.
+ * Returns false for 0 and true for -0.
+ */
+ isNegative(): boolean;
+
+ /**
+ * Returns true if the number is odd, false otherwise.
+ */
+ isOdd(): boolean;
+
+ /**
+ * Return true if the number is positive, false otherwise.
+ * Returns true for 0 and false for -0.
+ */
+ isPositive(): boolean;
+
+ /**
+ * Returns true if the number is prime, false otherwise.
+ */
+ isPrime(strict?: boolean): boolean;
+
+ /**
+ * Returns true if the number is very likely to be prime, false otherwise.
+ */
+ isProbablePrime(iterations?: number, rng?: () => number): boolean;
+
+ /**
+ * Returns true if the number is 1 or -1, false otherwise.
+ */
+ isUnit(): boolean;
+
+ /**
+ * Return true if the number is 0 or -0, false otherwise.
+ */
+ isZero(): boolean;
+
+ /**
+ * Alias for the lesserOrEquals method.
+ */
+ leq(number: BigNumber): boolean;
+
+ /**
+ * Checks if the first number is lesser than the second.
+ */
+ lesser(number: BigNumber): boolean;
+
+ /**
+ * Checks if the first number is less than or equal to the second.
+ */
+ lesserOrEquals(number: BigNumber): boolean;
+
+ /**
+ * Alias for the lesser method.
+ */
+ lt(number: BigNumber): boolean;
+
+ /**
+ * Alias for the subtract method.
+ */
+ minus(number: BigNumber): BigInteger;
+
+ /**
+ * Performs division and returns the remainder, disregarding the quotient.
+ * The sign of the remainder will match the sign of the dividend.
+ */
+ mod(number: BigNumber): BigInteger;
+
+ /**
+ * Finds the multiplicative inverse of the number modulo mod.
+ */
+ modInv(number: BigNumber): BigInteger;
+
+ /**
+ * Takes the number to the power exp modulo mod.
+ */
+ modPow(exp: BigNumber, mod: BigNumber): BigInteger;
+
+ /**
+ * Performs multiplication.
+ */
+ multiply(number: BigNumber): BigInteger;
+
+ /**
+ * Reverses the sign of the number.
+ */
+ negate(): BigInteger;
+
+ /**
+ * Alias for the notEquals method.
+ */
+ neq(number: BigNumber): boolean;
+
+ /**
+ * Adds one to the number.
+ */
+ next(): BigInteger;
+
+ /**
+ * Performs the bitwise NOT operation.
+ */
+ not(): BigInteger;
+
+ /**
+ * Checks if two numbers are not equal.
+ */
+ notEquals(number: BigNumber): boolean;
+
+ /**
+ * Performs the bitwise OR operation.
+ */
+ or(number: BigNumber): BigInteger;
+
+ /**
+ * Alias for the divide method.
+ */
+ over(number: BigNumber): BigInteger;
+
+ /**
+ * Alias for the add method.
+ */
+ plus(number: BigNumber): BigInteger;
+
+ /**
+ * Performs exponentiation. If the exponent is less than 0, pow returns 0.
+ * bigInt.zero.pow(0) returns 1.
+ */
+ pow(number: BigNumber): BigInteger;
+
+ /**
+ * Subtracts one from the number.
+ */
+ prev(): BigInteger;
+
+ /**
+ * Alias for the mod method.
+ */
+ remainder(number: BigNumber): BigInteger;
+
+ /**
+ * Shifts the number left by n places in its binary representation.
+ * If a negative number is provided, it will shift right.
+ *
+ * Throws an error if number is outside of the range [-9007199254740992, 9007199254740992].
+ */
+ shiftLeft(number: BigNumber): BigInteger;
+
+ /**
+ * Shifts the number right by n places in its binary representation.
+ * If a negative number is provided, it will shift left.
+ *
+ * Throws an error if number is outside of the range [-9007199254740992, 9007199254740992].
+ */
+ shiftRight(number: BigNumber): BigInteger;
+
+ /**
+ * Squares the number.
+ */
+ square(): BigInteger;
+
+ /**
+ * Performs subtraction.
+ */
+ subtract(number: BigNumber): BigInteger;
+
+ /**
+ * Alias for the multiply method.
+ */
+ times(number: BigNumber): BigInteger;
+
+ /**
+ *
+ * Converts a bigInt to an object representing it as an array of integers module the given radix.
+ */
+ toArray(radix: number): BaseArray;
+
+ /**
+ * Converts a bigInt into a native Javascript number. Loses precision for numbers outside the range.
+ */
+ toJSNumber(): number;
+
+ /**
+ * Converts a bigInt to a string.
+ */
+ toString(radix?: number, alphabet?: string): string;
+
+ /**
+ * Converts a bigInt to a string. This method is called behind the scenes in JSON.stringify.
+ */
+ toJSON(): string;
+
+ /**
+ * Converts a bigInt to a native Javascript number. This override allows you to use native
+ * arithmetic operators without explicit conversion.
+ */
+ valueOf(): number;
+
+ /**
+ * Performs the bitwise XOR operation.
+ */
+ xor(number: BigNumber): BigInteger;
+ }
+
+ // Array constant accessors
+ interface BigIntegerStatic {
+ '-999': BigInteger;
+ '-998': BigInteger;
+ '-997': BigInteger;
+ '-996': BigInteger;
+ '-995': BigInteger;
+ '-994': BigInteger;
+ '-993': BigInteger;
+ '-992': BigInteger;
+ '-991': BigInteger;
+ '-990': BigInteger;
+ '-989': BigInteger;
+ '-988': BigInteger;
+ '-987': BigInteger;
+ '-986': BigInteger;
+ '-985': BigInteger;
+ '-984': BigInteger;
+ '-983': BigInteger;
+ '-982': BigInteger;
+ '-981': BigInteger;
+ '-980': BigInteger;
+ '-979': BigInteger;
+ '-978': BigInteger;
+ '-977': BigInteger;
+ '-976': BigInteger;
+ '-975': BigInteger;
+ '-974': BigInteger;
+ '-973': BigInteger;
+ '-972': BigInteger;
+ '-971': BigInteger;
+ '-970': BigInteger;
+ '-969': BigInteger;
+ '-968': BigInteger;
+ '-967': BigInteger;
+ '-966': BigInteger;
+ '-965': BigInteger;
+ '-964': BigInteger;
+ '-963': BigInteger;
+ '-962': BigInteger;
+ '-961': BigInteger;
+ '-960': BigInteger;
+ '-959': BigInteger;
+ '-958': BigInteger;
+ '-957': BigInteger;
+ '-956': BigInteger;
+ '-955': BigInteger;
+ '-954': BigInteger;
+ '-953': BigInteger;
+ '-952': BigInteger;
+ '-951': BigInteger;
+ '-950': BigInteger;
+ '-949': BigInteger;
+ '-948': BigInteger;
+ '-947': BigInteger;
+ '-946': BigInteger;
+ '-945': BigInteger;
+ '-944': BigInteger;
+ '-943': BigInteger;
+ '-942': BigInteger;
+ '-941': BigInteger;
+ '-940': BigInteger;
+ '-939': BigInteger;
+ '-938': BigInteger;
+ '-937': BigInteger;
+ '-936': BigInteger;
+ '-935': BigInteger;
+ '-934': BigInteger;
+ '-933': BigInteger;
+ '-932': BigInteger;
+ '-931': BigInteger;
+ '-930': BigInteger;
+ '-929': BigInteger;
+ '-928': BigInteger;
+ '-927': BigInteger;
+ '-926': BigInteger;
+ '-925': BigInteger;
+ '-924': BigInteger;
+ '-923': BigInteger;
+ '-922': BigInteger;
+ '-921': BigInteger;
+ '-920': BigInteger;
+ '-919': BigInteger;
+ '-918': BigInteger;
+ '-917': BigInteger;
+ '-916': BigInteger;
+ '-915': BigInteger;
+ '-914': BigInteger;
+ '-913': BigInteger;
+ '-912': BigInteger;
+ '-911': BigInteger;
+ '-910': BigInteger;
+ '-909': BigInteger;
+ '-908': BigInteger;
+ '-907': BigInteger;
+ '-906': BigInteger;
+ '-905': BigInteger;
+ '-904': BigInteger;
+ '-903': BigInteger;
+ '-902': BigInteger;
+ '-901': BigInteger;
+ '-900': BigInteger;
+ '-899': BigInteger;
+ '-898': BigInteger;
+ '-897': BigInteger;
+ '-896': BigInteger;
+ '-895': BigInteger;
+ '-894': BigInteger;
+ '-893': BigInteger;
+ '-892': BigInteger;
+ '-891': BigInteger;
+ '-890': BigInteger;
+ '-889': BigInteger;
+ '-888': BigInteger;
+ '-887': BigInteger;
+ '-886': BigInteger;
+ '-885': BigInteger;
+ '-884': BigInteger;
+ '-883': BigInteger;
+ '-882': BigInteger;
+ '-881': BigInteger;
+ '-880': BigInteger;
+ '-879': BigInteger;
+ '-878': BigInteger;
+ '-877': BigInteger;
+ '-876': BigInteger;
+ '-875': BigInteger;
+ '-874': BigInteger;
+ '-873': BigInteger;
+ '-872': BigInteger;
+ '-871': BigInteger;
+ '-870': BigInteger;
+ '-869': BigInteger;
+ '-868': BigInteger;
+ '-867': BigInteger;
+ '-866': BigInteger;
+ '-865': BigInteger;
+ '-864': BigInteger;
+ '-863': BigInteger;
+ '-862': BigInteger;
+ '-861': BigInteger;
+ '-860': BigInteger;
+ '-859': BigInteger;
+ '-858': BigInteger;
+ '-857': BigInteger;
+ '-856': BigInteger;
+ '-855': BigInteger;
+ '-854': BigInteger;
+ '-853': BigInteger;
+ '-852': BigInteger;
+ '-851': BigInteger;
+ '-850': BigInteger;
+ '-849': BigInteger;
+ '-848': BigInteger;
+ '-847': BigInteger;
+ '-846': BigInteger;
+ '-845': BigInteger;
+ '-844': BigInteger;
+ '-843': BigInteger;
+ '-842': BigInteger;
+ '-841': BigInteger;
+ '-840': BigInteger;
+ '-839': BigInteger;
+ '-838': BigInteger;
+ '-837': BigInteger;
+ '-836': BigInteger;
+ '-835': BigInteger;
+ '-834': BigInteger;
+ '-833': BigInteger;
+ '-832': BigInteger;
+ '-831': BigInteger;
+ '-830': BigInteger;
+ '-829': BigInteger;
+ '-828': BigInteger;
+ '-827': BigInteger;
+ '-826': BigInteger;
+ '-825': BigInteger;
+ '-824': BigInteger;
+ '-823': BigInteger;
+ '-822': BigInteger;
+ '-821': BigInteger;
+ '-820': BigInteger;
+ '-819': BigInteger;
+ '-818': BigInteger;
+ '-817': BigInteger;
+ '-816': BigInteger;
+ '-815': BigInteger;
+ '-814': BigInteger;
+ '-813': BigInteger;
+ '-812': BigInteger;
+ '-811': BigInteger;
+ '-810': BigInteger;
+ '-809': BigInteger;
+ '-808': BigInteger;
+ '-807': BigInteger;
+ '-806': BigInteger;
+ '-805': BigInteger;
+ '-804': BigInteger;
+ '-803': BigInteger;
+ '-802': BigInteger;
+ '-801': BigInteger;
+ '-800': BigInteger;
+ '-799': BigInteger;
+ '-798': BigInteger;
+ '-797': BigInteger;
+ '-796': BigInteger;
+ '-795': BigInteger;
+ '-794': BigInteger;
+ '-793': BigInteger;
+ '-792': BigInteger;
+ '-791': BigInteger;
+ '-790': BigInteger;
+ '-789': BigInteger;
+ '-788': BigInteger;
+ '-787': BigInteger;
+ '-786': BigInteger;
+ '-785': BigInteger;
+ '-784': BigInteger;
+ '-783': BigInteger;
+ '-782': BigInteger;
+ '-781': BigInteger;
+ '-780': BigInteger;
+ '-779': BigInteger;
+ '-778': BigInteger;
+ '-777': BigInteger;
+ '-776': BigInteger;
+ '-775': BigInteger;
+ '-774': BigInteger;
+ '-773': BigInteger;
+ '-772': BigInteger;
+ '-771': BigInteger;
+ '-770': BigInteger;
+ '-769': BigInteger;
+ '-768': BigInteger;
+ '-767': BigInteger;
+ '-766': BigInteger;
+ '-765': BigInteger;
+ '-764': BigInteger;
+ '-763': BigInteger;
+ '-762': BigInteger;
+ '-761': BigInteger;
+ '-760': BigInteger;
+ '-759': BigInteger;
+ '-758': BigInteger;
+ '-757': BigInteger;
+ '-756': BigInteger;
+ '-755': BigInteger;
+ '-754': BigInteger;
+ '-753': BigInteger;
+ '-752': BigInteger;
+ '-751': BigInteger;
+ '-750': BigInteger;
+ '-749': BigInteger;
+ '-748': BigInteger;
+ '-747': BigInteger;
+ '-746': BigInteger;
+ '-745': BigInteger;
+ '-744': BigInteger;
+ '-743': BigInteger;
+ '-742': BigInteger;
+ '-741': BigInteger;
+ '-740': BigInteger;
+ '-739': BigInteger;
+ '-738': BigInteger;
+ '-737': BigInteger;
+ '-736': BigInteger;
+ '-735': BigInteger;
+ '-734': BigInteger;
+ '-733': BigInteger;
+ '-732': BigInteger;
+ '-731': BigInteger;
+ '-730': BigInteger;
+ '-729': BigInteger;
+ '-728': BigInteger;
+ '-727': BigInteger;
+ '-726': BigInteger;
+ '-725': BigInteger;
+ '-724': BigInteger;
+ '-723': BigInteger;
+ '-722': BigInteger;
+ '-721': BigInteger;
+ '-720': BigInteger;
+ '-719': BigInteger;
+ '-718': BigInteger;
+ '-717': BigInteger;
+ '-716': BigInteger;
+ '-715': BigInteger;
+ '-714': BigInteger;
+ '-713': BigInteger;
+ '-712': BigInteger;
+ '-711': BigInteger;
+ '-710': BigInteger;
+ '-709': BigInteger;
+ '-708': BigInteger;
+ '-707': BigInteger;
+ '-706': BigInteger;
+ '-705': BigInteger;
+ '-704': BigInteger;
+ '-703': BigInteger;
+ '-702': BigInteger;
+ '-701': BigInteger;
+ '-700': BigInteger;
+ '-699': BigInteger;
+ '-698': BigInteger;
+ '-697': BigInteger;
+ '-696': BigInteger;
+ '-695': BigInteger;
+ '-694': BigInteger;
+ '-693': BigInteger;
+ '-692': BigInteger;
+ '-691': BigInteger;
+ '-690': BigInteger;
+ '-689': BigInteger;
+ '-688': BigInteger;
+ '-687': BigInteger;
+ '-686': BigInteger;
+ '-685': BigInteger;
+ '-684': BigInteger;
+ '-683': BigInteger;
+ '-682': BigInteger;
+ '-681': BigInteger;
+ '-680': BigInteger;
+ '-679': BigInteger;
+ '-678': BigInteger;
+ '-677': BigInteger;
+ '-676': BigInteger;
+ '-675': BigInteger;
+ '-674': BigInteger;
+ '-673': BigInteger;
+ '-672': BigInteger;
+ '-671': BigInteger;
+ '-670': BigInteger;
+ '-669': BigInteger;
+ '-668': BigInteger;
+ '-667': BigInteger;
+ '-666': BigInteger;
+ '-665': BigInteger;
+ '-664': BigInteger;
+ '-663': BigInteger;
+ '-662': BigInteger;
+ '-661': BigInteger;
+ '-660': BigInteger;
+ '-659': BigInteger;
+ '-658': BigInteger;
+ '-657': BigInteger;
+ '-656': BigInteger;
+ '-655': BigInteger;
+ '-654': BigInteger;
+ '-653': BigInteger;
+ '-652': BigInteger;
+ '-651': BigInteger;
+ '-650': BigInteger;
+ '-649': BigInteger;
+ '-648': BigInteger;
+ '-647': BigInteger;
+ '-646': BigInteger;
+ '-645': BigInteger;
+ '-644': BigInteger;
+ '-643': BigInteger;
+ '-642': BigInteger;
+ '-641': BigInteger;
+ '-640': BigInteger;
+ '-639': BigInteger;
+ '-638': BigInteger;
+ '-637': BigInteger;
+ '-636': BigInteger;
+ '-635': BigInteger;
+ '-634': BigInteger;
+ '-633': BigInteger;
+ '-632': BigInteger;
+ '-631': BigInteger;
+ '-630': BigInteger;
+ '-629': BigInteger;
+ '-628': BigInteger;
+ '-627': BigInteger;
+ '-626': BigInteger;
+ '-625': BigInteger;
+ '-624': BigInteger;
+ '-623': BigInteger;
+ '-622': BigInteger;
+ '-621': BigInteger;
+ '-620': BigInteger;
+ '-619': BigInteger;
+ '-618': BigInteger;
+ '-617': BigInteger;
+ '-616': BigInteger;
+ '-615': BigInteger;
+ '-614': BigInteger;
+ '-613': BigInteger;
+ '-612': BigInteger;
+ '-611': BigInteger;
+ '-610': BigInteger;
+ '-609': BigInteger;
+ '-608': BigInteger;
+ '-607': BigInteger;
+ '-606': BigInteger;
+ '-605': BigInteger;
+ '-604': BigInteger;
+ '-603': BigInteger;
+ '-602': BigInteger;
+ '-601': BigInteger;
+ '-600': BigInteger;
+ '-599': BigInteger;
+ '-598': BigInteger;
+ '-597': BigInteger;
+ '-596': BigInteger;
+ '-595': BigInteger;
+ '-594': BigInteger;
+ '-593': BigInteger;
+ '-592': BigInteger;
+ '-591': BigInteger;
+ '-590': BigInteger;
+ '-589': BigInteger;
+ '-588': BigInteger;
+ '-587': BigInteger;
+ '-586': BigInteger;
+ '-585': BigInteger;
+ '-584': BigInteger;
+ '-583': BigInteger;
+ '-582': BigInteger;
+ '-581': BigInteger;
+ '-580': BigInteger;
+ '-579': BigInteger;
+ '-578': BigInteger;
+ '-577': BigInteger;
+ '-576': BigInteger;
+ '-575': BigInteger;
+ '-574': BigInteger;
+ '-573': BigInteger;
+ '-572': BigInteger;
+ '-571': BigInteger;
+ '-570': BigInteger;
+ '-569': BigInteger;
+ '-568': BigInteger;
+ '-567': BigInteger;
+ '-566': BigInteger;
+ '-565': BigInteger;
+ '-564': BigInteger;
+ '-563': BigInteger;
+ '-562': BigInteger;
+ '-561': BigInteger;
+ '-560': BigInteger;
+ '-559': BigInteger;
+ '-558': BigInteger;
+ '-557': BigInteger;
+ '-556': BigInteger;
+ '-555': BigInteger;
+ '-554': BigInteger;
+ '-553': BigInteger;
+ '-552': BigInteger;
+ '-551': BigInteger;
+ '-550': BigInteger;
+ '-549': BigInteger;
+ '-548': BigInteger;
+ '-547': BigInteger;
+ '-546': BigInteger;
+ '-545': BigInteger;
+ '-544': BigInteger;
+ '-543': BigInteger;
+ '-542': BigInteger;
+ '-541': BigInteger;
+ '-540': BigInteger;
+ '-539': BigInteger;
+ '-538': BigInteger;
+ '-537': BigInteger;
+ '-536': BigInteger;
+ '-535': BigInteger;
+ '-534': BigInteger;
+ '-533': BigInteger;
+ '-532': BigInteger;
+ '-531': BigInteger;
+ '-530': BigInteger;
+ '-529': BigInteger;
+ '-528': BigInteger;
+ '-527': BigInteger;
+ '-526': BigInteger;
+ '-525': BigInteger;
+ '-524': BigInteger;
+ '-523': BigInteger;
+ '-522': BigInteger;
+ '-521': BigInteger;
+ '-520': BigInteger;
+ '-519': BigInteger;
+ '-518': BigInteger;
+ '-517': BigInteger;
+ '-516': BigInteger;
+ '-515': BigInteger;
+ '-514': BigInteger;
+ '-513': BigInteger;
+ '-512': BigInteger;
+ '-511': BigInteger;
+ '-510': BigInteger;
+ '-509': BigInteger;
+ '-508': BigInteger;
+ '-507': BigInteger;
+ '-506': BigInteger;
+ '-505': BigInteger;
+ '-504': BigInteger;
+ '-503': BigInteger;
+ '-502': BigInteger;
+ '-501': BigInteger;
+ '-500': BigInteger;
+ '-499': BigInteger;
+ '-498': BigInteger;
+ '-497': BigInteger;
+ '-496': BigInteger;
+ '-495': BigInteger;
+ '-494': BigInteger;
+ '-493': BigInteger;
+ '-492': BigInteger;
+ '-491': BigInteger;
+ '-490': BigInteger;
+ '-489': BigInteger;
+ '-488': BigInteger;
+ '-487': BigInteger;
+ '-486': BigInteger;
+ '-485': BigInteger;
+ '-484': BigInteger;
+ '-483': BigInteger;
+ '-482': BigInteger;
+ '-481': BigInteger;
+ '-480': BigInteger;
+ '-479': BigInteger;
+ '-478': BigInteger;
+ '-477': BigInteger;
+ '-476': BigInteger;
+ '-475': BigInteger;
+ '-474': BigInteger;
+ '-473': BigInteger;
+ '-472': BigInteger;
+ '-471': BigInteger;
+ '-470': BigInteger;
+ '-469': BigInteger;
+ '-468': BigInteger;
+ '-467': BigInteger;
+ '-466': BigInteger;
+ '-465': BigInteger;
+ '-464': BigInteger;
+ '-463': BigInteger;
+ '-462': BigInteger;
+ '-461': BigInteger;
+ '-460': BigInteger;
+ '-459': BigInteger;
+ '-458': BigInteger;
+ '-457': BigInteger;
+ '-456': BigInteger;
+ '-455': BigInteger;
+ '-454': BigInteger;
+ '-453': BigInteger;
+ '-452': BigInteger;
+ '-451': BigInteger;
+ '-450': BigInteger;
+ '-449': BigInteger;
+ '-448': BigInteger;
+ '-447': BigInteger;
+ '-446': BigInteger;
+ '-445': BigInteger;
+ '-444': BigInteger;
+ '-443': BigInteger;
+ '-442': BigInteger;
+ '-441': BigInteger;
+ '-440': BigInteger;
+ '-439': BigInteger;
+ '-438': BigInteger;
+ '-437': BigInteger;
+ '-436': BigInteger;
+ '-435': BigInteger;
+ '-434': BigInteger;
+ '-433': BigInteger;
+ '-432': BigInteger;
+ '-431': BigInteger;
+ '-430': BigInteger;
+ '-429': BigInteger;
+ '-428': BigInteger;
+ '-427': BigInteger;
+ '-426': BigInteger;
+ '-425': BigInteger;
+ '-424': BigInteger;
+ '-423': BigInteger;
+ '-422': BigInteger;
+ '-421': BigInteger;
+ '-420': BigInteger;
+ '-419': BigInteger;
+ '-418': BigInteger;
+ '-417': BigInteger;
+ '-416': BigInteger;
+ '-415': BigInteger;
+ '-414': BigInteger;
+ '-413': BigInteger;
+ '-412': BigInteger;
+ '-411': BigInteger;
+ '-410': BigInteger;
+ '-409': BigInteger;
+ '-408': BigInteger;
+ '-407': BigInteger;
+ '-406': BigInteger;
+ '-405': BigInteger;
+ '-404': BigInteger;
+ '-403': BigInteger;
+ '-402': BigInteger;
+ '-401': BigInteger;
+ '-400': BigInteger;
+ '-399': BigInteger;
+ '-398': BigInteger;
+ '-397': BigInteger;
+ '-396': BigInteger;
+ '-395': BigInteger;
+ '-394': BigInteger;
+ '-393': BigInteger;
+ '-392': BigInteger;
+ '-391': BigInteger;
+ '-390': BigInteger;
+ '-389': BigInteger;
+ '-388': BigInteger;
+ '-387': BigInteger;
+ '-386': BigInteger;
+ '-385': BigInteger;
+ '-384': BigInteger;
+ '-383': BigInteger;
+ '-382': BigInteger;
+ '-381': BigInteger;
+ '-380': BigInteger;
+ '-379': BigInteger;
+ '-378': BigInteger;
+ '-377': BigInteger;
+ '-376': BigInteger;
+ '-375': BigInteger;
+ '-374': BigInteger;
+ '-373': BigInteger;
+ '-372': BigInteger;
+ '-371': BigInteger;
+ '-370': BigInteger;
+ '-369': BigInteger;
+ '-368': BigInteger;
+ '-367': BigInteger;
+ '-366': BigInteger;
+ '-365': BigInteger;
+ '-364': BigInteger;
+ '-363': BigInteger;
+ '-362': BigInteger;
+ '-361': BigInteger;
+ '-360': BigInteger;
+ '-359': BigInteger;
+ '-358': BigInteger;
+ '-357': BigInteger;
+ '-356': BigInteger;
+ '-355': BigInteger;
+ '-354': BigInteger;
+ '-353': BigInteger;
+ '-352': BigInteger;
+ '-351': BigInteger;
+ '-350': BigInteger;
+ '-349': BigInteger;
+ '-348': BigInteger;
+ '-347': BigInteger;
+ '-346': BigInteger;
+ '-345': BigInteger;
+ '-344': BigInteger;
+ '-343': BigInteger;
+ '-342': BigInteger;
+ '-341': BigInteger;
+ '-340': BigInteger;
+ '-339': BigInteger;
+ '-338': BigInteger;
+ '-337': BigInteger;
+ '-336': BigInteger;
+ '-335': BigInteger;
+ '-334': BigInteger;
+ '-333': BigInteger;
+ '-332': BigInteger;
+ '-331': BigInteger;
+ '-330': BigInteger;
+ '-329': BigInteger;
+ '-328': BigInteger;
+ '-327': BigInteger;
+ '-326': BigInteger;
+ '-325': BigInteger;
+ '-324': BigInteger;
+ '-323': BigInteger;
+ '-322': BigInteger;
+ '-321': BigInteger;
+ '-320': BigInteger;
+ '-319': BigInteger;
+ '-318': BigInteger;
+ '-317': BigInteger;
+ '-316': BigInteger;
+ '-315': BigInteger;
+ '-314': BigInteger;
+ '-313': BigInteger;
+ '-312': BigInteger;
+ '-311': BigInteger;
+ '-310': BigInteger;
+ '-309': BigInteger;
+ '-308': BigInteger;
+ '-307': BigInteger;
+ '-306': BigInteger;
+ '-305': BigInteger;
+ '-304': BigInteger;
+ '-303': BigInteger;
+ '-302': BigInteger;
+ '-301': BigInteger;
+ '-300': BigInteger;
+ '-299': BigInteger;
+ '-298': BigInteger;
+ '-297': BigInteger;
+ '-296': BigInteger;
+ '-295': BigInteger;
+ '-294': BigInteger;
+ '-293': BigInteger;
+ '-292': BigInteger;
+ '-291': BigInteger;
+ '-290': BigInteger;
+ '-289': BigInteger;
+ '-288': BigInteger;
+ '-287': BigInteger;
+ '-286': BigInteger;
+ '-285': BigInteger;
+ '-284': BigInteger;
+ '-283': BigInteger;
+ '-282': BigInteger;
+ '-281': BigInteger;
+ '-280': BigInteger;
+ '-279': BigInteger;
+ '-278': BigInteger;
+ '-277': BigInteger;
+ '-276': BigInteger;
+ '-275': BigInteger;
+ '-274': BigInteger;
+ '-273': BigInteger;
+ '-272': BigInteger;
+ '-271': BigInteger;
+ '-270': BigInteger;
+ '-269': BigInteger;
+ '-268': BigInteger;
+ '-267': BigInteger;
+ '-266': BigInteger;
+ '-265': BigInteger;
+ '-264': BigInteger;
+ '-263': BigInteger;
+ '-262': BigInteger;
+ '-261': BigInteger;
+ '-260': BigInteger;
+ '-259': BigInteger;
+ '-258': BigInteger;
+ '-257': BigInteger;
+ '-256': BigInteger;
+ '-255': BigInteger;
+ '-254': BigInteger;
+ '-253': BigInteger;
+ '-252': BigInteger;
+ '-251': BigInteger;
+ '-250': BigInteger;
+ '-249': BigInteger;
+ '-248': BigInteger;
+ '-247': BigInteger;
+ '-246': BigInteger;
+ '-245': BigInteger;
+ '-244': BigInteger;
+ '-243': BigInteger;
+ '-242': BigInteger;
+ '-241': BigInteger;
+ '-240': BigInteger;
+ '-239': BigInteger;
+ '-238': BigInteger;
+ '-237': BigInteger;
+ '-236': BigInteger;
+ '-235': BigInteger;
+ '-234': BigInteger;
+ '-233': BigInteger;
+ '-232': BigInteger;
+ '-231': BigInteger;
+ '-230': BigInteger;
+ '-229': BigInteger;
+ '-228': BigInteger;
+ '-227': BigInteger;
+ '-226': BigInteger;
+ '-225': BigInteger;
+ '-224': BigInteger;
+ '-223': BigInteger;
+ '-222': BigInteger;
+ '-221': BigInteger;
+ '-220': BigInteger;
+ '-219': BigInteger;
+ '-218': BigInteger;
+ '-217': BigInteger;
+ '-216': BigInteger;
+ '-215': BigInteger;
+ '-214': BigInteger;
+ '-213': BigInteger;
+ '-212': BigInteger;
+ '-211': BigInteger;
+ '-210': BigInteger;
+ '-209': BigInteger;
+ '-208': BigInteger;
+ '-207': BigInteger;
+ '-206': BigInteger;
+ '-205': BigInteger;
+ '-204': BigInteger;
+ '-203': BigInteger;
+ '-202': BigInteger;
+ '-201': BigInteger;
+ '-200': BigInteger;
+ '-199': BigInteger;
+ '-198': BigInteger;
+ '-197': BigInteger;
+ '-196': BigInteger;
+ '-195': BigInteger;
+ '-194': BigInteger;
+ '-193': BigInteger;
+ '-192': BigInteger;
+ '-191': BigInteger;
+ '-190': BigInteger;
+ '-189': BigInteger;
+ '-188': BigInteger;
+ '-187': BigInteger;
+ '-186': BigInteger;
+ '-185': BigInteger;
+ '-184': BigInteger;
+ '-183': BigInteger;
+ '-182': BigInteger;
+ '-181': BigInteger;
+ '-180': BigInteger;
+ '-179': BigInteger;
+ '-178': BigInteger;
+ '-177': BigInteger;
+ '-176': BigInteger;
+ '-175': BigInteger;
+ '-174': BigInteger;
+ '-173': BigInteger;
+ '-172': BigInteger;
+ '-171': BigInteger;
+ '-170': BigInteger;
+ '-169': BigInteger;
+ '-168': BigInteger;
+ '-167': BigInteger;
+ '-166': BigInteger;
+ '-165': BigInteger;
+ '-164': BigInteger;
+ '-163': BigInteger;
+ '-162': BigInteger;
+ '-161': BigInteger;
+ '-160': BigInteger;
+ '-159': BigInteger;
+ '-158': BigInteger;
+ '-157': BigInteger;
+ '-156': BigInteger;
+ '-155': BigInteger;
+ '-154': BigInteger;
+ '-153': BigInteger;
+ '-152': BigInteger;
+ '-151': BigInteger;
+ '-150': BigInteger;
+ '-149': BigInteger;
+ '-148': BigInteger;
+ '-147': BigInteger;
+ '-146': BigInteger;
+ '-145': BigInteger;
+ '-144': BigInteger;
+ '-143': BigInteger;
+ '-142': BigInteger;
+ '-141': BigInteger;
+ '-140': BigInteger;
+ '-139': BigInteger;
+ '-138': BigInteger;
+ '-137': BigInteger;
+ '-136': BigInteger;
+ '-135': BigInteger;
+ '-134': BigInteger;
+ '-133': BigInteger;
+ '-132': BigInteger;
+ '-131': BigInteger;
+ '-130': BigInteger;
+ '-129': BigInteger;
+ '-128': BigInteger;
+ '-127': BigInteger;
+ '-126': BigInteger;
+ '-125': BigInteger;
+ '-124': BigInteger;
+ '-123': BigInteger;
+ '-122': BigInteger;
+ '-121': BigInteger;
+ '-120': BigInteger;
+ '-119': BigInteger;
+ '-118': BigInteger;
+ '-117': BigInteger;
+ '-116': BigInteger;
+ '-115': BigInteger;
+ '-114': BigInteger;
+ '-113': BigInteger;
+ '-112': BigInteger;
+ '-111': BigInteger;
+ '-110': BigInteger;
+ '-109': BigInteger;
+ '-108': BigInteger;
+ '-107': BigInteger;
+ '-106': BigInteger;
+ '-105': BigInteger;
+ '-104': BigInteger;
+ '-103': BigInteger;
+ '-102': BigInteger;
+ '-101': BigInteger;
+ '-100': BigInteger;
+ '-99': BigInteger;
+ '-98': BigInteger;
+ '-97': BigInteger;
+ '-96': BigInteger;
+ '-95': BigInteger;
+ '-94': BigInteger;
+ '-93': BigInteger;
+ '-92': BigInteger;
+ '-91': BigInteger;
+ '-90': BigInteger;
+ '-89': BigInteger;
+ '-88': BigInteger;
+ '-87': BigInteger;
+ '-86': BigInteger;
+ '-85': BigInteger;
+ '-84': BigInteger;
+ '-83': BigInteger;
+ '-82': BigInteger;
+ '-81': BigInteger;
+ '-80': BigInteger;
+ '-79': BigInteger;
+ '-78': BigInteger;
+ '-77': BigInteger;
+ '-76': BigInteger;
+ '-75': BigInteger;
+ '-74': BigInteger;
+ '-73': BigInteger;
+ '-72': BigInteger;
+ '-71': BigInteger;
+ '-70': BigInteger;
+ '-69': BigInteger;
+ '-68': BigInteger;
+ '-67': BigInteger;
+ '-66': BigInteger;
+ '-65': BigInteger;
+ '-64': BigInteger;
+ '-63': BigInteger;
+ '-62': BigInteger;
+ '-61': BigInteger;
+ '-60': BigInteger;
+ '-59': BigInteger;
+ '-58': BigInteger;
+ '-57': BigInteger;
+ '-56': BigInteger;
+ '-55': BigInteger;
+ '-54': BigInteger;
+ '-53': BigInteger;
+ '-52': BigInteger;
+ '-51': BigInteger;
+ '-50': BigInteger;
+ '-49': BigInteger;
+ '-48': BigInteger;
+ '-47': BigInteger;
+ '-46': BigInteger;
+ '-45': BigInteger;
+ '-44': BigInteger;
+ '-43': BigInteger;
+ '-42': BigInteger;
+ '-41': BigInteger;
+ '-40': BigInteger;
+ '-39': BigInteger;
+ '-38': BigInteger;
+ '-37': BigInteger;
+ '-36': BigInteger;
+ '-35': BigInteger;
+ '-34': BigInteger;
+ '-33': BigInteger;
+ '-32': BigInteger;
+ '-31': BigInteger;
+ '-30': BigInteger;
+ '-29': BigInteger;
+ '-28': BigInteger;
+ '-27': BigInteger;
+ '-26': BigInteger;
+ '-25': BigInteger;
+ '-24': BigInteger;
+ '-23': BigInteger;
+ '-22': BigInteger;
+ '-21': BigInteger;
+ '-20': BigInteger;
+ '-19': BigInteger;
+ '-18': BigInteger;
+ '-17': BigInteger;
+ '-16': BigInteger;
+ '-15': BigInteger;
+ '-14': BigInteger;
+ '-13': BigInteger;
+ '-12': BigInteger;
+ '-11': BigInteger;
+ '-10': BigInteger;
+ '-9': BigInteger;
+ '-8': BigInteger;
+ '-7': BigInteger;
+ '-6': BigInteger;
+ '-5': BigInteger;
+ '-4': BigInteger;
+ '-3': BigInteger;
+ '-2': BigInteger;
+ '-1': BigInteger;
+ '0': BigInteger;
+ '1': BigInteger;
+ '2': BigInteger;
+ '3': BigInteger;
+ '4': BigInteger;
+ '5': BigInteger;
+ '6': BigInteger;
+ '7': BigInteger;
+ '8': BigInteger;
+ '9': BigInteger;
+ '10': BigInteger;
+ '11': BigInteger;
+ '12': BigInteger;
+ '13': BigInteger;
+ '14': BigInteger;
+ '15': BigInteger;
+ '16': BigInteger;
+ '17': BigInteger;
+ '18': BigInteger;
+ '19': BigInteger;
+ '20': BigInteger;
+ '21': BigInteger;
+ '22': BigInteger;
+ '23': BigInteger;
+ '24': BigInteger;
+ '25': BigInteger;
+ '26': BigInteger;
+ '27': BigInteger;
+ '28': BigInteger;
+ '29': BigInteger;
+ '30': BigInteger;
+ '31': BigInteger;
+ '32': BigInteger;
+ '33': BigInteger;
+ '34': BigInteger;
+ '35': BigInteger;
+ '36': BigInteger;
+ '37': BigInteger;
+ '38': BigInteger;
+ '39': BigInteger;
+ '40': BigInteger;
+ '41': BigInteger;
+ '42': BigInteger;
+ '43': BigInteger;
+ '44': BigInteger;
+ '45': BigInteger;
+ '46': BigInteger;
+ '47': BigInteger;
+ '48': BigInteger;
+ '49': BigInteger;
+ '50': BigInteger;
+ '51': BigInteger;
+ '52': BigInteger;
+ '53': BigInteger;
+ '54': BigInteger;
+ '55': BigInteger;
+ '56': BigInteger;
+ '57': BigInteger;
+ '58': BigInteger;
+ '59': BigInteger;
+ '60': BigInteger;
+ '61': BigInteger;
+ '62': BigInteger;
+ '63': BigInteger;
+ '64': BigInteger;
+ '65': BigInteger;
+ '66': BigInteger;
+ '67': BigInteger;
+ '68': BigInteger;
+ '69': BigInteger;
+ '70': BigInteger;
+ '71': BigInteger;
+ '72': BigInteger;
+ '73': BigInteger;
+ '74': BigInteger;
+ '75': BigInteger;
+ '76': BigInteger;
+ '77': BigInteger;
+ '78': BigInteger;
+ '79': BigInteger;
+ '80': BigInteger;
+ '81': BigInteger;
+ '82': BigInteger;
+ '83': BigInteger;
+ '84': BigInteger;
+ '85': BigInteger;
+ '86': BigInteger;
+ '87': BigInteger;
+ '88': BigInteger;
+ '89': BigInteger;
+ '90': BigInteger;
+ '91': BigInteger;
+ '92': BigInteger;
+ '93': BigInteger;
+ '94': BigInteger;
+ '95': BigInteger;
+ '96': BigInteger;
+ '97': BigInteger;
+ '98': BigInteger;
+ '99': BigInteger;
+ '100': BigInteger;
+ '101': BigInteger;
+ '102': BigInteger;
+ '103': BigInteger;
+ '104': BigInteger;
+ '105': BigInteger;
+ '106': BigInteger;
+ '107': BigInteger;
+ '108': BigInteger;
+ '109': BigInteger;
+ '110': BigInteger;
+ '111': BigInteger;
+ '112': BigInteger;
+ '113': BigInteger;
+ '114': BigInteger;
+ '115': BigInteger;
+ '116': BigInteger;
+ '117': BigInteger;
+ '118': BigInteger;
+ '119': BigInteger;
+ '120': BigInteger;
+ '121': BigInteger;
+ '122': BigInteger;
+ '123': BigInteger;
+ '124': BigInteger;
+ '125': BigInteger;
+ '126': BigInteger;
+ '127': BigInteger;
+ '128': BigInteger;
+ '129': BigInteger;
+ '130': BigInteger;
+ '131': BigInteger;
+ '132': BigInteger;
+ '133': BigInteger;
+ '134': BigInteger;
+ '135': BigInteger;
+ '136': BigInteger;
+ '137': BigInteger;
+ '138': BigInteger;
+ '139': BigInteger;
+ '140': BigInteger;
+ '141': BigInteger;
+ '142': BigInteger;
+ '143': BigInteger;
+ '144': BigInteger;
+ '145': BigInteger;
+ '146': BigInteger;
+ '147': BigInteger;
+ '148': BigInteger;
+ '149': BigInteger;
+ '150': BigInteger;
+ '151': BigInteger;
+ '152': BigInteger;
+ '153': BigInteger;
+ '154': BigInteger;
+ '155': BigInteger;
+ '156': BigInteger;
+ '157': BigInteger;
+ '158': BigInteger;
+ '159': BigInteger;
+ '160': BigInteger;
+ '161': BigInteger;
+ '162': BigInteger;
+ '163': BigInteger;
+ '164': BigInteger;
+ '165': BigInteger;
+ '166': BigInteger;
+ '167': BigInteger;
+ '168': BigInteger;
+ '169': BigInteger;
+ '170': BigInteger;
+ '171': BigInteger;
+ '172': BigInteger;
+ '173': BigInteger;
+ '174': BigInteger;
+ '175': BigInteger;
+ '176': BigInteger;
+ '177': BigInteger;
+ '178': BigInteger;
+ '179': BigInteger;
+ '180': BigInteger;
+ '181': BigInteger;
+ '182': BigInteger;
+ '183': BigInteger;
+ '184': BigInteger;
+ '185': BigInteger;
+ '186': BigInteger;
+ '187': BigInteger;
+ '188': BigInteger;
+ '189': BigInteger;
+ '190': BigInteger;
+ '191': BigInteger;
+ '192': BigInteger;
+ '193': BigInteger;
+ '194': BigInteger;
+ '195': BigInteger;
+ '196': BigInteger;
+ '197': BigInteger;
+ '198': BigInteger;
+ '199': BigInteger;
+ '200': BigInteger;
+ '201': BigInteger;
+ '202': BigInteger;
+ '203': BigInteger;
+ '204': BigInteger;
+ '205': BigInteger;
+ '206': BigInteger;
+ '207': BigInteger;
+ '208': BigInteger;
+ '209': BigInteger;
+ '210': BigInteger;
+ '211': BigInteger;
+ '212': BigInteger;
+ '213': BigInteger;
+ '214': BigInteger;
+ '215': BigInteger;
+ '216': BigInteger;
+ '217': BigInteger;
+ '218': BigInteger;
+ '219': BigInteger;
+ '220': BigInteger;
+ '221': BigInteger;
+ '222': BigInteger;
+ '223': BigInteger;
+ '224': BigInteger;
+ '225': BigInteger;
+ '226': BigInteger;
+ '227': BigInteger;
+ '228': BigInteger;
+ '229': BigInteger;
+ '230': BigInteger;
+ '231': BigInteger;
+ '232': BigInteger;
+ '233': BigInteger;
+ '234': BigInteger;
+ '235': BigInteger;
+ '236': BigInteger;
+ '237': BigInteger;
+ '238': BigInteger;
+ '239': BigInteger;
+ '240': BigInteger;
+ '241': BigInteger;
+ '242': BigInteger;
+ '243': BigInteger;
+ '244': BigInteger;
+ '245': BigInteger;
+ '246': BigInteger;
+ '247': BigInteger;
+ '248': BigInteger;
+ '249': BigInteger;
+ '250': BigInteger;
+ '251': BigInteger;
+ '252': BigInteger;
+ '253': BigInteger;
+ '254': BigInteger;
+ '255': BigInteger;
+ '256': BigInteger;
+ '257': BigInteger;
+ '258': BigInteger;
+ '259': BigInteger;
+ '260': BigInteger;
+ '261': BigInteger;
+ '262': BigInteger;
+ '263': BigInteger;
+ '264': BigInteger;
+ '265': BigInteger;
+ '266': BigInteger;
+ '267': BigInteger;
+ '268': BigInteger;
+ '269': BigInteger;
+ '270': BigInteger;
+ '271': BigInteger;
+ '272': BigInteger;
+ '273': BigInteger;
+ '274': BigInteger;
+ '275': BigInteger;
+ '276': BigInteger;
+ '277': BigInteger;
+ '278': BigInteger;
+ '279': BigInteger;
+ '280': BigInteger;
+ '281': BigInteger;
+ '282': BigInteger;
+ '283': BigInteger;
+ '284': BigInteger;
+ '285': BigInteger;
+ '286': BigInteger;
+ '287': BigInteger;
+ '288': BigInteger;
+ '289': BigInteger;
+ '290': BigInteger;
+ '291': BigInteger;
+ '292': BigInteger;
+ '293': BigInteger;
+ '294': BigInteger;
+ '295': BigInteger;
+ '296': BigInteger;
+ '297': BigInteger;
+ '298': BigInteger;
+ '299': BigInteger;
+ '300': BigInteger;
+ '301': BigInteger;
+ '302': BigInteger;
+ '303': BigInteger;
+ '304': BigInteger;
+ '305': BigInteger;
+ '306': BigInteger;
+ '307': BigInteger;
+ '308': BigInteger;
+ '309': BigInteger;
+ '310': BigInteger;
+ '311': BigInteger;
+ '312': BigInteger;
+ '313': BigInteger;
+ '314': BigInteger;
+ '315': BigInteger;
+ '316': BigInteger;
+ '317': BigInteger;
+ '318': BigInteger;
+ '319': BigInteger;
+ '320': BigInteger;
+ '321': BigInteger;
+ '322': BigInteger;
+ '323': BigInteger;
+ '324': BigInteger;
+ '325': BigInteger;
+ '326': BigInteger;
+ '327': BigInteger;
+ '328': BigInteger;
+ '329': BigInteger;
+ '330': BigInteger;
+ '331': BigInteger;
+ '332': BigInteger;
+ '333': BigInteger;
+ '334': BigInteger;
+ '335': BigInteger;
+ '336': BigInteger;
+ '337': BigInteger;
+ '338': BigInteger;
+ '339': BigInteger;
+ '340': BigInteger;
+ '341': BigInteger;
+ '342': BigInteger;
+ '343': BigInteger;
+ '344': BigInteger;
+ '345': BigInteger;
+ '346': BigInteger;
+ '347': BigInteger;
+ '348': BigInteger;
+ '349': BigInteger;
+ '350': BigInteger;
+ '351': BigInteger;
+ '352': BigInteger;
+ '353': BigInteger;
+ '354': BigInteger;
+ '355': BigInteger;
+ '356': BigInteger;
+ '357': BigInteger;
+ '358': BigInteger;
+ '359': BigInteger;
+ '360': BigInteger;
+ '361': BigInteger;
+ '362': BigInteger;
+ '363': BigInteger;
+ '364': BigInteger;
+ '365': BigInteger;
+ '366': BigInteger;
+ '367': BigInteger;
+ '368': BigInteger;
+ '369': BigInteger;
+ '370': BigInteger;
+ '371': BigInteger;
+ '372': BigInteger;
+ '373': BigInteger;
+ '374': BigInteger;
+ '375': BigInteger;
+ '376': BigInteger;
+ '377': BigInteger;
+ '378': BigInteger;
+ '379': BigInteger;
+ '380': BigInteger;
+ '381': BigInteger;
+ '382': BigInteger;
+ '383': BigInteger;
+ '384': BigInteger;
+ '385': BigInteger;
+ '386': BigInteger;
+ '387': BigInteger;
+ '388': BigInteger;
+ '389': BigInteger;
+ '390': BigInteger;
+ '391': BigInteger;
+ '392': BigInteger;
+ '393': BigInteger;
+ '394': BigInteger;
+ '395': BigInteger;
+ '396': BigInteger;
+ '397': BigInteger;
+ '398': BigInteger;
+ '399': BigInteger;
+ '400': BigInteger;
+ '401': BigInteger;
+ '402': BigInteger;
+ '403': BigInteger;
+ '404': BigInteger;
+ '405': BigInteger;
+ '406': BigInteger;
+ '407': BigInteger;
+ '408': BigInteger;
+ '409': BigInteger;
+ '410': BigInteger;
+ '411': BigInteger;
+ '412': BigInteger;
+ '413': BigInteger;
+ '414': BigInteger;
+ '415': BigInteger;
+ '416': BigInteger;
+ '417': BigInteger;
+ '418': BigInteger;
+ '419': BigInteger;
+ '420': BigInteger;
+ '421': BigInteger;
+ '422': BigInteger;
+ '423': BigInteger;
+ '424': BigInteger;
+ '425': BigInteger;
+ '426': BigInteger;
+ '427': BigInteger;
+ '428': BigInteger;
+ '429': BigInteger;
+ '430': BigInteger;
+ '431': BigInteger;
+ '432': BigInteger;
+ '433': BigInteger;
+ '434': BigInteger;
+ '435': BigInteger;
+ '436': BigInteger;
+ '437': BigInteger;
+ '438': BigInteger;
+ '439': BigInteger;
+ '440': BigInteger;
+ '441': BigInteger;
+ '442': BigInteger;
+ '443': BigInteger;
+ '444': BigInteger;
+ '445': BigInteger;
+ '446': BigInteger;
+ '447': BigInteger;
+ '448': BigInteger;
+ '449': BigInteger;
+ '450': BigInteger;
+ '451': BigInteger;
+ '452': BigInteger;
+ '453': BigInteger;
+ '454': BigInteger;
+ '455': BigInteger;
+ '456': BigInteger;
+ '457': BigInteger;
+ '458': BigInteger;
+ '459': BigInteger;
+ '460': BigInteger;
+ '461': BigInteger;
+ '462': BigInteger;
+ '463': BigInteger;
+ '464': BigInteger;
+ '465': BigInteger;
+ '466': BigInteger;
+ '467': BigInteger;
+ '468': BigInteger;
+ '469': BigInteger;
+ '470': BigInteger;
+ '471': BigInteger;
+ '472': BigInteger;
+ '473': BigInteger;
+ '474': BigInteger;
+ '475': BigInteger;
+ '476': BigInteger;
+ '477': BigInteger;
+ '478': BigInteger;
+ '479': BigInteger;
+ '480': BigInteger;
+ '481': BigInteger;
+ '482': BigInteger;
+ '483': BigInteger;
+ '484': BigInteger;
+ '485': BigInteger;
+ '486': BigInteger;
+ '487': BigInteger;
+ '488': BigInteger;
+ '489': BigInteger;
+ '490': BigInteger;
+ '491': BigInteger;
+ '492': BigInteger;
+ '493': BigInteger;
+ '494': BigInteger;
+ '495': BigInteger;
+ '496': BigInteger;
+ '497': BigInteger;
+ '498': BigInteger;
+ '499': BigInteger;
+ '500': BigInteger;
+ '501': BigInteger;
+ '502': BigInteger;
+ '503': BigInteger;
+ '504': BigInteger;
+ '505': BigInteger;
+ '506': BigInteger;
+ '507': BigInteger;
+ '508': BigInteger;
+ '509': BigInteger;
+ '510': BigInteger;
+ '511': BigInteger;
+ '512': BigInteger;
+ '513': BigInteger;
+ '514': BigInteger;
+ '515': BigInteger;
+ '516': BigInteger;
+ '517': BigInteger;
+ '518': BigInteger;
+ '519': BigInteger;
+ '520': BigInteger;
+ '521': BigInteger;
+ '522': BigInteger;
+ '523': BigInteger;
+ '524': BigInteger;
+ '525': BigInteger;
+ '526': BigInteger;
+ '527': BigInteger;
+ '528': BigInteger;
+ '529': BigInteger;
+ '530': BigInteger;
+ '531': BigInteger;
+ '532': BigInteger;
+ '533': BigInteger;
+ '534': BigInteger;
+ '535': BigInteger;
+ '536': BigInteger;
+ '537': BigInteger;
+ '538': BigInteger;
+ '539': BigInteger;
+ '540': BigInteger;
+ '541': BigInteger;
+ '542': BigInteger;
+ '543': BigInteger;
+ '544': BigInteger;
+ '545': BigInteger;
+ '546': BigInteger;
+ '547': BigInteger;
+ '548': BigInteger;
+ '549': BigInteger;
+ '550': BigInteger;
+ '551': BigInteger;
+ '552': BigInteger;
+ '553': BigInteger;
+ '554': BigInteger;
+ '555': BigInteger;
+ '556': BigInteger;
+ '557': BigInteger;
+ '558': BigInteger;
+ '559': BigInteger;
+ '560': BigInteger;
+ '561': BigInteger;
+ '562': BigInteger;
+ '563': BigInteger;
+ '564': BigInteger;
+ '565': BigInteger;
+ '566': BigInteger;
+ '567': BigInteger;
+ '568': BigInteger;
+ '569': BigInteger;
+ '570': BigInteger;
+ '571': BigInteger;
+ '572': BigInteger;
+ '573': BigInteger;
+ '574': BigInteger;
+ '575': BigInteger;
+ '576': BigInteger;
+ '577': BigInteger;
+ '578': BigInteger;
+ '579': BigInteger;
+ '580': BigInteger;
+ '581': BigInteger;
+ '582': BigInteger;
+ '583': BigInteger;
+ '584': BigInteger;
+ '585': BigInteger;
+ '586': BigInteger;
+ '587': BigInteger;
+ '588': BigInteger;
+ '589': BigInteger;
+ '590': BigInteger;
+ '591': BigInteger;
+ '592': BigInteger;
+ '593': BigInteger;
+ '594': BigInteger;
+ '595': BigInteger;
+ '596': BigInteger;
+ '597': BigInteger;
+ '598': BigInteger;
+ '599': BigInteger;
+ '600': BigInteger;
+ '601': BigInteger;
+ '602': BigInteger;
+ '603': BigInteger;
+ '604': BigInteger;
+ '605': BigInteger;
+ '606': BigInteger;
+ '607': BigInteger;
+ '608': BigInteger;
+ '609': BigInteger;
+ '610': BigInteger;
+ '611': BigInteger;
+ '612': BigInteger;
+ '613': BigInteger;
+ '614': BigInteger;
+ '615': BigInteger;
+ '616': BigInteger;
+ '617': BigInteger;
+ '618': BigInteger;
+ '619': BigInteger;
+ '620': BigInteger;
+ '621': BigInteger;
+ '622': BigInteger;
+ '623': BigInteger;
+ '624': BigInteger;
+ '625': BigInteger;
+ '626': BigInteger;
+ '627': BigInteger;
+ '628': BigInteger;
+ '629': BigInteger;
+ '630': BigInteger;
+ '631': BigInteger;
+ '632': BigInteger;
+ '633': BigInteger;
+ '634': BigInteger;
+ '635': BigInteger;
+ '636': BigInteger;
+ '637': BigInteger;
+ '638': BigInteger;
+ '639': BigInteger;
+ '640': BigInteger;
+ '641': BigInteger;
+ '642': BigInteger;
+ '643': BigInteger;
+ '644': BigInteger;
+ '645': BigInteger;
+ '646': BigInteger;
+ '647': BigInteger;
+ '648': BigInteger;
+ '649': BigInteger;
+ '650': BigInteger;
+ '651': BigInteger;
+ '652': BigInteger;
+ '653': BigInteger;
+ '654': BigInteger;
+ '655': BigInteger;
+ '656': BigInteger;
+ '657': BigInteger;
+ '658': BigInteger;
+ '659': BigInteger;
+ '660': BigInteger;
+ '661': BigInteger;
+ '662': BigInteger;
+ '663': BigInteger;
+ '664': BigInteger;
+ '665': BigInteger;
+ '666': BigInteger;
+ '667': BigInteger;
+ '668': BigInteger;
+ '669': BigInteger;
+ '670': BigInteger;
+ '671': BigInteger;
+ '672': BigInteger;
+ '673': BigInteger;
+ '674': BigInteger;
+ '675': BigInteger;
+ '676': BigInteger;
+ '677': BigInteger;
+ '678': BigInteger;
+ '679': BigInteger;
+ '680': BigInteger;
+ '681': BigInteger;
+ '682': BigInteger;
+ '683': BigInteger;
+ '684': BigInteger;
+ '685': BigInteger;
+ '686': BigInteger;
+ '687': BigInteger;
+ '688': BigInteger;
+ '689': BigInteger;
+ '690': BigInteger;
+ '691': BigInteger;
+ '692': BigInteger;
+ '693': BigInteger;
+ '694': BigInteger;
+ '695': BigInteger;
+ '696': BigInteger;
+ '697': BigInteger;
+ '698': BigInteger;
+ '699': BigInteger;
+ '700': BigInteger;
+ '701': BigInteger;
+ '702': BigInteger;
+ '703': BigInteger;
+ '704': BigInteger;
+ '705': BigInteger;
+ '706': BigInteger;
+ '707': BigInteger;
+ '708': BigInteger;
+ '709': BigInteger;
+ '710': BigInteger;
+ '711': BigInteger;
+ '712': BigInteger;
+ '713': BigInteger;
+ '714': BigInteger;
+ '715': BigInteger;
+ '716': BigInteger;
+ '717': BigInteger;
+ '718': BigInteger;
+ '719': BigInteger;
+ '720': BigInteger;
+ '721': BigInteger;
+ '722': BigInteger;
+ '723': BigInteger;
+ '724': BigInteger;
+ '725': BigInteger;
+ '726': BigInteger;
+ '727': BigInteger;
+ '728': BigInteger;
+ '729': BigInteger;
+ '730': BigInteger;
+ '731': BigInteger;
+ '732': BigInteger;
+ '733': BigInteger;
+ '734': BigInteger;
+ '735': BigInteger;
+ '736': BigInteger;
+ '737': BigInteger;
+ '738': BigInteger;
+ '739': BigInteger;
+ '740': BigInteger;
+ '741': BigInteger;
+ '742': BigInteger;
+ '743': BigInteger;
+ '744': BigInteger;
+ '745': BigInteger;
+ '746': BigInteger;
+ '747': BigInteger;
+ '748': BigInteger;
+ '749': BigInteger;
+ '750': BigInteger;
+ '751': BigInteger;
+ '752': BigInteger;
+ '753': BigInteger;
+ '754': BigInteger;
+ '755': BigInteger;
+ '756': BigInteger;
+ '757': BigInteger;
+ '758': BigInteger;
+ '759': BigInteger;
+ '760': BigInteger;
+ '761': BigInteger;
+ '762': BigInteger;
+ '763': BigInteger;
+ '764': BigInteger;
+ '765': BigInteger;
+ '766': BigInteger;
+ '767': BigInteger;
+ '768': BigInteger;
+ '769': BigInteger;
+ '770': BigInteger;
+ '771': BigInteger;
+ '772': BigInteger;
+ '773': BigInteger;
+ '774': BigInteger;
+ '775': BigInteger;
+ '776': BigInteger;
+ '777': BigInteger;
+ '778': BigInteger;
+ '779': BigInteger;
+ '780': BigInteger;
+ '781': BigInteger;
+ '782': BigInteger;
+ '783': BigInteger;
+ '784': BigInteger;
+ '785': BigInteger;
+ '786': BigInteger;
+ '787': BigInteger;
+ '788': BigInteger;
+ '789': BigInteger;
+ '790': BigInteger;
+ '791': BigInteger;
+ '792': BigInteger;
+ '793': BigInteger;
+ '794': BigInteger;
+ '795': BigInteger;
+ '796': BigInteger;
+ '797': BigInteger;
+ '798': BigInteger;
+ '799': BigInteger;
+ '800': BigInteger;
+ '801': BigInteger;
+ '802': BigInteger;
+ '803': BigInteger;
+ '804': BigInteger;
+ '805': BigInteger;
+ '806': BigInteger;
+ '807': BigInteger;
+ '808': BigInteger;
+ '809': BigInteger;
+ '810': BigInteger;
+ '811': BigInteger;
+ '812': BigInteger;
+ '813': BigInteger;
+ '814': BigInteger;
+ '815': BigInteger;
+ '816': BigInteger;
+ '817': BigInteger;
+ '818': BigInteger;
+ '819': BigInteger;
+ '820': BigInteger;
+ '821': BigInteger;
+ '822': BigInteger;
+ '823': BigInteger;
+ '824': BigInteger;
+ '825': BigInteger;
+ '826': BigInteger;
+ '827': BigInteger;
+ '828': BigInteger;
+ '829': BigInteger;
+ '830': BigInteger;
+ '831': BigInteger;
+ '832': BigInteger;
+ '833': BigInteger;
+ '834': BigInteger;
+ '835': BigInteger;
+ '836': BigInteger;
+ '837': BigInteger;
+ '838': BigInteger;
+ '839': BigInteger;
+ '840': BigInteger;
+ '841': BigInteger;
+ '842': BigInteger;
+ '843': BigInteger;
+ '844': BigInteger;
+ '845': BigInteger;
+ '846': BigInteger;
+ '847': BigInteger;
+ '848': BigInteger;
+ '849': BigInteger;
+ '850': BigInteger;
+ '851': BigInteger;
+ '852': BigInteger;
+ '853': BigInteger;
+ '854': BigInteger;
+ '855': BigInteger;
+ '856': BigInteger;
+ '857': BigInteger;
+ '858': BigInteger;
+ '859': BigInteger;
+ '860': BigInteger;
+ '861': BigInteger;
+ '862': BigInteger;
+ '863': BigInteger;
+ '864': BigInteger;
+ '865': BigInteger;
+ '866': BigInteger;
+ '867': BigInteger;
+ '868': BigInteger;
+ '869': BigInteger;
+ '870': BigInteger;
+ '871': BigInteger;
+ '872': BigInteger;
+ '873': BigInteger;
+ '874': BigInteger;
+ '875': BigInteger;
+ '876': BigInteger;
+ '877': BigInteger;
+ '878': BigInteger;
+ '879': BigInteger;
+ '880': BigInteger;
+ '881': BigInteger;
+ '882': BigInteger;
+ '883': BigInteger;
+ '884': BigInteger;
+ '885': BigInteger;
+ '886': BigInteger;
+ '887': BigInteger;
+ '888': BigInteger;
+ '889': BigInteger;
+ '890': BigInteger;
+ '891': BigInteger;
+ '892': BigInteger;
+ '893': BigInteger;
+ '894': BigInteger;
+ '895': BigInteger;
+ '896': BigInteger;
+ '897': BigInteger;
+ '898': BigInteger;
+ '899': BigInteger;
+ '900': BigInteger;
+ '901': BigInteger;
+ '902': BigInteger;
+ '903': BigInteger;
+ '904': BigInteger;
+ '905': BigInteger;
+ '906': BigInteger;
+ '907': BigInteger;
+ '908': BigInteger;
+ '909': BigInteger;
+ '910': BigInteger;
+ '911': BigInteger;
+ '912': BigInteger;
+ '913': BigInteger;
+ '914': BigInteger;
+ '915': BigInteger;
+ '916': BigInteger;
+ '917': BigInteger;
+ '918': BigInteger;
+ '919': BigInteger;
+ '920': BigInteger;
+ '921': BigInteger;
+ '922': BigInteger;
+ '923': BigInteger;
+ '924': BigInteger;
+ '925': BigInteger;
+ '926': BigInteger;
+ '927': BigInteger;
+ '928': BigInteger;
+ '929': BigInteger;
+ '930': BigInteger;
+ '931': BigInteger;
+ '932': BigInteger;
+ '933': BigInteger;
+ '934': BigInteger;
+ '935': BigInteger;
+ '936': BigInteger;
+ '937': BigInteger;
+ '938': BigInteger;
+ '939': BigInteger;
+ '940': BigInteger;
+ '941': BigInteger;
+ '942': BigInteger;
+ '943': BigInteger;
+ '944': BigInteger;
+ '945': BigInteger;
+ '946': BigInteger;
+ '947': BigInteger;
+ '948': BigInteger;
+ '949': BigInteger;
+ '950': BigInteger;
+ '951': BigInteger;
+ '952': BigInteger;
+ '953': BigInteger;
+ '954': BigInteger;
+ '955': BigInteger;
+ '956': BigInteger;
+ '957': BigInteger;
+ '958': BigInteger;
+ '959': BigInteger;
+ '960': BigInteger;
+ '961': BigInteger;
+ '962': BigInteger;
+ '963': BigInteger;
+ '964': BigInteger;
+ '965': BigInteger;
+ '966': BigInteger;
+ '967': BigInteger;
+ '968': BigInteger;
+ '969': BigInteger;
+ '970': BigInteger;
+ '971': BigInteger;
+ '972': BigInteger;
+ '973': BigInteger;
+ '974': BigInteger;
+ '975': BigInteger;
+ '976': BigInteger;
+ '977': BigInteger;
+ '978': BigInteger;
+ '979': BigInteger;
+ '980': BigInteger;
+ '981': BigInteger;
+ '982': BigInteger;
+ '983': BigInteger;
+ '984': BigInteger;
+ '985': BigInteger;
+ '986': BigInteger;
+ '987': BigInteger;
+ '988': BigInteger;
+ '989': BigInteger;
+ '990': BigInteger;
+ '991': BigInteger;
+ '992': BigInteger;
+ '993': BigInteger;
+ '994': BigInteger;
+ '995': BigInteger;
+ '996': BigInteger;
+ '997': BigInteger;
+ '998': BigInteger;
+ '999': BigInteger;
+ }
+
+ interface BaseArray {
+ value: number[],
+ isNegative: boolean
+ }
+}
diff --git a/node_modules/big-integer/BigInteger.js b/node_modules/big-integer/BigInteger.js
new file mode 100644
index 0000000..ecda792
--- /dev/null
+++ b/node_modules/big-integer/BigInteger.js
@@ -0,0 +1,1453 @@
+var bigInt = (function (undefined) {
+ "use strict";
+
+ var BASE = 1e7,
+ LOG_BASE = 7,
+ MAX_INT = 9007199254740992,
+ MAX_INT_ARR = smallToArray(MAX_INT),
+ DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
+
+ var supportsNativeBigInt = typeof BigInt === "function";
+
+ function Integer(v, radix, alphabet, caseSensitive) {
+ if (typeof v === "undefined") return Integer[0];
+ if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
+ return parseValue(v);
+ }
+
+ function BigInteger(value, sign) {
+ this.value = value;
+ this.sign = sign;
+ this.isSmall = false;
+ }
+ BigInteger.prototype = Object.create(Integer.prototype);
+
+ function SmallInteger(value) {
+ this.value = value;
+ this.sign = value < 0;
+ this.isSmall = true;
+ }
+ SmallInteger.prototype = Object.create(Integer.prototype);
+
+ function NativeBigInt(value) {
+ this.value = value;
+ }
+ NativeBigInt.prototype = Object.create(Integer.prototype);
+
+ function isPrecise(n) {
+ return -MAX_INT < n && n < MAX_INT;
+ }
+
+ function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes
+ if (n < 1e7)
+ return [n];
+ if (n < 1e14)
+ return [n % 1e7, Math.floor(n / 1e7)];
+ return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
+ }
+
+ function arrayToSmall(arr) { // If BASE changes this function may need to change
+ trim(arr);
+ var length = arr.length;
+ if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
+ switch (length) {
+ case 0: return 0;
+ case 1: return arr[0];
+ case 2: return arr[0] + arr[1] * BASE;
+ default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
+ }
+ }
+ return arr;
+ }
+
+ function trim(v) {
+ var i = v.length;
+ while (v[--i] === 0);
+ v.length = i + 1;
+ }
+
+ function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger
+ var x = new Array(length);
+ var i = -1;
+ while (++i < length) {
+ x[i] = 0;
+ }
+ return x;
+ }
+
+ function truncate(n) {
+ if (n > 0) return Math.floor(n);
+ return Math.ceil(n);
+ }
+
+ function add(a, b) { // assumes a and b are arrays with a.length >= b.length
+ var l_a = a.length,
+ l_b = b.length,
+ r = new Array(l_a),
+ carry = 0,
+ base = BASE,
+ sum, i;
+ for (i = 0; i < l_b; i++) {
+ sum = a[i] + b[i] + carry;
+ carry = sum >= base ? 1 : 0;
+ r[i] = sum - carry * base;
+ }
+ while (i < l_a) {
+ sum = a[i] + carry;
+ carry = sum === base ? 1 : 0;
+ r[i++] = sum - carry * base;
+ }
+ if (carry > 0) r.push(carry);
+ return r;
+ }
+
+ function addAny(a, b) {
+ if (a.length >= b.length) return add(a, b);
+ return add(b, a);
+ }
+
+ function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT
+ var l = a.length,
+ r = new Array(l),
+ base = BASE,
+ sum, i;
+ for (i = 0; i < l; i++) {
+ sum = a[i] - base + carry;
+ carry = Math.floor(sum / base);
+ r[i] = sum - carry * base;
+ carry += 1;
+ }
+ while (carry > 0) {
+ r[i++] = carry % base;
+ carry = Math.floor(carry / base);
+ }
+ return r;
+ }
+
+ BigInteger.prototype.add = function (v) {
+ var n = parseValue(v);
+ if (this.sign !== n.sign) {
+ return this.subtract(n.negate());
+ }
+ var a = this.value, b = n.value;
+ if (n.isSmall) {
+ return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
+ }
+ return new BigInteger(addAny(a, b), this.sign);
+ };
+ BigInteger.prototype.plus = BigInteger.prototype.add;
+
+ SmallInteger.prototype.add = function (v) {
+ var n = parseValue(v);
+ var a = this.value;
+ if (a < 0 !== n.sign) {
+ return this.subtract(n.negate());
+ }
+ var b = n.value;
+ if (n.isSmall) {
+ if (isPrecise(a + b)) return new SmallInteger(a + b);
+ b = smallToArray(Math.abs(b));
+ }
+ return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
+ };
+ SmallInteger.prototype.plus = SmallInteger.prototype.add;
+
+ NativeBigInt.prototype.add = function (v) {
+ return new NativeBigInt(this.value + parseValue(v).value);
+ }
+ NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
+
+ function subtract(a, b) { // assumes a and b are arrays with a >= b
+ var a_l = a.length,
+ b_l = b.length,
+ r = new Array(a_l),
+ borrow = 0,
+ base = BASE,
+ i, difference;
+ for (i = 0; i < b_l; i++) {
+ difference = a[i] - borrow - b[i];
+ if (difference < 0) {
+ difference += base;
+ borrow = 1;
+ } else borrow = 0;
+ r[i] = difference;
+ }
+ for (i = b_l; i < a_l; i++) {
+ difference = a[i] - borrow;
+ if (difference < 0) difference += base;
+ else {
+ r[i++] = difference;
+ break;
+ }
+ r[i] = difference;
+ }
+ for (; i < a_l; i++) {
+ r[i] = a[i];
+ }
+ trim(r);
+ return r;
+ }
+
+ function subtractAny(a, b, sign) {
+ var value;
+ if (compareAbs(a, b) >= 0) {
+ value = subtract(a, b);
+ } else {
+ value = subtract(b, a);
+ sign = !sign;
+ }
+ value = arrayToSmall(value);
+ if (typeof value === "number") {
+ if (sign) value = -value;
+ return new SmallInteger(value);
+ }
+ return new BigInteger(value, sign);
+ }
+
+ function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT
+ var l = a.length,
+ r = new Array(l),
+ carry = -b,
+ base = BASE,
+ i, difference;
+ for (i = 0; i < l; i++) {
+ difference = a[i] + carry;
+ carry = Math.floor(difference / base);
+ difference %= base;
+ r[i] = difference < 0 ? difference + base : difference;
+ }
+ r = arrayToSmall(r);
+ if (typeof r === "number") {
+ if (sign) r = -r;
+ return new SmallInteger(r);
+ } return new BigInteger(r, sign);
+ }
+
+ BigInteger.prototype.subtract = function (v) {
+ var n = parseValue(v);
+ if (this.sign !== n.sign) {
+ return this.add(n.negate());
+ }
+ var a = this.value, b = n.value;
+ if (n.isSmall)
+ return subtractSmall(a, Math.abs(b), this.sign);
+ return subtractAny(a, b, this.sign);
+ };
+ BigInteger.prototype.minus = BigInteger.prototype.subtract;
+
+ SmallInteger.prototype.subtract = function (v) {
+ var n = parseValue(v);
+ var a = this.value;
+ if (a < 0 !== n.sign) {
+ return this.add(n.negate());
+ }
+ var b = n.value;
+ if (n.isSmall) {
+ return new SmallInteger(a - b);
+ }
+ return subtractSmall(b, Math.abs(a), a >= 0);
+ };
+ SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
+
+ NativeBigInt.prototype.subtract = function (v) {
+ return new NativeBigInt(this.value - parseValue(v).value);
+ }
+ NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
+
+ BigInteger.prototype.negate = function () {
+ return new BigInteger(this.value, !this.sign);
+ };
+ SmallInteger.prototype.negate = function () {
+ var sign = this.sign;
+ var small = new SmallInteger(-this.value);
+ small.sign = !sign;
+ return small;
+ };
+ NativeBigInt.prototype.negate = function () {
+ return new NativeBigInt(-this.value);
+ }
+
+ BigInteger.prototype.abs = function () {
+ return new BigInteger(this.value, false);
+ };
+ SmallInteger.prototype.abs = function () {
+ return new SmallInteger(Math.abs(this.value));
+ };
+ NativeBigInt.prototype.abs = function () {
+ return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
+ }
+
+
+ function multiplyLong(a, b) {
+ var a_l = a.length,
+ b_l = b.length,
+ l = a_l + b_l,
+ r = createArray(l),
+ base = BASE,
+ product, carry, i, a_i, b_j;
+ for (i = 0; i < a_l; ++i) {
+ a_i = a[i];
+ for (var j = 0; j < b_l; ++j) {
+ b_j = b[j];
+ product = a_i * b_j + r[i + j];
+ carry = Math.floor(product / base);
+ r[i + j] = product - carry * base;
+ r[i + j + 1] += carry;
+ }
+ }
+ trim(r);
+ return r;
+ }
+
+ function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE
+ var l = a.length,
+ r = new Array(l),
+ base = BASE,
+ carry = 0,
+ product, i;
+ for (i = 0; i < l; i++) {
+ product = a[i] * b + carry;
+ carry = Math.floor(product / base);
+ r[i] = product - carry * base;
+ }
+ while (carry > 0) {
+ r[i++] = carry % base;
+ carry = Math.floor(carry / base);
+ }
+ return r;
+ }
+
+ function shiftLeft(x, n) {
+ var r = [];
+ while (n-- > 0) r.push(0);
+ return r.concat(x);
+ }
+
+ function multiplyKaratsuba(x, y) {
+ var n = Math.max(x.length, y.length);
+
+ if (n <= 30) return multiplyLong(x, y);
+ n = Math.ceil(n / 2);
+
+ var b = x.slice(n),
+ a = x.slice(0, n),
+ d = y.slice(n),
+ c = y.slice(0, n);
+
+ var ac = multiplyKaratsuba(a, c),
+ bd = multiplyKaratsuba(b, d),
+ abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
+
+ var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
+ trim(product);
+ return product;
+ }
+
+ // The following function is derived from a surface fit of a graph plotting the performance difference
+ // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.
+ function useKaratsuba(l1, l2) {
+ return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;
+ }
+
+ BigInteger.prototype.multiply = function (v) {
+ var n = parseValue(v),
+ a = this.value, b = n.value,
+ sign = this.sign !== n.sign,
+ abs;
+ if (n.isSmall) {
+ if (b === 0) return Integer[0];
+ if (b === 1) return this;
+ if (b === -1) return this.negate();
+ abs = Math.abs(b);
+ if (abs < BASE) {
+ return new BigInteger(multiplySmall(a, abs), sign);
+ }
+ b = smallToArray(abs);
+ }
+ if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes
+ return new BigInteger(multiplyKaratsuba(a, b), sign);
+ return new BigInteger(multiplyLong(a, b), sign);
+ };
+
+ BigInteger.prototype.times = BigInteger.prototype.multiply;
+
+ function multiplySmallAndArray(a, b, sign) { // a >= 0
+ if (a < BASE) {
+ return new BigInteger(multiplySmall(b, a), sign);
+ }
+ return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
+ }
+ SmallInteger.prototype._multiplyBySmall = function (a) {
+ if (isPrecise(a.value * this.value)) {
+ return new SmallInteger(a.value * this.value);
+ }
+ return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
+ };
+ BigInteger.prototype._multiplyBySmall = function (a) {
+ if (a.value === 0) return Integer[0];
+ if (a.value === 1) return this;
+ if (a.value === -1) return this.negate();
+ return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
+ };
+ SmallInteger.prototype.multiply = function (v) {
+ return parseValue(v)._multiplyBySmall(this);
+ };
+ SmallInteger.prototype.times = SmallInteger.prototype.multiply;
+
+ NativeBigInt.prototype.multiply = function (v) {
+ return new NativeBigInt(this.value * parseValue(v).value);
+ }
+ NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
+
+ function square(a) {
+ //console.assert(2 * BASE * BASE < MAX_INT);
+ var l = a.length,
+ r = createArray(l + l),
+ base = BASE,
+ product, carry, i, a_i, a_j;
+ for (i = 0; i < l; i++) {
+ a_i = a[i];
+ carry = 0 - a_i * a_i;
+ for (var j = i; j < l; j++) {
+ a_j = a[j];
+ product = 2 * (a_i * a_j) + r[i + j] + carry;
+ carry = Math.floor(product / base);
+ r[i + j] = product - carry * base;
+ }
+ r[i + l] = carry;
+ }
+ trim(r);
+ return r;
+ }
+
+ BigInteger.prototype.square = function () {
+ return new BigInteger(square(this.value), false);
+ };
+
+ SmallInteger.prototype.square = function () {
+ var value = this.value * this.value;
+ if (isPrecise(value)) return new SmallInteger(value);
+ return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
+ };
+
+ NativeBigInt.prototype.square = function (v) {
+ return new NativeBigInt(this.value * this.value);
+ }
+
+ function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.
+ var a_l = a.length,
+ b_l = b.length,
+ base = BASE,
+ result = createArray(b.length),
+ divisorMostSignificantDigit = b[b_l - 1],
+ // normalization
+ lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),
+ remainder = multiplySmall(a, lambda),
+ divisor = multiplySmall(b, lambda),
+ quotientDigit, shift, carry, borrow, i, l, q;
+ if (remainder.length <= a_l) remainder.push(0);
+ divisor.push(0);
+ divisorMostSignificantDigit = divisor[b_l - 1];
+ for (shift = a_l - b_l; shift >= 0; shift--) {
+ quotientDigit = base - 1;
+ if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
+ quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
+ }
+ // quotientDigit <= base - 1
+ carry = 0;
+ borrow = 0;
+ l = divisor.length;
+ for (i = 0; i < l; i++) {
+ carry += quotientDigit * divisor[i];
+ q = Math.floor(carry / base);
+ borrow += remainder[shift + i] - (carry - q * base);
+ carry = q;
+ if (borrow < 0) {
+ remainder[shift + i] = borrow + base;
+ borrow = -1;
+ } else {
+ remainder[shift + i] = borrow;
+ borrow = 0;
+ }
+ }
+ while (borrow !== 0) {
+ quotientDigit -= 1;
+ carry = 0;
+ for (i = 0; i < l; i++) {
+ carry += remainder[shift + i] - base + divisor[i];
+ if (carry < 0) {
+ remainder[shift + i] = carry + base;
+ carry = 0;
+ } else {
+ remainder[shift + i] = carry;
+ carry = 1;
+ }
+ }
+ borrow += carry;
+ }
+ result[shift] = quotientDigit;
+ }
+ // denormalization
+ remainder = divModSmall(remainder, lambda)[0];
+ return [arrayToSmall(result), arrayToSmall(remainder)];
+ }
+
+ function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/
+ // Performs faster than divMod1 on larger input sizes.
+ var a_l = a.length,
+ b_l = b.length,
+ result = [],
+ part = [],
+ base = BASE,
+ guess, xlen, highx, highy, check;
+ while (a_l) {
+ part.unshift(a[--a_l]);
+ trim(part);
+ if (compareAbs(part, b) < 0) {
+ result.push(0);
+ continue;
+ }
+ xlen = part.length;
+ highx = part[xlen - 1] * base + part[xlen - 2];
+ highy = b[b_l - 1] * base + b[b_l - 2];
+ if (xlen > b_l) {
+ highx = (highx + 1) * base;
+ }
+ guess = Math.ceil(highx / highy);
+ do {
+ check = multiplySmall(b, guess);
+ if (compareAbs(check, part) <= 0) break;
+ guess--;
+ } while (guess);
+ result.push(guess);
+ part = subtract(part, check);
+ }
+ result.reverse();
+ return [arrayToSmall(result), arrayToSmall(part)];
+ }
+
+ function divModSmall(value, lambda) {
+ var length = value.length,
+ quotient = createArray(length),
+ base = BASE,
+ i, q, remainder, divisor;
+ remainder = 0;
+ for (i = length - 1; i >= 0; --i) {
+ divisor = remainder * base + value[i];
+ q = truncate(divisor / lambda);
+ remainder = divisor - q * lambda;
+ quotient[i] = q | 0;
+ }
+ return [quotient, remainder | 0];
+ }
+
+ function divModAny(self, v) {
+ var value, n = parseValue(v);
+ if (supportsNativeBigInt) {
+ return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];
+ }
+ var a = self.value, b = n.value;
+ var quotient;
+ if (b === 0) throw new Error("Cannot divide by zero");
+ if (self.isSmall) {
+ if (n.isSmall) {
+ return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
+ }
+ return [Integer[0], self];
+ }
+ if (n.isSmall) {
+ if (b === 1) return [self, Integer[0]];
+ if (b == -1) return [self.negate(), Integer[0]];
+ var abs = Math.abs(b);
+ if (abs < BASE) {
+ value = divModSmall(a, abs);
+ quotient = arrayToSmall(value[0]);
+ var remainder = value[1];
+ if (self.sign) remainder = -remainder;
+ if (typeof quotient === "number") {
+ if (self.sign !== n.sign) quotient = -quotient;
+ return [new SmallInteger(quotient), new SmallInteger(remainder)];
+ }
+ return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
+ }
+ b = smallToArray(abs);
+ }
+ var comparison = compareAbs(a, b);
+ if (comparison === -1) return [Integer[0], self];
+ if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
+
+ // divMod1 is faster on smaller input sizes
+ if (a.length + b.length <= 200)
+ value = divMod1(a, b);
+ else value = divMod2(a, b);
+
+ quotient = value[0];
+ var qSign = self.sign !== n.sign,
+ mod = value[1],
+ mSign = self.sign;
+ if (typeof quotient === "number") {
+ if (qSign) quotient = -quotient;
+ quotient = new SmallInteger(quotient);
+ } else quotient = new BigInteger(quotient, qSign);
+ if (typeof mod === "number") {
+ if (mSign) mod = -mod;
+ mod = new SmallInteger(mod);
+ } else mod = new BigInteger(mod, mSign);
+ return [quotient, mod];
+ }
+
+ BigInteger.prototype.divmod = function (v) {
+ var result = divModAny(this, v);
+ return {
+ quotient: result[0],
+ remainder: result[1]
+ };
+ };
+ NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
+
+
+ BigInteger.prototype.divide = function (v) {
+ return divModAny(this, v)[0];
+ };
+ NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {
+ return new NativeBigInt(this.value / parseValue(v).value);
+ };
+ SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
+
+ BigInteger.prototype.mod = function (v) {
+ return divModAny(this, v)[1];
+ };
+ NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {
+ return new NativeBigInt(this.value % parseValue(v).value);
+ };
+ SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
+
+ BigInteger.prototype.pow = function (v) {
+ var n = parseValue(v),
+ a = this.value,
+ b = n.value,
+ value, x, y;
+ if (b === 0) return Integer[1];
+ if (a === 0) return Integer[0];
+ if (a === 1) return Integer[1];
+ if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
+ if (n.sign) {
+ return Integer[0];
+ }
+ if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
+ if (this.isSmall) {
+ if (isPrecise(value = Math.pow(a, b)))
+ return new SmallInteger(truncate(value));
+ }
+ x = this;
+ y = Integer[1];
+ while (true) {
+ if (b & 1 === 1) {
+ y = y.times(x);
+ --b;
+ }
+ if (b === 0) break;
+ b /= 2;
+ x = x.square();
+ }
+ return y;
+ };
+ SmallInteger.prototype.pow = BigInteger.prototype.pow;
+
+ NativeBigInt.prototype.pow = function (v) {
+ var n = parseValue(v);
+ var a = this.value, b = n.value;
+ var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
+ if (b === _0) return Integer[1];
+ if (a === _0) return Integer[0];
+ if (a === _1) return Integer[1];
+ if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];
+ if (n.isNegative()) return new NativeBigInt(_0);
+ var x = this;
+ var y = Integer[1];
+ while (true) {
+ if ((b & _1) === _1) {
+ y = y.times(x);
+ --b;
+ }
+ if (b === _0) break;
+ b /= _2;
+ x = x.square();
+ }
+ return y;
+ }
+
+ BigInteger.prototype.modPow = function (exp, mod) {
+ exp = parseValue(exp);
+ mod = parseValue(mod);
+ if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
+ var r = Integer[1],
+ base = this.mod(mod);
+ if (exp.isNegative()) {
+ exp = exp.multiply(Integer[-1]);
+ base = base.modInv(mod);
+ }
+ while (exp.isPositive()) {
+ if (base.isZero()) return Integer[0];
+ if (exp.isOdd()) r = r.multiply(base).mod(mod);
+ exp = exp.divide(2);
+ base = base.square().mod(mod);
+ }
+ return r;
+ };
+ NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
+
+ function compareAbs(a, b) {
+ if (a.length !== b.length) {
+ return a.length > b.length ? 1 : -1;
+ }
+ for (var i = a.length - 1; i >= 0; i--) {
+ if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;
+ }
+ return 0;
+ }
+
+ BigInteger.prototype.compareAbs = function (v) {
+ var n = parseValue(v),
+ a = this.value,
+ b = n.value;
+ if (n.isSmall) return 1;
+ return compareAbs(a, b);
+ };
+ SmallInteger.prototype.compareAbs = function (v) {
+ var n = parseValue(v),
+ a = Math.abs(this.value),
+ b = n.value;
+ if (n.isSmall) {
+ b = Math.abs(b);
+ return a === b ? 0 : a > b ? 1 : -1;
+ }
+ return -1;
+ };
+ NativeBigInt.prototype.compareAbs = function (v) {
+ var a = this.value;
+ var b = parseValue(v).value;
+ a = a >= 0 ? a : -a;
+ b = b >= 0 ? b : -b;
+ return a === b ? 0 : a > b ? 1 : -1;
+ }
+
+ BigInteger.prototype.compare = function (v) {
+ // See discussion about comparison with Infinity:
+ // https://github.com/peterolson/BigInteger.js/issues/61
+ if (v === Infinity) {
+ return -1;
+ }
+ if (v === -Infinity) {
+ return 1;
+ }
+
+ var n = parseValue(v),
+ a = this.value,
+ b = n.value;
+ if (this.sign !== n.sign) {
+ return n.sign ? 1 : -1;
+ }
+ if (n.isSmall) {
+ return this.sign ? -1 : 1;
+ }
+ return compareAbs(a, b) * (this.sign ? -1 : 1);
+ };
+ BigInteger.prototype.compareTo = BigInteger.prototype.compare;
+
+ SmallInteger.prototype.compare = function (v) {
+ if (v === Infinity) {
+ return -1;
+ }
+ if (v === -Infinity) {
+ return 1;
+ }
+
+ var n = parseValue(v),
+ a = this.value,
+ b = n.value;
+ if (n.isSmall) {
+ return a == b ? 0 : a > b ? 1 : -1;
+ }
+ if (a < 0 !== n.sign) {
+ return a < 0 ? -1 : 1;
+ }
+ return a < 0 ? 1 : -1;
+ };
+ SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
+
+ NativeBigInt.prototype.compare = function (v) {
+ if (v === Infinity) {
+ return -1;
+ }
+ if (v === -Infinity) {
+ return 1;
+ }
+ var a = this.value;
+ var b = parseValue(v).value;
+ return a === b ? 0 : a > b ? 1 : -1;
+ }
+ NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
+
+ BigInteger.prototype.equals = function (v) {
+ return this.compare(v) === 0;
+ };
+ NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
+
+ BigInteger.prototype.notEquals = function (v) {
+ return this.compare(v) !== 0;
+ };
+ NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
+
+ BigInteger.prototype.greater = function (v) {
+ return this.compare(v) > 0;
+ };
+ NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
+
+ BigInteger.prototype.lesser = function (v) {
+ return this.compare(v) < 0;
+ };
+ NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
+
+ BigInteger.prototype.greaterOrEquals = function (v) {
+ return this.compare(v) >= 0;
+ };
+ NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
+
+ BigInteger.prototype.lesserOrEquals = function (v) {
+ return this.compare(v) <= 0;
+ };
+ NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
+
+ BigInteger.prototype.isEven = function () {
+ return (this.value[0] & 1) === 0;
+ };
+ SmallInteger.prototype.isEven = function () {
+ return (this.value & 1) === 0;
+ };
+ NativeBigInt.prototype.isEven = function () {
+ return (this.value & BigInt(1)) === BigInt(0);
+ }
+
+ BigInteger.prototype.isOdd = function () {
+ return (this.value[0] & 1) === 1;
+ };
+ SmallInteger.prototype.isOdd = function () {
+ return (this.value & 1) === 1;
+ };
+ NativeBigInt.prototype.isOdd = function () {
+ return (this.value & BigInt(1)) === BigInt(1);
+ }
+
+ BigInteger.prototype.isPositive = function () {
+ return !this.sign;
+ };
+ SmallInteger.prototype.isPositive = function () {
+ return this.value > 0;
+ };
+ NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
+
+ BigInteger.prototype.isNegative = function () {
+ return this.sign;
+ };
+ SmallInteger.prototype.isNegative = function () {
+ return this.value < 0;
+ };
+ NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
+
+ BigInteger.prototype.isUnit = function () {
+ return false;
+ };
+ SmallInteger.prototype.isUnit = function () {
+ return Math.abs(this.value) === 1;
+ };
+ NativeBigInt.prototype.isUnit = function () {
+ return this.abs().value === BigInt(1);
+ }
+
+ BigInteger.prototype.isZero = function () {
+ return false;
+ };
+ SmallInteger.prototype.isZero = function () {
+ return this.value === 0;
+ };
+ NativeBigInt.prototype.isZero = function () {
+ return this.value === BigInt(0);
+ }
+
+ BigInteger.prototype.isDivisibleBy = function (v) {
+ var n = parseValue(v);
+ if (n.isZero()) return false;
+ if (n.isUnit()) return true;
+ if (n.compareAbs(2) === 0) return this.isEven();
+ return this.mod(n).isZero();
+ };
+ NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
+
+ function isBasicPrime(v) {
+ var n = v.abs();
+ if (n.isUnit()) return false;
+ if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
+ if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
+ if (n.lesser(49)) return true;
+ // we don't know if it's prime: let the other functions figure it out
+ }
+
+ function millerRabinTest(n, a) {
+ var nPrev = n.prev(),
+ b = nPrev,
+ r = 0,
+ d, t, i, x;
+ while (b.isEven()) b = b.divide(2), r++;
+ next: for (i = 0; i < a.length; i++) {
+ if (n.lesser(a[i])) continue;
+ x = bigInt(a[i]).modPow(b, n);
+ if (x.isUnit() || x.equals(nPrev)) continue;
+ for (d = r - 1; d != 0; d--) {
+ x = x.square().mod(n);
+ if (x.isUnit()) return false;
+ if (x.equals(nPrev)) continue next;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
+ BigInteger.prototype.isPrime = function (strict) {
+ var isPrime = isBasicPrime(this);
+ if (isPrime !== undefined) return isPrime;
+ var n = this.abs();
+ var bits = n.bitLength();
+ if (bits <= 64)
+ return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
+ var logN = Math.log(2) * bits.toJSNumber();
+ var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);
+ for (var a = [], i = 0; i < t; i++) {
+ a.push(bigInt(i + 2));
+ }
+ return millerRabinTest(n, a);
+ };
+ NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
+
+ BigInteger.prototype.isProbablePrime = function (iterations, rng) {
+ var isPrime = isBasicPrime(this);
+ if (isPrime !== undefined) return isPrime;
+ var n = this.abs();
+ var t = iterations === undefined ? 5 : iterations;
+ for (var a = [], i = 0; i < t; i++) {
+ a.push(bigInt.randBetween(2, n.minus(2), rng));
+ }
+ return millerRabinTest(n, a);
+ };
+ NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
+
+ BigInteger.prototype.modInv = function (n) {
+ var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
+ while (!newR.isZero()) {
+ q = r.divide(newR);
+ lastT = t;
+ lastR = r;
+ t = newT;
+ r = newR;
+ newT = lastT.subtract(q.multiply(newT));
+ newR = lastR.subtract(q.multiply(newR));
+ }
+ if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
+ if (t.compare(0) === -1) {
+ t = t.add(n);
+ }
+ if (this.isNegative()) {
+ return t.negate();
+ }
+ return t;
+ };
+
+ NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
+
+ BigInteger.prototype.next = function () {
+ var value = this.value;
+ if (this.sign) {
+ return subtractSmall(value, 1, this.sign);
+ }
+ return new BigInteger(addSmall(value, 1), this.sign);
+ };
+ SmallInteger.prototype.next = function () {
+ var value = this.value;
+ if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
+ return new BigInteger(MAX_INT_ARR, false);
+ };
+ NativeBigInt.prototype.next = function () {
+ return new NativeBigInt(this.value + BigInt(1));
+ }
+
+ BigInteger.prototype.prev = function () {
+ var value = this.value;
+ if (this.sign) {
+ return new BigInteger(addSmall(value, 1), true);
+ }
+ return subtractSmall(value, 1, this.sign);
+ };
+ SmallInteger.prototype.prev = function () {
+ var value = this.value;
+ if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
+ return new BigInteger(MAX_INT_ARR, true);
+ };
+ NativeBigInt.prototype.prev = function () {
+ return new NativeBigInt(this.value - BigInt(1));
+ }
+
+ var powersOfTwo = [1];
+ while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
+ var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
+
+ function shift_isSmall(n) {
+ return Math.abs(n) <= BASE;
+ }
+
+ BigInteger.prototype.shiftLeft = function (v) {
+ var n = parseValue(v).toJSNumber();
+ if (!shift_isSmall(n)) {
+ throw new Error(String(n) + " is too large for shifting.");
+ }
+ if (n < 0) return this.shiftRight(-n);
+ var result = this;
+ if (result.isZero()) return result;
+ while (n >= powers2Length) {
+ result = result.multiply(highestPower2);
+ n -= powers2Length - 1;
+ }
+ return result.multiply(powersOfTwo[n]);
+ };
+ NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
+
+ BigInteger.prototype.shiftRight = function (v) {
+ var remQuo;
+ var n = parseValue(v).toJSNumber();
+ if (!shift_isSmall(n)) {
+ throw new Error(String(n) + " is too large for shifting.");
+ }
+ if (n < 0) return this.shiftLeft(-n);
+ var result = this;
+ while (n >= powers2Length) {
+ if (result.isZero() || (result.isNegative() && result.isUnit())) return result;
+ remQuo = divModAny(result, highestPower2);
+ result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
+ n -= powers2Length - 1;
+ }
+ remQuo = divModAny(result, powersOfTwo[n]);
+ return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
+ };
+ NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
+
+ function bitwise(x, y, fn) {
+ y = parseValue(y);
+ var xSign = x.isNegative(), ySign = y.isNegative();
+ var xRem = xSign ? x.not() : x,
+ yRem = ySign ? y.not() : y;
+ var xDigit = 0, yDigit = 0;
+ var xDivMod = null, yDivMod = null;
+ var result = [];
+ while (!xRem.isZero() || !yRem.isZero()) {
+ xDivMod = divModAny(xRem, highestPower2);
+ xDigit = xDivMod[1].toJSNumber();
+ if (xSign) {
+ xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers
+ }
+
+ yDivMod = divModAny(yRem, highestPower2);
+ yDigit = yDivMod[1].toJSNumber();
+ if (ySign) {
+ yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers
+ }
+
+ xRem = xDivMod[0];
+ yRem = yDivMod[0];
+ result.push(fn(xDigit, yDigit));
+ }
+ var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
+ for (var i = result.length - 1; i >= 0; i -= 1) {
+ sum = sum.multiply(highestPower2).add(bigInt(result[i]));
+ }
+ return sum;
+ }
+
+ BigInteger.prototype.not = function () {
+ return this.negate().prev();
+ };
+ NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
+
+ BigInteger.prototype.and = function (n) {
+ return bitwise(this, n, function (a, b) { return a & b; });
+ };
+ NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
+
+ BigInteger.prototype.or = function (n) {
+ return bitwise(this, n, function (a, b) { return a | b; });
+ };
+ NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
+
+ BigInteger.prototype.xor = function (n) {
+ return bitwise(this, n, function (a, b) { return a ^ b; });
+ };
+ NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
+
+ var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
+ function roughLOB(n) { // get lowestOneBit (rough)
+ // SmallInteger: return Min(lowestOneBit(n), 1 << 30)
+ // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]
+ var v = n.value,
+ x = typeof v === "number" ? v | LOBMASK_I :
+ typeof v === "bigint" ? v | BigInt(LOBMASK_I) :
+ v[0] + v[1] * BASE | LOBMASK_BI;
+ return x & -x;
+ }
+
+ function integerLogarithm(value, base) {
+ if (base.compareTo(value) <= 0) {
+ var tmp = integerLogarithm(value, base.square(base));
+ var p = tmp.p;
+ var e = tmp.e;
+ var t = p.multiply(base);
+ return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };
+ }
+ return { p: bigInt(1), e: 0 };
+ }
+
+ BigInteger.prototype.bitLength = function () {
+ var n = this;
+ if (n.compareTo(bigInt(0)) < 0) {
+ n = n.negate().subtract(bigInt(1));
+ }
+ if (n.compareTo(bigInt(0)) === 0) {
+ return bigInt(0);
+ }
+ return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
+ }
+ NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
+
+ function max(a, b) {
+ a = parseValue(a);
+ b = parseValue(b);
+ return a.greater(b) ? a : b;
+ }
+ function min(a, b) {
+ a = parseValue(a);
+ b = parseValue(b);
+ return a.lesser(b) ? a : b;
+ }
+ function gcd(a, b) {
+ a = parseValue(a).abs();
+ b = parseValue(b).abs();
+ if (a.equals(b)) return a;
+ if (a.isZero()) return b;
+ if (b.isZero()) return a;
+ var c = Integer[1], d, t;
+ while (a.isEven() && b.isEven()) {
+ d = min(roughLOB(a), roughLOB(b));
+ a = a.divide(d);
+ b = b.divide(d);
+ c = c.multiply(d);
+ }
+ while (a.isEven()) {
+ a = a.divide(roughLOB(a));
+ }
+ do {
+ while (b.isEven()) {
+ b = b.divide(roughLOB(b));
+ }
+ if (a.greater(b)) {
+ t = b; b = a; a = t;
+ }
+ b = b.subtract(a);
+ } while (!b.isZero());
+ return c.isUnit() ? a : a.multiply(c);
+ }
+ function lcm(a, b) {
+ a = parseValue(a).abs();
+ b = parseValue(b).abs();
+ return a.divide(gcd(a, b)).multiply(b);
+ }
+ function randBetween(a, b, rng) {
+ a = parseValue(a);
+ b = parseValue(b);
+ var usedRNG = rng || Math.random;
+ var low = min(a, b), high = max(a, b);
+ var range = high.subtract(low).add(1);
+ if (range.isSmall) return low.add(Math.floor(usedRNG() * range));
+ var digits = toBase(range, BASE).value;
+ var result = [], restricted = true;
+ for (var i = 0; i < digits.length; i++) {
+ var top = restricted ? digits[i] + (i + 1 < digits.length ? digits[i + 1] / BASE : 0) : BASE;
+ var digit = truncate(usedRNG() * top);
+ result.push(digit);
+ if (digit < digits[i]) restricted = false;
+ }
+ return low.add(Integer.fromArray(result, BASE, false));
+ }
+
+ var parseBase = function (text, base, alphabet, caseSensitive) {
+ alphabet = alphabet || DEFAULT_ALPHABET;
+ text = String(text);
+ if (!caseSensitive) {
+ text = text.toLowerCase();
+ alphabet = alphabet.toLowerCase();
+ }
+ var length = text.length;
+ var i;
+ var absBase = Math.abs(base);
+ var alphabetValues = {};
+ for (i = 0; i < alphabet.length; i++) {
+ alphabetValues[alphabet[i]] = i;
+ }
+ for (i = 0; i < length; i++) {
+ var c = text[i];
+ if (c === "-") continue;
+ if (c in alphabetValues) {
+ if (alphabetValues[c] >= absBase) {
+ if (c === "1" && absBase === 1) continue;
+ throw new Error(c + " is not a valid digit in base " + base + ".");
+ }
+ }
+ }
+ base = parseValue(base);
+ var digits = [];
+ var isNegative = text[0] === "-";
+ for (i = isNegative ? 1 : 0; i < text.length; i++) {
+ var c = text[i];
+ if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
+ else if (c === "<") {
+ var start = i;
+ do { i++; } while (text[i] !== ">" && i < text.length);
+ digits.push(parseValue(text.slice(start + 1, i)));
+ }
+ else throw new Error(c + " is not a valid character");
+ }
+ return parseBaseFromArray(digits, base, isNegative);
+ };
+
+ function parseBaseFromArray(digits, base, isNegative) {
+ var val = Integer[0], pow = Integer[1], i;
+ for (i = digits.length - 1; i >= 0; i--) {
+ val = val.add(digits[i].times(pow));
+ pow = pow.times(base);
+ }
+ return isNegative ? val.negate() : val;
+ }
+
+ function stringify(digit, alphabet) {
+ alphabet = alphabet || DEFAULT_ALPHABET;
+ if (digit < alphabet.length) {
+ return alphabet[digit];
+ }
+ return "<" + digit + ">";
+ }
+
+ function toBase(n, base) {
+ base = bigInt(base);
+ if (base.isZero()) {
+ if (n.isZero()) return { value: [0], isNegative: false };
+ throw new Error("Cannot convert nonzero numbers to base 0.");
+ }
+ if (base.equals(-1)) {
+ if (n.isZero()) return { value: [0], isNegative: false };
+ if (n.isNegative())
+ return {
+ value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))
+ .map(Array.prototype.valueOf, [1, 0])
+ ),
+ isNegative: false
+ };
+
+ var arr = Array.apply(null, Array(n.toJSNumber() - 1))
+ .map(Array.prototype.valueOf, [0, 1]);
+ arr.unshift([1]);
+ return {
+ value: [].concat.apply([], arr),
+ isNegative: false
+ };
+ }
+
+ var neg = false;
+ if (n.isNegative() && base.isPositive()) {
+ neg = true;
+ n = n.abs();
+ }
+ if (base.isUnit()) {
+ if (n.isZero()) return { value: [0], isNegative: false };
+
+ return {
+ value: Array.apply(null, Array(n.toJSNumber()))
+ .map(Number.prototype.valueOf, 1),
+ isNegative: neg
+ };
+ }
+ var out = [];
+ var left = n, divmod;
+ while (left.isNegative() || left.compareAbs(base) >= 0) {
+ divmod = left.divmod(base);
+ left = divmod.quotient;
+ var digit = divmod.remainder;
+ if (digit.isNegative()) {
+ digit = base.minus(digit).abs();
+ left = left.next();
+ }
+ out.push(digit.toJSNumber());
+ }
+ out.push(left.toJSNumber());
+ return { value: out.reverse(), isNegative: neg };
+ }
+
+ function toBaseString(n, base, alphabet) {
+ var arr = toBase(n, base);
+ return (arr.isNegative ? "-" : "") + arr.value.map(function (x) {
+ return stringify(x, alphabet);
+ }).join('');
+ }
+
+ BigInteger.prototype.toArray = function (radix) {
+ return toBase(this, radix);
+ };
+
+ SmallInteger.prototype.toArray = function (radix) {
+ return toBase(this, radix);
+ };
+
+ NativeBigInt.prototype.toArray = function (radix) {
+ return toBase(this, radix);
+ };
+
+ BigInteger.prototype.toString = function (radix, alphabet) {
+ if (radix === undefined) radix = 10;
+ if (radix !== 10) return toBaseString(this, radix, alphabet);
+ var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
+ while (--l >= 0) {
+ digit = String(v[l]);
+ str += zeros.slice(digit.length) + digit;
+ }
+ var sign = this.sign ? "-" : "";
+ return sign + str;
+ };
+
+ SmallInteger.prototype.toString = function (radix, alphabet) {
+ if (radix === undefined) radix = 10;
+ if (radix != 10) return toBaseString(this, radix, alphabet);
+ return String(this.value);
+ };
+
+ NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
+
+ NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }
+
+ BigInteger.prototype.valueOf = function () {
+ return parseInt(this.toString(), 10);
+ };
+ BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
+
+ SmallInteger.prototype.valueOf = function () {
+ return this.value;
+ };
+ SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
+ NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {
+ return parseInt(this.toString(), 10);
+ }
+
+ function parseStringValue(v) {
+ if (isPrecise(+v)) {
+ var x = +v;
+ if (x === truncate(x))
+ return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
+ throw new Error("Invalid integer: " + v);
+ }
+ var sign = v[0] === "-";
+ if (sign) v = v.slice(1);
+ var split = v.split(/e/i);
+ if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
+ if (split.length === 2) {
+ var exp = split[1];
+ if (exp[0] === "+") exp = exp.slice(1);
+ exp = +exp;
+ if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
+ var text = split[0];
+ var decimalPlace = text.indexOf(".");
+ if (decimalPlace >= 0) {
+ exp -= text.length - decimalPlace - 1;
+ text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
+ }
+ if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
+ text += (new Array(exp + 1)).join("0");
+ v = text;
+ }
+ var isValid = /^([0-9][0-9]*)$/.test(v);
+ if (!isValid) throw new Error("Invalid integer: " + v);
+ if (supportsNativeBigInt) {
+ return new NativeBigInt(BigInt(sign ? "-" + v : v));
+ }
+ var r = [], max = v.length, l = LOG_BASE, min = max - l;
+ while (max > 0) {
+ r.push(+v.slice(min, max));
+ min -= l;
+ if (min < 0) min = 0;
+ max -= l;
+ }
+ trim(r);
+ return new BigInteger(r, sign);
+ }
+
+ function parseNumberValue(v) {
+ if (supportsNativeBigInt) {
+ return new NativeBigInt(BigInt(v));
+ }
+ if (isPrecise(v)) {
+ if (v !== truncate(v)) throw new Error(v + " is not an integer.");
+ return new SmallInteger(v);
+ }
+ return parseStringValue(v.toString());
+ }
+
+ function parseValue(v) {
+ if (typeof v === "number") {
+ return parseNumberValue(v);
+ }
+ if (typeof v === "string") {
+ return parseStringValue(v);
+ }
+ if (typeof v === "bigint") {
+ return new NativeBigInt(v);
+ }
+ return v;
+ }
+ // Pre-define numbers in range [-999,999]
+ for (var i = 0; i < 1000; i++) {
+ Integer[i] = parseValue(i);
+ if (i > 0) Integer[-i] = parseValue(-i);
+ }
+ // Backwards compatibility
+ Integer.one = Integer[1];
+ Integer.zero = Integer[0];
+ Integer.minusOne = Integer[-1];
+ Integer.max = max;
+ Integer.min = min;
+ Integer.gcd = gcd;
+ Integer.lcm = lcm;
+ Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };
+ Integer.randBetween = randBetween;
+
+ Integer.fromArray = function (digits, base, isNegative) {
+ return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
+ };
+
+ return Integer;
+})();
+
+// Node.js check
+if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
+ module.exports = bigInt;
+}
+
+//amd check
+if (typeof define === "function" && define.amd) {
+ define( function () {
+ return bigInt;
+ });
+}
diff --git a/node_modules/big-integer/BigInteger.min.js b/node_modules/big-integer/BigInteger.min.js
new file mode 100644
index 0000000..09835af
--- /dev/null
+++ b/node_modules/big-integer/BigInteger.min.js
@@ -0,0 +1 @@
+var bigInt=function(t){"use strict";var e=1e7,r=9007199254740992,o=f(r),n="0123456789abcdefghijklmnopqrstuvwxyz",i="function"==typeof BigInt;function u(t,e,r,o){return void 0===t?u[0]:void 0!==e&&(10!=+e||r)?_(t,e,r,o):K(t)}function p(t,e){this.value=t,this.sign=e,this.isSmall=!1}function a(t){this.value=t,this.sign=t<0,this.isSmall=!0}function s(t){this.value=t}function l(t){return-r0?Math.floor(t):Math.ceil(t)}function c(t,r){var o,n,i=t.length,u=r.length,p=new Array(i),a=0,s=e;for(n=0;n=s?1:0,p[n]=o-a*s;for(;n0&&p.push(a),p}function m(t,e){return t.length>=e.length?c(t,e):c(e,t)}function d(t,r){var o,n,i=t.length,u=new Array(i),p=e;for(n=0;n0;)u[n++]=r%p,r=Math.floor(r/p);return u}function b(t,r){var o,n,i=t.length,u=r.length,p=new Array(i),a=0,s=e;for(o=0;o0;)u[n++]=a%p,a=Math.floor(a/p);return u}function q(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function M(t,e){var r=Math.max(t.length,e.length);if(r<=30)return S(t,e);r=Math.ceil(r/2);var o=t.slice(r),n=t.slice(0,r),i=e.slice(r),u=e.slice(0,r),p=M(n,u),a=M(o,i),s=M(m(n,o),m(u,i)),l=m(m(p,q(b(b(s,p),a),r)),q(a,2*r));return h(l),l}function N(t,r,o){return new p(t=0;--r)n=(i=1e7*n+t[r])-(o=g(i/e))*e,p[r]=0|o;return[p,0|n]}function B(t,r){var o,n=K(r);if(i)return[new s(t.value/n.value),new s(t.value%n.value)];var l,c=t.value,m=n.value;if(0===m)throw new Error("Cannot divide by zero");if(t.isSmall)return n.isSmall?[new a(g(c/m)),new a(c%m)]:[u[0],t];if(n.isSmall){if(1===m)return[t,u[0]];if(-1==m)return[t.negate(),u[0]];var d=Math.abs(m);if(d=0;n--){for(o=h-1,d[n+f]!==c&&(o=Math.floor((d[n+f]*h+d[n+f-1])/c)),i=0,u=0,a=b.length,p=0;ps&&(i=(i+1)*y),o=Math.ceil(i/u);do{if(A(p=I(r,o),f)<=0)break;o--}while(o);l.push(o),f=b(f,p)}return l.reverse(),[v(l),v(f)]}(c,m),l=o[0];var q=t.sign!==n.sign,M=o[1],N=t.sign;return"number"==typeof l?(q&&(l=-l),l=new a(l)):l=new p(l,q),"number"==typeof M?(N&&(M=-M),M=new a(M)):M=new p(M,N),[l,M]}function A(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function P(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function Z(t,e){for(var r,o,n,i=t.prev(),u=i,p=0;u.isEven();)u=u.divide(2),p++;t:for(o=0;o=0?o=b(t,e):(o=b(e,t),r=!r),"number"==typeof(o=v(o))?(r&&(o=-o),new a(o)):new p(o,r)}(r,o,this.sign)},p.prototype.minus=p.prototype.subtract,a.prototype.subtract=function(t){var e=K(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var o=e.value;return e.isSmall?new a(r-o):w(o,Math.abs(r),r>=0)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){return new s(this.value-K(t).value)},s.prototype.minus=s.prototype.subtract,p.prototype.negate=function(){return new p(this.value,!this.sign)},a.prototype.negate=function(){var t=this.sign,e=new a(-this.value);return e.sign=!t,e},s.prototype.negate=function(){return new s(-this.value)},p.prototype.abs=function(){return new p(this.value,!1)},a.prototype.abs=function(){return new a(Math.abs(this.value))},s.prototype.abs=function(){return new s(this.value>=0?this.value:-this.value)},p.prototype.multiply=function(t){var r,o,n,i=K(t),a=this.value,s=i.value,l=this.sign!==i.sign;if(i.isSmall){if(0===s)return u[0];if(1===s)return this;if(-1===s)return this.negate();if((r=Math.abs(s))0?M(a,s):S(a,s),l)},p.prototype.times=p.prototype.multiply,a.prototype._multiplyBySmall=function(t){return l(t.value*this.value)?new a(t.value*this.value):N(Math.abs(t.value),f(Math.abs(this.value)),this.sign!==t.sign)},p.prototype._multiplyBySmall=function(t){return 0===t.value?u[0]:1===t.value?this:-1===t.value?this.negate():N(Math.abs(t.value),this.value,this.sign!==t.sign)},a.prototype.multiply=function(t){return K(t)._multiplyBySmall(this)},a.prototype.times=a.prototype.multiply,s.prototype.multiply=function(t){return new s(this.value*K(t).value)},s.prototype.times=s.prototype.multiply,p.prototype.square=function(){return new p(E(this.value),!1)},a.prototype.square=function(){var t=this.value*this.value;return l(t)?new a(t):new p(E(f(Math.abs(this.value))),!1)},s.prototype.square=function(t){return new s(this.value*this.value)},p.prototype.divmod=function(t){var e=B(this,t);return{quotient:e[0],remainder:e[1]}},s.prototype.divmod=a.prototype.divmod=p.prototype.divmod,p.prototype.divide=function(t){return B(this,t)[0]},s.prototype.over=s.prototype.divide=function(t){return new s(this.value/K(t).value)},a.prototype.over=a.prototype.divide=p.prototype.over=p.prototype.divide,p.prototype.mod=function(t){return B(this,t)[1]},s.prototype.mod=s.prototype.remainder=function(t){return new s(this.value%K(t).value)},a.prototype.remainder=a.prototype.mod=p.prototype.remainder=p.prototype.mod,p.prototype.pow=function(t){var e,r,o,n=K(t),i=this.value,p=n.value;if(0===p)return u[1];if(0===i)return u[0];if(1===i)return u[1];if(-1===i)return n.isEven()?u[1]:u[-1];if(n.sign)return u[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&l(e=Math.pow(i,p)))return new a(g(e));for(r=this,o=u[1];!0&p&&(o=o.times(r),--p),0!==p;)p/=2,r=r.square();return o},a.prototype.pow=p.prototype.pow,s.prototype.pow=function(t){var e=K(t),r=this.value,o=e.value,n=BigInt(0),i=BigInt(1),p=BigInt(2);if(o===n)return u[1];if(r===n)return u[0];if(r===i)return u[1];if(r===BigInt(-1))return e.isEven()?u[1]:u[-1];if(e.isNegative())return new s(n);for(var a=this,l=u[1];(o&i)===i&&(l=l.times(a),--o),o!==n;)o/=p,a=a.square();return l},p.prototype.modPow=function(t,e){if(t=K(t),(e=K(e)).isZero())throw new Error("Cannot take modPow with modulus 0");var r=u[1],o=this.mod(e);for(t.isNegative()&&(t=t.multiply(u[-1]),o=o.modInv(e));t.isPositive();){if(o.isZero())return u[0];t.isOdd()&&(r=r.multiply(o).mod(e)),t=t.divide(2),o=o.square().mod(e)}return r},s.prototype.modPow=a.prototype.modPow=p.prototype.modPow,p.prototype.compareAbs=function(t){var e=K(t),r=this.value,o=e.value;return e.isSmall?1:A(r,o)},a.prototype.compareAbs=function(t){var e=K(t),r=Math.abs(this.value),o=e.value;return e.isSmall?r===(o=Math.abs(o))?0:r>o?1:-1:-1},s.prototype.compareAbs=function(t){var e=this.value,r=K(t).value;return(e=e>=0?e:-e)===(r=r>=0?r:-r)?0:e>r?1:-1},p.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,o=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:A(r,o)*(this.sign?-1:1)},p.prototype.compareTo=p.prototype.compare,a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,o=e.value;return e.isSmall?r==o?0:r>o?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=this.value,r=K(t).value;return e===r?0:e>r?1:-1},s.prototype.compareTo=s.prototype.compare,p.prototype.equals=function(t){return 0===this.compare(t)},s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals=p.prototype.eq=p.prototype.equals,p.prototype.notEquals=function(t){return 0!==this.compare(t)},s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals=p.prototype.neq=p.prototype.notEquals,p.prototype.greater=function(t){return this.compare(t)>0},s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater=p.prototype.gt=p.prototype.greater,p.prototype.lesser=function(t){return this.compare(t)<0},s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser=p.prototype.lt=p.prototype.lesser,p.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals=p.prototype.geq=p.prototype.greaterOrEquals,p.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals=p.prototype.leq=p.prototype.lesserOrEquals,p.prototype.isEven=function(){return 0==(1&this.value[0])},a.prototype.isEven=function(){return 0==(1&this.value)},s.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},p.prototype.isOdd=function(){return 1==(1&this.value[0])},a.prototype.isOdd=function(){return 1==(1&this.value)},s.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},p.prototype.isPositive=function(){return!this.sign},a.prototype.isPositive=function(){return this.value>0},s.prototype.isPositive=a.prototype.isPositive,p.prototype.isNegative=function(){return this.sign},a.prototype.isNegative=function(){return this.value<0},s.prototype.isNegative=a.prototype.isNegative,p.prototype.isUnit=function(){return!1},a.prototype.isUnit=function(){return 1===Math.abs(this.value)},s.prototype.isUnit=function(){return this.abs().value===BigInt(1)},p.prototype.isZero=function(){return!1},a.prototype.isZero=function(){return 0===this.value},s.prototype.isZero=function(){return this.value===BigInt(0)},p.prototype.isDivisibleBy=function(t){var e=K(t);return!e.isZero()&&(!!e.isUnit()||(0===e.compareAbs(2)?this.isEven():this.mod(e).isZero()))},s.prototype.isDivisibleBy=a.prototype.isDivisibleBy=p.prototype.isDivisibleBy,p.prototype.isPrime=function(e){var r=P(this);if(r!==t)return r;var o=this.abs(),n=o.bitLength();if(n<=64)return Z(o,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var i=Math.log(2)*n.toJSNumber(),u=Math.ceil(!0===e?2*Math.pow(i,2):i),p=[],a=0;a-r?new a(t-1):new p(o,!0)},s.prototype.prev=function(){return new s(this.value-BigInt(1))};for(var x=[1];2*x[x.length-1]<=e;)x.push(2*x[x.length-1]);var J=x.length,L=x[J-1];function U(t){return Math.abs(t)<=e}function T(t,e,r){e=K(e);for(var o=t.isNegative(),n=e.isNegative(),i=o?t.not():t,u=n?e.not():e,p=0,a=0,s=null,l=null,f=[];!i.isZero()||!u.isZero();)p=(s=B(i,L))[1].toJSNumber(),o&&(p=L-1-p),a=(l=B(u,L))[1].toJSNumber(),n&&(a=L-1-a),i=s[0],u=l[0],f.push(r(p,a));for(var v=0!==r(o?1:0,n?1:0)?bigInt(-1):bigInt(0),h=f.length-1;h>=0;h-=1)v=v.multiply(L).add(bigInt(f[h]));return v}p.prototype.shiftLeft=function(t){var e=K(t).toJSNumber();if(!U(e))throw new Error(String(e)+" is too large for shifting.");if(e<0)return this.shiftRight(-e);var r=this;if(r.isZero())return r;for(;e>=J;)r=r.multiply(L),e-=J-1;return r.multiply(x[e])},s.prototype.shiftLeft=a.prototype.shiftLeft=p.prototype.shiftLeft,p.prototype.shiftRight=function(t){var e,r=K(t).toJSNumber();if(!U(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var o=this;r>=J;){if(o.isZero()||o.isNegative()&&o.isUnit())return o;o=(e=B(o,L))[1].isNegative()?e[0].prev():e[0],r-=J-1}return(e=B(o,x[r]))[1].isNegative()?e[0].prev():e[0]},s.prototype.shiftRight=a.prototype.shiftRight=p.prototype.shiftRight,p.prototype.not=function(){return this.negate().prev()},s.prototype.not=a.prototype.not=p.prototype.not,p.prototype.and=function(t){return T(this,t,(function(t,e){return t&e}))},s.prototype.and=a.prototype.and=p.prototype.and,p.prototype.or=function(t){return T(this,t,(function(t,e){return t|e}))},s.prototype.or=a.prototype.or=p.prototype.or,p.prototype.xor=function(t){return T(this,t,(function(t,e){return t^e}))},s.prototype.xor=a.prototype.xor=p.prototype.xor;var j=1<<30;function C(t){var r=t.value,o="number"==typeof r?r|j:"bigint"==typeof r?r|BigInt(j):r[0]+r[1]*e|1073758208;return o&-o}function D(t,e){if(e.compareTo(t)<=0){var r=D(t,e.square(e)),o=r.p,n=r.e,i=o.multiply(e);return i.compareTo(t)<=0?{p:i,e:2*n+1}:{p:o,e:2*n}}return{p:bigInt(1),e:0}}function z(t,e){return t=K(t),e=K(e),t.greater(e)?t:e}function R(t,e){return t=K(t),e=K(e),t.lesser(e)?t:e}function k(t,e){if(t=K(t).abs(),e=K(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,o,n=u[1];t.isEven()&&e.isEven();)r=R(C(t),C(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(C(t));do{for(;e.isEven();)e=e.divide(C(e));t.greater(e)&&(o=e,e=t,t=o),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}p.prototype.bitLength=function(){var t=this;return t.compareTo(bigInt(0))<0&&(t=t.negate().subtract(bigInt(1))),0===t.compareTo(bigInt(0))?bigInt(0):bigInt(D(t,bigInt(2)).e).add(bigInt(1))},s.prototype.bitLength=a.prototype.bitLength=p.prototype.bitLength;var _=function(t,e,r,o){r=r||n,t=String(t),o||(t=t.toLowerCase(),r=r.toLowerCase());var i,u=t.length,p=Math.abs(e),a={};for(i=0;i=p)){if("1"===f&&1===p)continue;throw new Error(f+" is not a valid digit in base "+e+".")}}e=K(e);var s=[],l="-"===t[0];for(i=l?1:0;i"!==t[i]&&i=0;o--)n=n.add(t[o].times(i)),i=i.times(e);return r?n.negate():n}function F(t,e){if((e=bigInt(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(t.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var o=!1;if(t.isNegative()&&e.isPositive()&&(o=!0,t=t.abs()),e.isUnit())return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(t.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:o};for(var n,i=[],u=t;u.isNegative()||u.compareAbs(e)>=0;){n=u.divmod(e),u=n.quotient;var p=n.remainder;p.isNegative()&&(p=e.minus(p).abs(),u=u.next()),i.push(p.toJSNumber())}return i.push(u.toJSNumber()),{value:i.reverse(),isNegative:o}}function G(t,e,r){var o=F(t,e);return(o.isNegative?"-":"")+o.value.map((function(t){return function(t,e){return t<(e=e||n).length?e[t]:"<"+t+">"}(t,r)})).join("")}function H(t){if(l(+t)){var e=+t;if(e===g(e))return i?new s(BigInt(e)):new a(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var o=t.split(/e/i);if(o.length>2)throw new Error("Invalid integer: "+o.join("e"));if(2===o.length){var n=o[1];if("+"===n[0]&&(n=n.slice(1)),(n=+n)!==g(n)||!l(n))throw new Error("Invalid integer: "+n+" is not a valid exponent.");var u=o[0],f=u.indexOf(".");if(f>=0&&(n-=u.length-f-1,u=u.slice(0,f)+u.slice(f+1)),n<0)throw new Error("Cannot include negative exponent part for integers");t=u+=new Array(n+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);if(i)return new s(BigInt(r?"-"+t:t));for(var v=[],y=t.length,c=y-7;y>0;)v.push(+t.slice(c,y)),(c-=7)<0&&(c=0),y-=7;return h(v),new p(v,r)}function K(t){return"number"==typeof t?function(t){if(i)return new s(BigInt(t));if(l(t)){if(t!==g(t))throw new Error(t+" is not an integer.");return new a(t)}return H(t.toString())}(t):"string"==typeof t?H(t):"bigint"==typeof t?new s(t):t}p.prototype.toArray=function(t){return F(this,t)},a.prototype.toArray=function(t){return F(this,t)},s.prototype.toArray=function(t){return F(this,t)},p.prototype.toString=function(e,r){if(e===t&&(e=10),10!==e)return G(this,e,r);for(var o,n=this.value,i=n.length,u=String(n[--i]);--i>=0;)o=String(n[i]),u+="0000000".slice(o.length)+o;return(this.sign?"-":"")+u},a.prototype.toString=function(e,r){return e===t&&(e=10),10!=e?G(this,e,r):String(this.value)},s.prototype.toString=a.prototype.toString,s.prototype.toJSON=p.prototype.toJSON=a.prototype.toJSON=function(){return this.toString()},p.prototype.valueOf=function(){return parseInt(this.toString(),10)},p.prototype.toJSNumber=p.prototype.valueOf,a.prototype.valueOf=function(){return this.value},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=s.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var Q=0;Q<1e3;Q++)u[Q]=K(Q),Q>0&&(u[-Q]=K(-Q));return u.one=u[1],u.zero=u[0],u.minusOne=u[-1],u.max=z,u.min=R,u.gcd=k,u.lcm=function(t,e){return t=K(t).abs(),e=K(e).abs(),t.divide(k(t,e)).multiply(e)},u.isInstance=function(t){return t instanceof p||t instanceof a||t instanceof s},u.randBetween=function(t,r,o){t=K(t),r=K(r);var n=o||Math.random,i=R(t,r),p=z(t,r).subtract(i).add(1);if(p.isSmall)return i.add(Math.floor(n()*p));for(var a=F(p,e).value,s=[],l=!0,f=0;f
diff --git a/node_modules/big-integer/README.md b/node_modules/big-integer/README.md
new file mode 100644
index 0000000..d72420f
--- /dev/null
+++ b/node_modules/big-integer/README.md
@@ -0,0 +1,589 @@
+# BigInteger.js [![Build Status][travis-img]][travis-url] [![Coverage Status][coveralls-img]][coveralls-url] [![Monthly Downloads][downloads-img]][downloads-url]
+
+[travis-url]: https://travis-ci.org/peterolson/BigInteger.js
+[travis-img]: https://travis-ci.org/peterolson/BigInteger.js.svg?branch=master
+[coveralls-url]: https://coveralls.io/github/peterolson/BigInteger.js?branch=master
+[coveralls-img]: https://coveralls.io/repos/peterolson/BigInteger.js/badge.svg?branch=master&service=github
+[downloads-url]: https://www.npmjs.com/package/big-integer
+[downloads-img]: https://img.shields.io/npm/dm/big-integer.svg
+
+**BigInteger.js** is an arbitrary-length integer library for Javascript, allowing arithmetic operations on integers of unlimited size, notwithstanding memory and time limitations.
+
+**Update (December 2, 2018):** [`BigInt` is being added as a native feature of JavaScript](https://tc39.github.io/proposal-bigint/). This library now works as a polyfill: if the environment supports the native `BigInt`, this library acts as a thin wrapper over the native implementation.
+
+## Installation
+
+If you are using a browser, you can download [BigInteger.js from GitHub](http://peterolson.github.com/BigInteger.js/BigInteger.min.js) or just hotlink to it:
+
+
+
+If you are using node, you can install BigInteger with [npm](https://npmjs.org/).
+
+ npm install big-integer
+
+Then you can include it in your code:
+
+ var bigInt = require("big-integer");
+
+
+## Usage
+### `bigInt(number, [base], [alphabet], [caseSensitive])`
+
+You can create a bigInt by calling the `bigInt` function. You can pass in
+
+ - a string, which it will parse as an bigInt and throw an `"Invalid integer"` error if the parsing fails.
+ - a Javascript number, which it will parse as an bigInt and throw an `"Invalid integer"` error if the parsing fails.
+ - another bigInt.
+ - nothing, and it will return `bigInt.zero`.
+
+ If you provide a second parameter, then it will parse `number` as a number in base `base`. Note that `base` can be any bigInt (even negative or zero). The letters "a-z" and "A-Z" will be interpreted as the numbers 10 to 35. Higher digits can be specified in angle brackets (`<` and `>`). The default `base` is `10`.
+
+ You can specify a custom alphabet for base conversion with the third parameter. The default `alphabet` is `"0123456789abcdefghijklmnopqrstuvwxyz"`.
+
+ The fourth parameter specifies whether or not the number string should be case-sensitive, i.e. whether `a` and `A` should be treated as different digits. By default `caseSensitive` is `false`.
+
+Examples:
+
+ var zero = bigInt();
+ var ninetyThree = bigInt(93);
+ var largeNumber = bigInt("75643564363473453456342378564387956906736546456235345");
+ var googol = bigInt("1e100");
+ var bigNumber = bigInt(largeNumber);
+
+ var maximumByte = bigInt("FF", 16);
+ var fiftyFiveGoogol = bigInt("<55>0", googol);
+
+Note that Javascript numbers larger than `9007199254740992` and smaller than `-9007199254740992` are not precisely represented numbers and will not produce exact results. If you are dealing with numbers outside that range, it is better to pass in strings.
+
+### Method Chaining
+
+Note that bigInt operations return bigInts, which allows you to chain methods, for example:
+
+ var salary = bigInt(dollarsPerHour).times(hoursWorked).plus(randomBonuses)
+
+### Constants
+
+There are three named constants already stored that you do not have to construct with the `bigInt` function yourself:
+
+ - `bigInt.one`, equivalent to `bigInt(1)`
+ - `bigInt.zero`, equivalent to `bigInt(0)`
+ - `bigInt.minusOne`, equivalent to `bigInt(-1)`
+
+The numbers from -999 to 999 are also already prestored and can be accessed using `bigInt[index]`, for example:
+
+ - `bigInt[-999]`, equivalent to `bigInt(-999)`
+ - `bigInt[256]`, equivalent to `bigInt(256)`
+
+### Methods
+
+#### `abs()`
+
+Returns the absolute value of a bigInt.
+
+ - `bigInt(-45).abs()` => `45`
+ - `bigInt(45).abs()` => `45`
+
+#### `add(number)`
+
+Performs addition.
+
+ - `bigInt(5).add(7)` => `12`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Addition)
+
+#### `and(number)`
+
+Performs the bitwise AND operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
+
+ - `bigInt(6).and(3)` => `2`
+ - `bigInt(6).and(-3)` => `4`
+
+#### `bitLength()`
+
+Returns the number of digits required to represent a bigInt in binary.
+
+ - `bigInt(5)` => `3` (since 5 is `101` in binary, which is three digits long)
+
+#### `compare(number)`
+
+Performs a comparison between two numbers. If the numbers are equal, it returns `0`. If the first number is greater, it returns `1`. If the first number is lesser, it returns `-1`.
+
+ - `bigInt(5).compare(5)` => `0`
+ - `bigInt(5).compare(4)` => `1`
+ - `bigInt(4).compare(5)` => `-1`
+
+#### `compareAbs(number)`
+
+Performs a comparison between the absolute value of two numbers.
+
+ - `bigInt(5).compareAbs(-5)` => `0`
+ - `bigInt(5).compareAbs(4)` => `1`
+ - `bigInt(4).compareAbs(-5)` => `-1`
+
+#### `compareTo(number)`
+
+Alias for the `compare` method.
+
+#### `divide(number)`
+
+Performs integer division, disregarding the remainder.
+
+ - `bigInt(59).divide(5)` => `11`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
+
+#### `divmod(number)`
+
+Performs division and returns an object with two properties: `quotient` and `remainder`. The sign of the remainder will match the sign of the dividend.
+
+ - `bigInt(59).divmod(5)` => `{quotient: bigInt(11), remainder: bigInt(4) }`
+ - `bigInt(-5).divmod(2)` => `{quotient: bigInt(-2), remainder: bigInt(-1) }`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
+
+#### `eq(number)`
+
+Alias for the `equals` method.
+
+#### `equals(number)`
+
+Checks if two numbers are equal.
+
+ - `bigInt(5).equals(5)` => `true`
+ - `bigInt(4).equals(7)` => `false`
+
+#### `geq(number)`
+
+Alias for the `greaterOrEquals` method.
+
+
+#### `greater(number)`
+
+Checks if the first number is greater than the second.
+
+ - `bigInt(5).greater(6)` => `false`
+ - `bigInt(5).greater(5)` => `false`
+ - `bigInt(5).greater(4)` => `true`
+
+#### `greaterOrEquals(number)`
+
+Checks if the first number is greater than or equal to the second.
+
+ - `bigInt(5).greaterOrEquals(6)` => `false`
+ - `bigInt(5).greaterOrEquals(5)` => `true`
+ - `bigInt(5).greaterOrEquals(4)` => `true`
+
+#### `gt(number)`
+
+Alias for the `greater` method.
+
+#### `isDivisibleBy(number)`
+
+Returns `true` if the first number is divisible by the second number, `false` otherwise.
+
+ - `bigInt(999).isDivisibleBy(333)` => `true`
+ - `bigInt(99).isDivisibleBy(5)` => `false`
+
+#### `isEven()`
+
+Returns `true` if the number is even, `false` otherwise.
+
+ - `bigInt(6).isEven()` => `true`
+ - `bigInt(3).isEven()` => `false`
+
+#### `isNegative()`
+
+Returns `true` if the number is negative, `false` otherwise.
+Returns `false` for `0` and `-0`.
+
+ - `bigInt(-23).isNegative()` => `true`
+ - `bigInt(50).isNegative()` => `false`
+
+#### `isOdd()`
+
+Returns `true` if the number is odd, `false` otherwise.
+
+ - `bigInt(13).isOdd()` => `true`
+ - `bigInt(40).isOdd()` => `false`
+
+#### `isPositive()`
+
+Return `true` if the number is positive, `false` otherwise.
+Returns `false` for `0` and `-0`.
+
+ - `bigInt(54).isPositive()` => `true`
+ - `bigInt(-1).isPositive()` => `false`
+
+#### `isPrime(strict?)`
+
+Returns `true` if the number is prime, `false` otherwise.
+Set "strict" boolean to true to force GRH-supported lower bound of 2*log(N)^2.
+
+ - `bigInt(5).isPrime()` => `true`
+ - `bigInt(6).isPrime()` => `false`
+
+#### `isProbablePrime([iterations], [rng])`
+
+Returns `true` if the number is very likely to be prime, `false` otherwise.
+Supplying `iterations` is optional - it determines the number of iterations of the test (default: `5`). The more iterations, the lower chance of getting a false positive.
+This uses the [Miller Rabin test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test).
+
+ - `bigInt(5).isProbablePrime()` => `true`
+ - `bigInt(49).isProbablePrime()` => `false`
+ - `bigInt(1729).isProbablePrime()` => `false`
+
+Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same - unless you pass a predictable random number generator as `rng`. The behavior and requirements are the same as with `randBetween`.
+
+ - `bigInt(1729).isProbablePrime(1, () => 0.1)` => `false`
+ - `bigInt(1729).isProbablePrime(1, () => 0.2)` => `true`
+
+If the number is composite then the Miller–Rabin primality test declares the number probably prime with a probability at most `4` to the power `−iterations`.
+If the number is prime, this function always returns `true`.
+
+#### `isUnit()`
+
+Returns `true` if the number is `1` or `-1`, `false` otherwise.
+
+ - `bigInt.one.isUnit()` => `true`
+ - `bigInt.minusOne.isUnit()` => `true`
+ - `bigInt(5).isUnit()` => `false`
+
+#### `isZero()`
+
+Return `true` if the number is `0` or `-0`, `false` otherwise.
+
+ - `bigInt.zero.isZero()` => `true`
+ - `bigInt("-0").isZero()` => `true`
+ - `bigInt(50).isZero()` => `false`
+
+#### `leq(number)`
+
+Alias for the `lesserOrEquals` method.
+
+#### `lesser(number)`
+
+Checks if the first number is lesser than the second.
+
+ - `bigInt(5).lesser(6)` => `true`
+ - `bigInt(5).lesser(5)` => `false`
+ - `bigInt(5).lesser(4)` => `false`
+
+#### `lesserOrEquals(number)`
+
+Checks if the first number is less than or equal to the second.
+
+ - `bigInt(5).lesserOrEquals(6)` => `true`
+ - `bigInt(5).lesserOrEquals(5)` => `true`
+ - `bigInt(5).lesserOrEquals(4)` => `false`
+
+#### `lt(number)`
+
+Alias for the `lesser` method.
+
+#### `minus(number)`
+
+Alias for the `subtract` method.
+
+ - `bigInt(3).minus(5)` => `-2`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Subtraction)
+
+#### `mod(number)`
+
+Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend.
+
+ - `bigInt(59).mod(5)` => `4`
+ - `bigInt(-5).mod(2)` => `-1`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
+
+#### `modInv(mod)`
+
+Finds the [multiplicative inverse](https://en.wikipedia.org/wiki/Modular_multiplicative_inverse) of the number modulo `mod`.
+
+ - `bigInt(3).modInv(11)` => `4`
+ - `bigInt(42).modInv(2017)` => `1969`
+
+#### `modPow(exp, mod)`
+
+Takes the number to the power `exp` modulo `mod`.
+
+ - `bigInt(10).modPow(3, 30)` => `10`
+
+#### `multiply(number)`
+
+Performs multiplication.
+
+ - `bigInt(111).multiply(111)` => `12321`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Multiplication)
+
+#### `neq(number)`
+
+Alias for the `notEquals` method.
+
+#### `next()`
+
+Adds one to the number.
+
+ - `bigInt(6).next()` => `7`
+
+#### `not()`
+
+Performs the bitwise NOT operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
+
+ - `bigInt(10).not()` => `-11`
+ - `bigInt(0).not()` => `-1`
+
+#### `notEquals(number)`
+
+Checks if two numbers are not equal.
+
+ - `bigInt(5).notEquals(5)` => `false`
+ - `bigInt(4).notEquals(7)` => `true`
+
+#### `or(number)`
+
+Performs the bitwise OR operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
+
+ - `bigInt(13).or(10)` => `15`
+ - `bigInt(13).or(-8)` => `-3`
+
+#### `over(number)`
+
+Alias for the `divide` method.
+
+ - `bigInt(59).over(5)` => `11`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
+
+#### `plus(number)`
+
+Alias for the `add` method.
+
+ - `bigInt(5).plus(7)` => `12`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Addition)
+
+#### `pow(number)`
+
+Performs exponentiation. If the exponent is less than `0`, `pow` returns `0`. `bigInt.zero.pow(0)` returns `1`.
+
+ - `bigInt(16).pow(16)` => `18446744073709551616`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Exponentiation)
+
+#### `prev(number)`
+
+Subtracts one from the number.
+
+ - `bigInt(6).prev()` => `5`
+
+#### `remainder(number)`
+
+Alias for the `mod` method.
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
+
+#### `shiftLeft(n)`
+
+Shifts the number left by `n` places in its binary representation. If a negative number is provided, it will shift right. Throws an error if `n` is outside of the range `[-9007199254740992, 9007199254740992]`.
+
+ - `bigInt(8).shiftLeft(2)` => `32`
+ - `bigInt(8).shiftLeft(-2)` => `2`
+
+#### `shiftRight(n)`
+
+Shifts the number right by `n` places in its binary representation. If a negative number is provided, it will shift left. Throws an error if `n` is outside of the range `[-9007199254740992, 9007199254740992]`.
+
+ - `bigInt(8).shiftRight(2)` => `2`
+ - `bigInt(8).shiftRight(-2)` => `32`
+
+#### `square()`
+
+Squares the number
+
+ - `bigInt(3).square()` => `9`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Squaring)
+
+#### `subtract(number)`
+
+Performs subtraction.
+
+ - `bigInt(3).subtract(5)` => `-2`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Subtraction)
+
+#### `times(number)`
+
+Alias for the `multiply` method.
+
+ - `bigInt(111).times(111)` => `12321`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Multiplication)
+
+#### `toArray(radix)`
+
+Converts a bigInt into an object with the properties "value" and "isNegative." "Value" is an array of integers modulo the given radix. "isNegative" is a boolean that represents the sign of the result.
+
+ - `bigInt("1e9").toArray(10)` => {
+ value: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ isNegative: false
+ }
+ - `bigInt("1e9").toArray(16)` => {
+ value: [3, 11, 9, 10, 12, 10, 0, 0],
+ isNegative: false
+ }
+ - `bigInt(567890).toArray(100)` => {
+ value: [56, 78, 90],
+ isNegative: false
+ }
+
+Negative bases are supported.
+
+ - `bigInt(12345).toArray(-10)` => {
+ value: [2, 8, 4, 6, 5],
+ isNegative: false
+ }
+
+Base 1 and base -1 are also supported.
+
+ - `bigInt(-15).toArray(1)` => {
+ value: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ isNegative: true
+ }
+ - `bigInt(-15).toArray(-1)` => {
+ value: [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],
+ isNegative: false
+ }
+
+Base 0 is only allowed for the number zero.
+
+ - `bigInt(0).toArray(0)` => {
+ value: [0],
+ isNegative: false
+ }
+ - `bigInt(1).toArray(0)` => `Error: Cannot convert nonzero numbers to base 0.`
+
+#### `toJSNumber()`
+
+Converts a bigInt into a native Javascript number. Loses precision for numbers outside the range `[-9007199254740992, 9007199254740992]`.
+
+ - `bigInt("18446744073709551616").toJSNumber()` => `18446744073709552000`
+
+#### `xor(number)`
+
+Performs the bitwise XOR operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
+
+ - `bigInt(12).xor(5)` => `9`
+ - `bigInt(12).xor(-5)` => `-9`
+
+### Static Methods
+
+#### `fromArray(digits, base = 10, isNegative?)`
+
+Constructs a bigInt from an array of digits in base `base`. The optional `isNegative` flag will make the number negative.
+
+ - `bigInt.fromArray([1, 2, 3, 4, 5], 10)` => `12345`
+ - `bigInt.fromArray([1, 0, 0], 2, true)` => `-4`
+
+#### `gcd(a, b)`
+
+Finds the greatest common denominator of `a` and `b`.
+
+ - `bigInt.gcd(42,56)` => `14`
+
+#### `isInstance(x)`
+
+Returns `true` if `x` is a BigInteger, `false` otherwise.
+
+ - `bigInt.isInstance(bigInt(14))` => `true`
+ - `bigInt.isInstance(14)` => `false`
+
+#### `lcm(a,b)`
+
+Finds the least common multiple of `a` and `b`.
+
+ - `bigInt.lcm(21, 6)` => `42`
+
+#### `max(a,b)`
+
+Returns the largest of `a` and `b`.
+
+ - `bigInt.max(77, 432)` => `432`
+
+#### `min(a,b)`
+
+Returns the smallest of `a` and `b`.
+
+ - `bigInt.min(77, 432)` => `77`
+
+#### `randBetween(min, max, [rng])`
+
+Returns a random number between `min` and `max`, optionally using `rng` to generate randomness.
+
+ - `bigInt.randBetween("-1e100", "1e100")` => (for example) `8494907165436643479673097939554427056789510374838494147955756275846226209006506706784609314471378745`
+
+`rng` should take no arguments and return a `number` between 0 and 1. It defaults to `Math.random`.
+
+ - `bigInt.randBetween("-1e100", "1e100", () => 0.5)` => (always) `50000005000000500000050000005000000500000050000005000000500000050000005000000500000050000005000000`
+
+
+### Override Methods
+
+#### `toString(radix = 10, [alphabet])`
+
+Converts a bigInt to a string. There is an optional radix parameter (which defaults to 10) that converts the number to the given radix. Digits in the range `10-35` will use the letters `a-z`.
+
+ - `bigInt("1e9").toString()` => `"1000000000"`
+ - `bigInt("1e9").toString(16)` => `"3b9aca00"`
+
+ You can use a custom base alphabet with the second parameter. The default `alphabet` is `"0123456789abcdefghijklmnopqrstuvwxyz"`.
+
+ - `bigInt("5").toString(2, "aA")` => `"AaA"`
+
+**Note that arithmetical operators will trigger the `valueOf` function rather than the `toString` function.** When converting a bigInteger to a string, you should use the `toString` method or the `String` function instead of adding the empty string.
+
+ - `bigInt("999999999999999999").toString()` => `"999999999999999999"`
+ - `String(bigInt("999999999999999999"))` => `"999999999999999999"`
+ - `bigInt("999999999999999999") + ""` => `1000000000000000000`
+
+Bases larger than 36 are supported. If a digit is greater than or equal to 36, it will be enclosed in angle brackets.
+
+ - `bigInt(567890).toString(100)` => `"<56><78><90>"`
+
+Negative bases are also supported.
+
+ - `bigInt(12345).toString(-10)` => `"28465"`
+
+Base 1 and base -1 are also supported.
+
+ - `bigInt(-15).toString(1)` => `"-111111111111111"`
+ - `bigInt(-15).toString(-1)` => `"101010101010101010101010101010"`
+
+Base 0 is only allowed for the number zero.
+
+ - `bigInt(0).toString(0)` => `0`
+ - `bigInt(1).toString(0)` => `Error: Cannot convert nonzero numbers to base 0.`
+
+[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#toString)
+
+#### `valueOf()`
+
+Converts a bigInt to a native Javascript number. This override allows you to use native arithmetic operators without explicit conversion:
+
+ - `bigInt("100") + bigInt("200") === 300; //true`
+
+## Contributors
+
+To contribute, just fork the project, make some changes, and submit a pull request. Please verify that the unit tests pass before submitting.
+
+The unit tests are contained in the `spec/spec.js` file. You can run them locally by opening the `spec/SpecRunner.html` or file or running `npm test`. You can also [run the tests online from GitHub](http://peterolson.github.io/BigInteger.js/spec/SpecRunner.html).
+
+There are performance benchmarks that can be viewed from the `benchmarks/index.html` page. You can [run them online from GitHub](http://peterolson.github.io/BigInteger.js/benchmark/).
+
+## License
+
+This project is public domain. For more details, read about the [Unlicense](http://unlicense.org/).
diff --git a/node_modules/big-integer/bower.json b/node_modules/big-integer/bower.json
new file mode 100644
index 0000000..22dc58f
--- /dev/null
+++ b/node_modules/big-integer/bower.json
@@ -0,0 +1,29 @@
+{
+ "name": "big-integer",
+ "description": "An arbitrary length integer library for Javascript",
+ "main": "./BigInteger.js",
+ "authors": [
+ "Peter Olson"
+ ],
+ "license": "Unlicense",
+ "keywords": [
+ "math",
+ "big",
+ "bignum",
+ "bigint",
+ "biginteger",
+ "integer",
+ "arbitrary",
+ "precision",
+ "arithmetic"
+ ],
+ "homepage": "https://github.com/peterolson/BigInteger.js",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "coverage",
+ "tests"
+ ]
+}
diff --git a/node_modules/big-integer/package.json b/node_modules/big-integer/package.json
new file mode 100644
index 0000000..a6eb201
--- /dev/null
+++ b/node_modules/big-integer/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "big-integer",
+ "version": "1.6.51",
+ "author": "Peter Olson ",
+ "description": "An arbitrary length integer library for Javascript",
+ "contributors": [],
+ "bin": {},
+ "scripts": {
+ "test": "tsc && karma start my.conf.js && node spec/tsDefinitions.js",
+ "minify": "uglifyjs BigInteger.js -o BigInteger.min.js"
+ },
+ "main": "./BigInteger",
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:peterolson/BigInteger.js.git"
+ },
+ "keywords": [
+ "math",
+ "big",
+ "bignum",
+ "bigint",
+ "biginteger",
+ "integer",
+ "arbitrary",
+ "precision",
+ "arithmetic"
+ ],
+ "devDependencies": {
+ "@types/lodash": "^4.14.175",
+ "@types/node": "^7.10.2",
+ "coveralls": "^3.0.6",
+ "jasmine": "3.5.0",
+ "jasmine-core": "^3.5.0",
+ "karma": "^6.3.4",
+ "karma-cli": "^2.0.0",
+ "karma-coverage": "^2.0.3",
+ "karma-jasmine": "^4.0.1",
+ "karma-phantomjs-launcher": "^1.0.4",
+ "lodash": "^4.17.21",
+ "typescript": "^3.6.3",
+ "uglifyjs": "^2.4.10"
+ },
+ "license": "Unlicense",
+ "engines": {
+ "node": ">=0.6"
+ },
+ "typings": "./BigInteger.d.ts"
+}
diff --git a/node_modules/big-integer/tsconfig.json b/node_modules/big-integer/tsconfig.json
new file mode 100644
index 0000000..dae01d4
--- /dev/null
+++ b/node_modules/big-integer/tsconfig.json
@@ -0,0 +1,26 @@
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": false,
+ "baseUrl": "./",
+ "moduleResolution": "node",
+ "allowJs": true,
+ "typeRoots": [
+ "./"
+ ],
+ "types": [
+ "node"
+ ],
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "BigInteger.d.ts",
+ "spec/tsDefinitions.ts"
+ ]
+}
diff --git a/node_modules/bplist-parser/README.md b/node_modules/bplist-parser/README.md
new file mode 100644
index 0000000..eb54064
--- /dev/null
+++ b/node_modules/bplist-parser/README.md
@@ -0,0 +1,48 @@
+# bplist-parser
+
+Binary Mac OS X Plist (property list) parser.
+
+## Installation
+
+```bash
+$ npm install bplist-parser
+```
+
+## Quick Examples
+
+```javascript
+const bplist = require('bplist-parser');
+
+(async () => {
+
+ const obj = await bplist.parseFile('myPlist.bplist');
+
+ console.log(JSON.stringify(obj));
+
+})();
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 Near Infinity Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/bplist-parser/bplistParser.js b/node_modules/bplist-parser/bplistParser.js
new file mode 100644
index 0000000..410afde
--- /dev/null
+++ b/node_modules/bplist-parser/bplistParser.js
@@ -0,0 +1,363 @@
+'use strict';
+
+// adapted from http://code.google.com/p/plist/source/browse/trunk/src/com/dd/plist/BinaryPropertyListParser.java
+
+const fs = require('fs');
+const bigInt = require("big-integer");
+const debug = false;
+
+exports.maxObjectSize = 100 * 1000 * 1000; // 100Meg
+exports.maxObjectCount = 32768;
+
+// EPOCH = new SimpleDateFormat("yyyy MM dd zzz").parse("2001 01 01 GMT").getTime();
+// ...but that's annoying in a static initializer because it can throw exceptions, ick.
+// So we just hardcode the correct value.
+const EPOCH = 978307200000;
+
+// UID object definition
+const UID = exports.UID = function(id) {
+ this.UID = id;
+};
+
+const parseFile = exports.parseFile = function (fileNameOrBuffer, callback) {
+ return new Promise(function (resolve, reject) {
+ function tryParseBuffer(buffer) {
+ let err = null;
+ let result;
+ try {
+ result = parseBuffer(buffer);
+ resolve(result);
+ } catch (ex) {
+ err = ex;
+ reject(err);
+ } finally {
+ if (callback) callback(err, result);
+ }
+ }
+
+ if (Buffer.isBuffer(fileNameOrBuffer)) {
+ return tryParseBuffer(fileNameOrBuffer);
+ }
+ fs.readFile(fileNameOrBuffer, function (err, data) {
+ if (err) {
+ reject(err);
+ return callback(err);
+ }
+ tryParseBuffer(data);
+ });
+ });
+};
+
+const parseBuffer = exports.parseBuffer = function (buffer) {
+ // check header
+ const header = buffer.slice(0, 'bplist'.length).toString('utf8');
+ if (header !== 'bplist') {
+ throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
+ }
+
+ // Handle trailer, last 32 bytes of the file
+ const trailer = buffer.slice(buffer.length - 32, buffer.length);
+ // 6 null bytes (index 0 to 5)
+ const offsetSize = trailer.readUInt8(6);
+ if (debug) {
+ console.log("offsetSize: " + offsetSize);
+ }
+ const objectRefSize = trailer.readUInt8(7);
+ if (debug) {
+ console.log("objectRefSize: " + objectRefSize);
+ }
+ const numObjects = readUInt64BE(trailer, 8);
+ if (debug) {
+ console.log("numObjects: " + numObjects);
+ }
+ const topObject = readUInt64BE(trailer, 16);
+ if (debug) {
+ console.log("topObject: " + topObject);
+ }
+ const offsetTableOffset = readUInt64BE(trailer, 24);
+ if (debug) {
+ console.log("offsetTableOffset: " + offsetTableOffset);
+ }
+
+ if (numObjects > exports.maxObjectCount) {
+ throw new Error("maxObjectCount exceeded");
+ }
+
+ // Handle offset table
+ const offsetTable = [];
+
+ for (let i = 0; i < numObjects; i++) {
+ const offsetBytes = buffer.slice(offsetTableOffset + i * offsetSize, offsetTableOffset + (i + 1) * offsetSize);
+ offsetTable[i] = readUInt(offsetBytes, 0);
+ if (debug) {
+ console.log("Offset for Object #" + i + " is " + offsetTable[i] + " [" + offsetTable[i].toString(16) + "]");
+ }
+ }
+
+ // Parses an object inside the currently parsed binary property list.
+ // For the format specification check
+ //
+ // Apple's binary property list parser implementation .
+ function parseObject(tableOffset) {
+ const offset = offsetTable[tableOffset];
+ const type = buffer[offset];
+ const objType = (type & 0xF0) >> 4; //First 4 bits
+ const objInfo = (type & 0x0F); //Second 4 bits
+ switch (objType) {
+ case 0x0:
+ return parseSimple();
+ case 0x1:
+ return parseInteger();
+ case 0x8:
+ return parseUID();
+ case 0x2:
+ return parseReal();
+ case 0x3:
+ return parseDate();
+ case 0x4:
+ return parseData();
+ case 0x5: // ASCII
+ return parsePlistString();
+ case 0x6: // UTF-16
+ return parsePlistString(true);
+ case 0xA:
+ return parseArray();
+ case 0xD:
+ return parseDictionary();
+ default:
+ throw new Error("Unhandled type 0x" + objType.toString(16));
+ }
+
+ function parseSimple() {
+ //Simple
+ switch (objInfo) {
+ case 0x0: // null
+ return null;
+ case 0x8: // false
+ return false;
+ case 0x9: // true
+ return true;
+ case 0xF: // filler byte
+ return null;
+ default:
+ throw new Error("Unhandled simple type 0x" + objType.toString(16));
+ }
+ }
+
+ function bufferToHexString(buffer) {
+ let str = '';
+ let i;
+ for (i = 0; i < buffer.length; i++) {
+ if (buffer[i] != 0x00) {
+ break;
+ }
+ }
+ for (; i < buffer.length; i++) {
+ const part = '00' + buffer[i].toString(16);
+ str += part.substr(part.length - 2);
+ }
+ return str;
+ }
+
+ function parseInteger() {
+ const length = Math.pow(2, objInfo);
+
+ if (objInfo == 0x4) {
+ const data = buffer.slice(offset + 1, offset + 1 + length);
+ const str = bufferToHexString(data);
+ return bigInt(str, 16);
+ }
+ if (objInfo == 0x3) {
+ return buffer.readInt32BE(offset + 1);
+ }
+ if (length < exports.maxObjectSize) {
+ return readUInt(buffer.slice(offset + 1, offset + 1 + length));
+ }
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+
+ function parseUID() {
+ const length = objInfo + 1;
+ if (length < exports.maxObjectSize) {
+ return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length)));
+ }
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+
+ function parseReal() {
+ const length = Math.pow(2, objInfo);
+ if (length < exports.maxObjectSize) {
+ const realBuffer = buffer.slice(offset + 1, offset + 1 + length);
+ if (length === 4) {
+ return realBuffer.readFloatBE(0);
+ }
+ if (length === 8) {
+ return realBuffer.readDoubleBE(0);
+ }
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseDate() {
+ if (objInfo != 0x3) {
+ console.error("Unknown date type :" + objInfo + ". Parsing anyway...");
+ }
+ const dateBuffer = buffer.slice(offset + 1, offset + 9);
+ return new Date(EPOCH + (1000 * dateBuffer.readDoubleBE(0)));
+ }
+
+ function parseData() {
+ let dataoffset = 1;
+ let length = objInfo;
+ if (objInfo == 0xF) {
+ const int_type = buffer[offset + 1];
+ const intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ const intInfo = int_type & 0x0F;
+ const intLength = Math.pow(2, intInfo);
+ dataoffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ if (length < exports.maxObjectSize) {
+ return buffer.slice(offset + dataoffset, offset + dataoffset + length);
+ }
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+
+ function parsePlistString (isUtf16) {
+ isUtf16 = isUtf16 || 0;
+ let enc = "utf8";
+ let length = objInfo;
+ let stroffset = 1;
+ if (objInfo == 0xF) {
+ const int_type = buffer[offset + 1];
+ const intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.err("UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ const intInfo = int_type & 0x0F;
+ const intLength = Math.pow(2, intInfo);
+ stroffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ // length is String length -> to get byte length multiply by 2, as 1 character takes 2 bytes in UTF-16
+ length *= (isUtf16 + 1);
+ if (length < exports.maxObjectSize) {
+ let plistString = Buffer.from(buffer.slice(offset + stroffset, offset + stroffset + length));
+ if (isUtf16) {
+ plistString = swapBytes(plistString);
+ enc = "ucs2";
+ }
+ return plistString.toString(enc);
+ }
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+
+ function parseArray() {
+ let length = objInfo;
+ let arrayoffset = 1;
+ if (objInfo == 0xF) {
+ const int_type = buffer[offset + 1];
+ const intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ const intInfo = int_type & 0x0F;
+ const intLength = Math.pow(2, intInfo);
+ arrayoffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ if (length * objectRefSize > exports.maxObjectSize) {
+ throw new Error("To little heap space available!");
+ }
+ const array = [];
+ for (let i = 0; i < length; i++) {
+ const objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize));
+ array[i] = parseObject(objRef);
+ }
+ return array;
+ }
+
+ function parseDictionary() {
+ let length = objInfo;
+ let dictoffset = 1;
+ if (objInfo == 0xF) {
+ const int_type = buffer[offset + 1];
+ const intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ const intInfo = int_type & 0x0F;
+ const intLength = Math.pow(2, intInfo);
+ dictoffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ if (length * 2 * objectRefSize > exports.maxObjectSize) {
+ throw new Error("To little heap space available!");
+ }
+ if (debug) {
+ console.log("Parsing dictionary #" + tableOffset);
+ }
+ const dict = {};
+ for (let i = 0; i < length; i++) {
+ const keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize));
+ const valRef = readUInt(buffer.slice(offset + dictoffset + (length * objectRefSize) + i * objectRefSize, offset + dictoffset + (length * objectRefSize) + (i + 1) * objectRefSize));
+ const key = parseObject(keyRef);
+ const val = parseObject(valRef);
+ if (debug) {
+ console.log(" DICT #" + tableOffset + ": Mapped " + key + " to " + val);
+ }
+ dict[key] = val;
+ }
+ return dict;
+ }
+ }
+
+ return [ parseObject(topObject) ];
+};
+
+function readUInt(buffer, start) {
+ start = start || 0;
+
+ let l = 0;
+ for (let i = start; i < buffer.length; i++) {
+ l <<= 8;
+ l |= buffer[i] & 0xFF;
+ }
+ return l;
+}
+
+// we're just going to toss the high order bits because javascript doesn't have 64-bit ints
+function readUInt64BE(buffer, start) {
+ const data = buffer.slice(start, start + 8);
+ return data.readUInt32BE(4, 8);
+}
+
+function swapBytes(buffer) {
+ const len = buffer.length;
+ for (let i = 0; i < len; i += 2) {
+ const a = buffer[i];
+ buffer[i] = buffer[i+1];
+ buffer[i+1] = a;
+ }
+ return buffer;
+}
diff --git a/node_modules/bplist-parser/package.json b/node_modules/bplist-parser/package.json
new file mode 100644
index 0000000..b85a034
--- /dev/null
+++ b/node_modules/bplist-parser/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "bplist-parser",
+ "version": "0.2.0",
+ "description": "Binary plist parser.",
+ "main": "bplistParser.js",
+ "scripts": {
+ "test": "mocha test"
+ },
+ "keywords": [
+ "bplist",
+ "plist",
+ "parser"
+ ],
+ "author": "Joe Ferner ",
+ "contributors": [
+ "Brett Zamir"
+ ],
+ "license": "MIT",
+ "devDependencies": {
+ "mocha": "^6.1.4"
+ },
+ "homepage": "https://github.com/nearinfinity/node-bplist-parser",
+ "bugs": "https://github.com/nearinfinity/node-bplist-parser/issues",
+ "engines": {
+ "node": ">= 5.10.0"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nearinfinity/node-bplist-parser.git"
+ },
+ "dependencies": {
+ "big-integer": "^1.6.44"
+ }
+}
diff --git a/node_modules/bplist-parser/test/airplay.bplist b/node_modules/bplist-parser/test/airplay.bplist
new file mode 100644
index 0000000..931adea
Binary files /dev/null and b/node_modules/bplist-parser/test/airplay.bplist differ
diff --git a/node_modules/bplist-parser/test/iTunes-small.bplist b/node_modules/bplist-parser/test/iTunes-small.bplist
new file mode 100644
index 0000000..b7edb14
Binary files /dev/null and b/node_modules/bplist-parser/test/iTunes-small.bplist differ
diff --git a/node_modules/bplist-parser/test/int64.bplist b/node_modules/bplist-parser/test/int64.bplist
new file mode 100644
index 0000000..6da9c04
Binary files /dev/null and b/node_modules/bplist-parser/test/int64.bplist differ
diff --git a/node_modules/bplist-parser/test/int64.xml b/node_modules/bplist-parser/test/int64.xml
new file mode 100644
index 0000000..cc6cb03
--- /dev/null
+++ b/node_modules/bplist-parser/test/int64.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ zero
+ 0
+ int64item
+ 12345678901234567890
+
+
diff --git a/node_modules/bplist-parser/test/parseTest.js b/node_modules/bplist-parser/test/parseTest.js
new file mode 100644
index 0000000..1cc8c58
--- /dev/null
+++ b/node_modules/bplist-parser/test/parseTest.js
@@ -0,0 +1,104 @@
+'use strict';
+
+// tests are adapted from https://github.com/TooTallNate/node-plist
+
+const assert = require('assert');
+const path = require('path');
+const bplist = require('../');
+
+describe('bplist-parser', function () {
+ it('iTunes Small', async function () {
+ const file = path.join(__dirname, "iTunes-small.bplist");
+ const startTime1 = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime1) + 'ms');
+ assert.equal(dict['Application Version'], "9.0.3");
+ assert.equal(dict['Library Persistent ID'], "6F81D37F95101437");
+ });
+
+ it('sample1', async function () {
+ const file = path.join(__dirname, "sample1.bplist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.equal(dict['CFBundleIdentifier'], 'com.apple.dictionary.MySample');
+ });
+
+ it('sample2', async function () {
+ const file = path.join(__dirname, "sample2.bplist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.equal(dict['PopupMenu'][2]['Key'], "\n #import \n\n#import \n\nint main(int argc, char *argv[])\n{\n return macruby_main(\"rb_main.rb\", argc, argv);\n}\n");
+ });
+
+ it('airplay', async function () {
+ const file = path.join(__dirname, "airplay.bplist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.equal(dict['duration'], 5555.0495000000001);
+ assert.equal(dict['position'], 4.6269989039999997);
+ });
+
+ it('utf16', async function () {
+ const file = path.join(__dirname, "utf16.bplist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.equal(dict['CFBundleName'], 'sellStuff');
+ assert.equal(dict['CFBundleShortVersionString'], '2.6.1');
+ assert.equal(dict['NSHumanReadableCopyright'], '©2008-2012, sellStuff, Inc.');
+ });
+
+ it('utf16chinese', async function () {
+ const file = path.join(__dirname, "utf16_chinese.plist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.equal(dict['CFBundleName'], '天翼阅读');
+ assert.equal(dict['CFBundleDisplayName'], '天翼阅读');
+ });
+
+ it('uid', async function () {
+ const file = path.join(__dirname, "uid.bplist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.deepEqual(dict['$objects'][1]['NS.keys'], [{UID:2}, {UID:3}, {UID:4}]);
+ assert.deepEqual(dict['$objects'][1]['NS.objects'], [{UID: 5}, {UID:6}, {UID:7}]);
+ assert.deepEqual(dict['$top']['root'], {UID:1});
+ });
+
+ it('int64', async function () {
+ const file = path.join(__dirname, "int64.bplist");
+ const startTime = new Date();
+
+ const [dict] = await bplist.parseFile(file);
+ const endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ assert.equal(dict['zero'], '0');
+ assert.equal(dict['int64item'], '12345678901234567890');
+ });
+});
diff --git a/node_modules/bplist-parser/test/sample1.bplist b/node_modules/bplist-parser/test/sample1.bplist
new file mode 100644
index 0000000..5b808ff
Binary files /dev/null and b/node_modules/bplist-parser/test/sample1.bplist differ
diff --git a/node_modules/bplist-parser/test/sample2.bplist b/node_modules/bplist-parser/test/sample2.bplist
new file mode 100644
index 0000000..fc42979
Binary files /dev/null and b/node_modules/bplist-parser/test/sample2.bplist differ
diff --git a/node_modules/bplist-parser/test/uid.bplist b/node_modules/bplist-parser/test/uid.bplist
new file mode 100644
index 0000000..59f341e
Binary files /dev/null and b/node_modules/bplist-parser/test/uid.bplist differ
diff --git a/node_modules/bplist-parser/test/utf16.bplist b/node_modules/bplist-parser/test/utf16.bplist
new file mode 100644
index 0000000..ba4bcfa
Binary files /dev/null and b/node_modules/bplist-parser/test/utf16.bplist differ
diff --git a/node_modules/bplist-parser/test/utf16_chinese.plist b/node_modules/bplist-parser/test/utf16_chinese.plist
new file mode 100644
index 0000000..ba1e2d7
Binary files /dev/null and b/node_modules/bplist-parser/test/utf16_chinese.plist differ
diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE
new file mode 100644
index 0000000..de32266
--- /dev/null
+++ b/node_modules/brace-expansion/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2013 Julian Gruber
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md
new file mode 100644
index 0000000..6b4e0e1
--- /dev/null
+++ b/node_modules/brace-expansion/README.md
@@ -0,0 +1,129 @@
+# brace-expansion
+
+[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
+as known from sh/bash, in JavaScript.
+
+[](http://travis-ci.org/juliangruber/brace-expansion)
+[](https://www.npmjs.org/package/brace-expansion)
+[](https://greenkeeper.io/)
+
+[](https://ci.testling.com/juliangruber/brace-expansion)
+
+## Example
+
+```js
+var expand = require('brace-expansion');
+
+expand('file-{a,b,c}.jpg')
+// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
+
+expand('-v{,,}')
+// => ['-v', '-v', '-v']
+
+expand('file{0..2}.jpg')
+// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
+
+expand('file-{a..c}.jpg')
+// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
+
+expand('file{2..0}.jpg')
+// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
+
+expand('file{0..4..2}.jpg')
+// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
+
+expand('file-{a..e..2}.jpg')
+// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
+
+expand('file{00..10..5}.jpg')
+// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
+
+expand('{{A..C},{a..c}}')
+// => ['A', 'B', 'C', 'a', 'b', 'c']
+
+expand('ppp{,config,oe{,conf}}')
+// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
+```
+
+## API
+
+```js
+var expand = require('brace-expansion');
+```
+
+### var expanded = expand(str)
+
+Return an array of all possible and valid expansions of `str`. If none are
+found, `[str]` is returned.
+
+Valid expansions are:
+
+```js
+/^(.*,)+(.+)?$/
+// {a,b,...}
+```
+
+A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
+
+```js
+/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
+// {x..y[..incr]}
+```
+
+A numeric sequence from `x` to `y` inclusive, with optional increment.
+If `x` or `y` start with a leading `0`, all the numbers will be padded
+to have equal length. Negative numbers and backwards iteration work too.
+
+```js
+/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
+// {x..y[..incr]}
+```
+
+An alphabetic sequence from `x` to `y` inclusive, with optional increment.
+`x` and `y` must be exactly one character, and if given, `incr` must be a
+number.
+
+For compatibility reasons, the string `${` is not eligible for brace expansion.
+
+## Installation
+
+With [npm](https://npmjs.org) do:
+
+```bash
+npm install brace-expansion
+```
+
+## Contributors
+
+- [Julian Gruber](https://github.com/juliangruber)
+- [Isaac Z. Schlueter](https://github.com/isaacs)
+
+## Sponsors
+
+This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
+
+Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
+
+## License
+
+(MIT)
+
+Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js
new file mode 100644
index 0000000..0478be8
--- /dev/null
+++ b/node_modules/brace-expansion/index.js
@@ -0,0 +1,201 @@
+var concatMap = require('concat-map');
+var balanced = require('balanced-match');
+
+module.exports = expandTop;
+
+var escSlash = '\0SLASH'+Math.random()+'\0';
+var escOpen = '\0OPEN'+Math.random()+'\0';
+var escClose = '\0CLOSE'+Math.random()+'\0';
+var escComma = '\0COMMA'+Math.random()+'\0';
+var escPeriod = '\0PERIOD'+Math.random()+'\0';
+
+function numeric(str) {
+ return parseInt(str, 10) == str
+ ? parseInt(str, 10)
+ : str.charCodeAt(0);
+}
+
+function escapeBraces(str) {
+ return str.split('\\\\').join(escSlash)
+ .split('\\{').join(escOpen)
+ .split('\\}').join(escClose)
+ .split('\\,').join(escComma)
+ .split('\\.').join(escPeriod);
+}
+
+function unescapeBraces(str) {
+ return str.split(escSlash).join('\\')
+ .split(escOpen).join('{')
+ .split(escClose).join('}')
+ .split(escComma).join(',')
+ .split(escPeriod).join('.');
+}
+
+
+// Basically just str.split(","), but handling cases
+// where we have nested braced sections, which should be
+// treated as individual members, like {a,{b,c},d}
+function parseCommaParts(str) {
+ if (!str)
+ return [''];
+
+ var parts = [];
+ var m = balanced('{', '}', str);
+
+ if (!m)
+ return str.split(',');
+
+ var pre = m.pre;
+ var body = m.body;
+ var post = m.post;
+ var p = pre.split(',');
+
+ p[p.length-1] += '{' + body + '}';
+ var postParts = parseCommaParts(post);
+ if (post.length) {
+ p[p.length-1] += postParts.shift();
+ p.push.apply(p, postParts);
+ }
+
+ parts.push.apply(parts, p);
+
+ return parts;
+}
+
+function expandTop(str) {
+ if (!str)
+ return [];
+
+ // I don't know why Bash 4.3 does this, but it does.
+ // Anything starting with {} will have the first two bytes preserved
+ // but *only* at the top level, so {},a}b will not expand to anything,
+ // but a{},b}c will be expanded to [a}c,abc].
+ // One could argue that this is a bug in Bash, but since the goal of
+ // this module is to match Bash's rules, we escape a leading {}
+ if (str.substr(0, 2) === '{}') {
+ str = '\\{\\}' + str.substr(2);
+ }
+
+ return expand(escapeBraces(str), true).map(unescapeBraces);
+}
+
+function identity(e) {
+ return e;
+}
+
+function embrace(str) {
+ return '{' + str + '}';
+}
+function isPadded(el) {
+ return /^-?0\d/.test(el);
+}
+
+function lte(i, y) {
+ return i <= y;
+}
+function gte(i, y) {
+ return i >= y;
+}
+
+function expand(str, isTop) {
+ var expansions = [];
+
+ var m = balanced('{', '}', str);
+ if (!m || /\$$/.test(m.pre)) return [str];
+
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ var isSequence = isNumericSequence || isAlphaSequence;
+ var isOptions = m.body.indexOf(',') >= 0;
+ if (!isSequence && !isOptions) {
+ // {a},b}
+ if (m.post.match(/,.*\}/)) {
+ str = m.pre + '{' + m.body + escClose + m.post;
+ return expand(str);
+ }
+ return [str];
+ }
+
+ var n;
+ if (isSequence) {
+ n = m.body.split(/\.\./);
+ } else {
+ n = parseCommaParts(m.body);
+ if (n.length === 1) {
+ // x{{a,b}}y ==> x{a}y x{b}y
+ n = expand(n[0], false).map(embrace);
+ if (n.length === 1) {
+ var post = m.post.length
+ ? expand(m.post, false)
+ : [''];
+ return post.map(function(p) {
+ return m.pre + n[0] + p;
+ });
+ }
+ }
+ }
+
+ // at this point, n is the parts, and we know it's not a comma set
+ // with a single entry.
+
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
+ var pre = m.pre;
+ var post = m.post.length
+ ? expand(m.post, false)
+ : [''];
+
+ var N;
+
+ if (isSequence) {
+ var x = numeric(n[0]);
+ var y = numeric(n[1]);
+ var width = Math.max(n[0].length, n[1].length)
+ var incr = n.length == 3
+ ? Math.abs(numeric(n[2]))
+ : 1;
+ var test = lte;
+ var reverse = y < x;
+ if (reverse) {
+ incr *= -1;
+ test = gte;
+ }
+ var pad = n.some(isPadded);
+
+ N = [];
+
+ for (var i = x; test(i, y); i += incr) {
+ var c;
+ if (isAlphaSequence) {
+ c = String.fromCharCode(i);
+ if (c === '\\')
+ c = '';
+ } else {
+ c = String(i);
+ if (pad) {
+ var need = width - c.length;
+ if (need > 0) {
+ var z = new Array(need + 1).join('0');
+ if (i < 0)
+ c = '-' + z + c.slice(1);
+ else
+ c = z + c;
+ }
+ }
+ }
+ N.push(c);
+ }
+ } else {
+ N = concatMap(n, function(el) { return expand(el, false) });
+ }
+
+ for (var j = 0; j < N.length; j++) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre + N[j] + post[k];
+ if (!isTop || isSequence || expansion)
+ expansions.push(expansion);
+ }
+ }
+
+ return expansions;
+}
+
diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json
new file mode 100644
index 0000000..a18faa8
--- /dev/null
+++ b/node_modules/brace-expansion/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "brace-expansion",
+ "description": "Brace expansion as known from sh/bash",
+ "version": "1.1.11",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/juliangruber/brace-expansion.git"
+ },
+ "homepage": "https://github.com/juliangruber/brace-expansion",
+ "main": "index.js",
+ "scripts": {
+ "test": "tape test/*.js",
+ "gentest": "bash test/generate.sh",
+ "bench": "matcha test/perf/bench.js"
+ },
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ },
+ "devDependencies": {
+ "matcha": "^0.7.0",
+ "tape": "^4.6.0"
+ },
+ "keywords": [],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT",
+ "testling": {
+ "files": "test/*.js",
+ "browsers": [
+ "ie/8..latest",
+ "firefox/20..latest",
+ "firefox/nightly",
+ "chrome/25..latest",
+ "chrome/canary",
+ "opera/12..latest",
+ "opera/next",
+ "safari/5.1..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest",
+ "android-browser/4.2..latest"
+ ]
+ }
+}
diff --git a/node_modules/braces/CHANGELOG.md b/node_modules/braces/CHANGELOG.md
new file mode 100644
index 0000000..36f798b
--- /dev/null
+++ b/node_modules/braces/CHANGELOG.md
@@ -0,0 +1,184 @@
+# Release history
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+
+
+ Guiding Principles
+
+- Changelogs are for humans, not machines.
+- There should be an entry for every single version.
+- The same types of changes should be grouped.
+- Versions and sections should be linkable.
+- The latest version comes first.
+- The release date of each versions is displayed.
+- Mention whether you follow Semantic Versioning.
+
+
+
+
+ Types of changes
+
+Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_):
+
+- `Added` for new features.
+- `Changed` for changes in existing functionality.
+- `Deprecated` for soon-to-be removed features.
+- `Removed` for now removed features.
+- `Fixed` for any bug fixes.
+- `Security` in case of vulnerabilities.
+
+
+
+## [3.0.0] - 2018-04-08
+
+v3.0 is a complete refactor, resulting in a faster, smaller codebase, with fewer deps, and a more accurate parser and compiler.
+
+**Breaking Changes**
+
+- The undocumented `.makeRe` method was removed
+
+**Non-breaking changes**
+
+- Caching was removed
+
+## [2.3.2] - 2018-04-08
+
+- start refactoring
+- cover sets
+- better range handling
+
+## [2.3.1] - 2018-02-17
+
+- Remove unnecessary escape in Regex. (#14)
+
+## [2.3.0] - 2017-10-19
+
+- minor code reorganization
+- optimize regex
+- expose `maxLength` option
+
+## [2.2.1] - 2017-05-30
+
+- don't condense when braces contain extglobs
+
+## [2.2.0] - 2017-05-28
+
+- ensure word boundaries are preserved
+- fixes edge case where extglob characters precede a brace pattern
+
+## [2.1.1] - 2017-04-27
+
+- use snapdragon-node
+- handle edge case
+- optimizations, lint
+
+## [2.0.4] - 2017-04-11
+
+- pass opts to compiler
+- minor optimization in create method
+- re-write parser handlers to remove negation regex
+
+## [2.0.3] - 2016-12-10
+
+- use split-string
+- clear queue at the end
+- adds sequences example
+- add unit tests
+
+## [2.0.2] - 2016-10-21
+
+- fix comma handling in nested extglobs
+
+## [2.0.1] - 2016-10-20
+
+- add comments
+- more tests, ensure quotes are stripped
+
+## [2.0.0] - 2016-10-19
+
+- don't expand braces inside character classes
+- add quantifier pattern
+
+## [1.8.5] - 2016-05-21
+
+- Refactor (#10)
+
+## [1.8.4] - 2016-04-20
+
+- fixes https://github.com/jonschlinkert/micromatch/issues/66
+
+## [1.8.0] - 2015-03-18
+
+- adds exponent examples, tests
+- fixes the first example in https://github.com/jonschlinkert/micromatch/issues/38
+
+## [1.6.0] - 2015-01-30
+
+- optimizations, `bash` mode:
+- improve path escaping
+
+## [1.5.0] - 2015-01-28
+
+- Merge pull request #5 from eush77/lib-files
+
+## [1.4.0] - 2015-01-24
+
+- add extglob tests
+- externalize exponent function
+- better whitespace handling
+
+## [1.3.0] - 2015-01-24
+
+- make regex patterns explicity
+
+## [1.1.0] - 2015-01-11
+
+- don't create a match group with `makeRe`
+
+## [1.0.0] - 2014-12-23
+
+- Merge commit '97b05f5544f8348736a8efaecf5c32bbe3e2ad6e'
+- support empty brace syntax
+- better bash coverage
+- better support for regex strings
+
+## [0.1.4] - 2014-11-14
+
+- improve recognition of bad args, recognize mismatched argument types
+- support escaping
+- remove pathname-expansion
+- support whitespace in patterns
+
+## [0.1.0]
+
+- first commit
+
+[2.3.2]: https://github.com/micromatch/braces/compare/2.3.1...2.3.2
+[2.3.1]: https://github.com/micromatch/braces/compare/2.3.0...2.3.1
+[2.3.0]: https://github.com/micromatch/braces/compare/2.2.1...2.3.0
+[2.2.1]: https://github.com/micromatch/braces/compare/2.2.0...2.2.1
+[2.2.0]: https://github.com/micromatch/braces/compare/2.1.1...2.2.0
+[2.1.1]: https://github.com/micromatch/braces/compare/2.1.0...2.1.1
+[2.1.0]: https://github.com/micromatch/braces/compare/2.0.4...2.1.0
+[2.0.4]: https://github.com/micromatch/braces/compare/2.0.3...2.0.4
+[2.0.3]: https://github.com/micromatch/braces/compare/2.0.2...2.0.3
+[2.0.2]: https://github.com/micromatch/braces/compare/2.0.1...2.0.2
+[2.0.1]: https://github.com/micromatch/braces/compare/2.0.0...2.0.1
+[2.0.0]: https://github.com/micromatch/braces/compare/1.8.5...2.0.0
+[1.8.5]: https://github.com/micromatch/braces/compare/1.8.4...1.8.5
+[1.8.4]: https://github.com/micromatch/braces/compare/1.8.0...1.8.4
+[1.8.0]: https://github.com/micromatch/braces/compare/1.6.0...1.8.0
+[1.6.0]: https://github.com/micromatch/braces/compare/1.5.0...1.6.0
+[1.5.0]: https://github.com/micromatch/braces/compare/1.4.0...1.5.0
+[1.4.0]: https://github.com/micromatch/braces/compare/1.3.0...1.4.0
+[1.3.0]: https://github.com/micromatch/braces/compare/1.2.0...1.3.0
+[1.2.0]: https://github.com/micromatch/braces/compare/1.1.0...1.2.0
+[1.1.0]: https://github.com/micromatch/braces/compare/1.0.0...1.1.0
+[1.0.0]: https://github.com/micromatch/braces/compare/0.1.4...1.0.0
+[0.1.4]: https://github.com/micromatch/braces/compare/0.1.0...0.1.4
+
+[Unreleased]: https://github.com/micromatch/braces/compare/0.1.0...HEAD
+[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
\ No newline at end of file
diff --git a/node_modules/braces/LICENSE b/node_modules/braces/LICENSE
new file mode 100644
index 0000000..d32ab44
--- /dev/null
+++ b/node_modules/braces/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2018, Jon Schlinkert.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/braces/README.md b/node_modules/braces/README.md
new file mode 100644
index 0000000..cba2f60
--- /dev/null
+++ b/node_modules/braces/README.md
@@ -0,0 +1,593 @@
+# braces [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/braces) [](https://npmjs.org/package/braces) [](https://npmjs.org/package/braces) [](https://travis-ci.org/micromatch/braces)
+
+> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.
+
+Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/):
+
+```sh
+$ npm install --save braces
+```
+
+## v3.0.0 Released!!
+
+See the [changelog](CHANGELOG.md) for details.
+
+## Why use braces?
+
+Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters.
+
+* **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
+* **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
+* **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up.
+* **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written).
+* **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)).
+* [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
+* [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']`
+* [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']`
+* [Supports escaping](#escaping) - To prevent evaluation of special characters.
+
+## Usage
+
+The main export is a function that takes one or more brace `patterns` and `options`.
+
+```js
+const braces = require('braces');
+// braces(patterns[, options]);
+
+console.log(braces(['{01..05}', '{a..e}']));
+//=> ['(0[1-5])', '([a-e])']
+
+console.log(braces(['{01..05}', '{a..e}'], { expand: true }));
+//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e']
+```
+
+### Brace Expansion vs. Compilation
+
+By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching.
+
+**Compiled**
+
+```js
+console.log(braces('a/{x,y,z}/b'));
+//=> ['a/(x|y|z)/b']
+console.log(braces(['a/{01..20}/b', 'a/{1..5}/b']));
+//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ]
+```
+
+**Expanded**
+
+Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)):
+
+```js
+console.log(braces('a/{x,y,z}/b', { expand: true }));
+//=> ['a/x/b', 'a/y/b', 'a/z/b']
+
+console.log(braces.expand('{01..10}'));
+//=> ['01','02','03','04','05','06','07','08','09','10']
+```
+
+### Lists
+
+Expand lists (like Bash "sets"):
+
+```js
+console.log(braces('a/{foo,bar,baz}/*.js'));
+//=> ['a/(foo|bar|baz)/*.js']
+
+console.log(braces.expand('a/{foo,bar,baz}/*.js'));
+//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js']
+```
+
+### Sequences
+
+Expand ranges of characters (like Bash "sequences"):
+
+```js
+console.log(braces.expand('{1..3}')); // ['1', '2', '3']
+console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b']
+console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c']
+console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c']
+
+// supports zero-padded ranges
+console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b']
+console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b']
+```
+
+See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options.
+
+### Steppped ranges
+
+Steps, or increments, may be used with ranges:
+
+```js
+console.log(braces.expand('{2..10..2}'));
+//=> ['2', '4', '6', '8', '10']
+
+console.log(braces('{2..10..2}'));
+//=> ['(2|4|6|8|10)']
+```
+
+When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion.
+
+### Nesting
+
+Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved.
+
+**"Expanded" braces**
+
+```js
+console.log(braces.expand('a{b,c,/{x,y}}/e'));
+//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e']
+
+console.log(braces.expand('a/{x,{1..5},y}/c'));
+//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c']
+```
+
+**"Optimized" braces**
+
+```js
+console.log(braces('a{b,c,/{x,y}}/e'));
+//=> ['a(b|c|/(x|y))/e']
+
+console.log(braces('a/{x,{1..5},y}/c'));
+//=> ['a/(x|([1-5])|y)/c']
+```
+
+### Escaping
+
+**Escaping braces**
+
+A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_:
+
+```js
+console.log(braces.expand('a\\{d,c,b}e'));
+//=> ['a{d,c,b}e']
+
+console.log(braces.expand('a{d,c,b\\}e'));
+//=> ['a{d,c,b}e']
+```
+
+**Escaping commas**
+
+Commas inside braces may also be escaped:
+
+```js
+console.log(braces.expand('a{b\\,c}d'));
+//=> ['a{b,c}d']
+
+console.log(braces.expand('a{d\\,c,b}e'));
+//=> ['ad,ce', 'abe']
+```
+
+**Single items**
+
+Following bash conventions, a brace pattern is also not expanded when it contains a single character:
+
+```js
+console.log(braces.expand('a{b}c'));
+//=> ['a{b}c']
+```
+
+## Options
+
+### options.maxLength
+
+**Type**: `Number`
+
+**Default**: `65,536`
+
+**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera.
+
+```js
+console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error
+```
+
+### options.expand
+
+**Type**: `Boolean`
+
+**Default**: `undefined`
+
+**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing).
+
+```js
+console.log(braces('a/{b,c}/d', { expand: true }));
+//=> [ 'a/b/d', 'a/c/d' ]
+```
+
+### options.nodupes
+
+**Type**: `Boolean`
+
+**Default**: `undefined`
+
+**Description**: Remove duplicates from the returned array.
+
+### options.rangeLimit
+
+**Type**: `Number`
+
+**Default**: `1000`
+
+**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`.
+
+You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether.
+
+**Examples**
+
+```js
+// pattern exceeds the "rangeLimit", so it's optimized automatically
+console.log(braces.expand('{1..1000}'));
+//=> ['([1-9]|[1-9][0-9]{1,2}|1000)']
+
+// pattern does not exceed "rangeLimit", so it's NOT optimized
+console.log(braces.expand('{1..100}'));
+//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100']
+```
+
+### options.transform
+
+**Type**: `Function`
+
+**Default**: `undefined`
+
+**Description**: Customize range expansion.
+
+**Example: Transforming non-numeric values**
+
+```js
+const alpha = braces.expand('x/{a..e}/y', {
+ transform(value, index) {
+ // When non-numeric values are passed, "value" is a character code.
+ return 'foo/' + String.fromCharCode(value) + '-' + index;
+ }
+});
+console.log(alpha);
+//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ]
+```
+
+**Example: Transforming numeric values**
+
+```js
+const numeric = braces.expand('{1..5}', {
+ transform(value) {
+ // when numeric values are passed, "value" is a number
+ return 'foo/' + value * 2;
+ }
+});
+console.log(numeric);
+//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ]
+```
+
+### options.quantifiers
+
+**Type**: `Boolean`
+
+**Default**: `undefined`
+
+**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times.
+
+Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists)
+
+The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists.
+
+**Examples**
+
+```js
+const braces = require('braces');
+console.log(braces('a/b{1,3}/{x,y,z}'));
+//=> [ 'a/b(1|3)/(x|y|z)' ]
+console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true}));
+//=> [ 'a/b{1,3}/(x|y|z)' ]
+console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true}));
+//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ]
+```
+
+### options.unescape
+
+**Type**: `Boolean`
+
+**Default**: `undefined`
+
+**Description**: Strip backslashes that were used for escaping from the result.
+
+## What is "brace expansion"?
+
+Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs).
+
+In addition to "expansion", braces are also used for matching. In other words:
+
+* [brace expansion](#brace-expansion) is for generating new lists
+* [brace matching](#brace-matching) is for filtering existing lists
+
+
+More about brace expansion (click to expand)
+
+There are two main types of brace expansion:
+
+1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}`
+2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges".
+
+Here are some example brace patterns to illustrate how they work:
+
+**Sets**
+
+```
+{a,b,c} => a b c
+{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2
+```
+
+**Sequences**
+
+```
+{1..9} => 1 2 3 4 5 6 7 8 9
+{4..-4} => 4 3 2 1 0 -1 -2 -3 -4
+{1..20..3} => 1 4 7 10 13 16 19
+{a..j} => a b c d e f g h i j
+{j..a} => j i h g f e d c b a
+{a..z..3} => a d g j m p s v y
+```
+
+**Combination**
+
+Sets and sequences can be mixed together or used along with any other strings.
+
+```
+{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3
+foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar
+```
+
+The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases.
+
+## Brace matching
+
+In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching.
+
+For example, the pattern `foo/{1..3}/bar` would match any of following strings:
+
+```
+foo/1/bar
+foo/2/bar
+foo/3/bar
+```
+
+But not:
+
+```
+baz/1/qux
+baz/2/qux
+baz/3/qux
+```
+
+Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings:
+
+```
+foo/1/bar
+foo/2/bar
+foo/3/bar
+baz/1/qux
+baz/2/qux
+baz/3/qux
+```
+
+## Brace matching pitfalls
+
+Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of.
+
+### tldr
+
+**"brace bombs"**
+
+* brace expansion can eat up a huge amount of processing resources
+* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
+* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
+
+For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section.
+
+### The solution
+
+Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries.
+
+### Geometric complexity
+
+At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`.
+
+For example, the following sets demonstrate quadratic (`O(n^2)`) complexity:
+
+```
+{1,2}{3,4} => (2X2) => 13 14 23 24
+{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246
+```
+
+But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity:
+
+```
+{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248
+ 249 257 258 259 267 268 269 347 348 349 357
+ 358 359 367 368 369
+```
+
+Now, imagine how this complexity grows given that each element is a n-tuple:
+
+```
+{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB)
+{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB)
+```
+
+Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control.
+
+**More information**
+
+Interested in learning more about brace expansion?
+
+* [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion)
+* [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion)
+* [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)
+
+
+
+## Performance
+
+Braces is not only screaming fast, it's also more accurate the other brace expansion libraries.
+
+### Better algorithms
+
+Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_.
+
+Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently.
+
+**The proof is in the numbers**
+
+Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively.
+
+| **Pattern** | **braces** | **[minimatch][]** |
+| --- | --- | --- |
+| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs)| N/A (freezes) |
+| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) |
+| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) |
+| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) |
+| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) |
+| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) |
+| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) |
+| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) |
+| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) |
+| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) |
+| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) |
+| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) |
+| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) |
+| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) |
+| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) |
+| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) |
+| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) |
+
+### Faster algorithms
+
+When you need expansion, braces is still much faster.
+
+_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_
+
+| **Pattern** | **braces** | **[minimatch][]** |
+| --- | --- | --- |
+| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) |
+| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) |
+| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) |
+| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) |
+| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) |
+| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) |
+| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) |
+| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) |
+
+If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js).
+
+## Benchmarks
+
+### Running benchmarks
+
+Install dev dependencies:
+
+```bash
+npm i -d && npm benchmark
+```
+
+### Latest results
+
+Braces is more accurate, without sacrificing performance.
+
+```bash
+# range (expanded)
+ braces x 29,040 ops/sec ±3.69% (91 runs sampled))
+ minimatch x 4,735 ops/sec ±1.28% (90 runs sampled)
+
+# range (optimized for regex)
+ braces x 382,878 ops/sec ±0.56% (94 runs sampled)
+ minimatch x 1,040 ops/sec ±0.44% (93 runs sampled)
+
+# nested ranges (expanded)
+ braces x 19,744 ops/sec ±2.27% (92 runs sampled))
+ minimatch x 4,579 ops/sec ±0.50% (93 runs sampled)
+
+# nested ranges (optimized for regex)
+ braces x 246,019 ops/sec ±2.02% (93 runs sampled)
+ minimatch x 1,028 ops/sec ±0.39% (94 runs sampled)
+
+# set (expanded)
+ braces x 138,641 ops/sec ±0.53% (95 runs sampled)
+ minimatch x 219,582 ops/sec ±0.98% (94 runs sampled)
+
+# set (optimized for regex)
+ braces x 388,408 ops/sec ±0.41% (95 runs sampled)
+ minimatch x 44,724 ops/sec ±0.91% (89 runs sampled)
+
+# nested sets (expanded)
+ braces x 84,966 ops/sec ±0.48% (94 runs sampled)
+ minimatch x 140,720 ops/sec ±0.37% (95 runs sampled)
+
+# nested sets (optimized for regex)
+ braces x 263,340 ops/sec ±2.06% (92 runs sampled)
+ minimatch x 28,714 ops/sec ±0.40% (90 runs sampled)
+```
+
+## About
+
+
+Contributing
+
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
+
+
+
+
+Running Tests
+
+Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
+
+```sh
+$ npm install && npm test
+```
+
+
+
+
+Building docs
+
+_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
+
+To generate the readme, run the following command:
+
+```sh
+$ npm install -g verbose/verb#dev verb-generate-readme && verb
+```
+
+
+
+### Contributors
+
+| **Commits** | **Contributor** |
+| --- | --- |
+| 197 | [jonschlinkert](https://github.com/jonschlinkert) |
+| 4 | [doowb](https://github.com/doowb) |
+| 1 | [es128](https://github.com/es128) |
+| 1 | [eush77](https://github.com/eush77) |
+| 1 | [hemanth](https://github.com/hemanth) |
+| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
+
+### Author
+
+**Jon Schlinkert**
+
+* [GitHub Profile](https://github.com/jonschlinkert)
+* [Twitter Profile](https://twitter.com/jonschlinkert)
+* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
+
+### License
+
+Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
+Released under the [MIT License](LICENSE).
+
+***
+
+_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._
\ No newline at end of file
diff --git a/node_modules/braces/index.js b/node_modules/braces/index.js
new file mode 100644
index 0000000..0eee0f5
--- /dev/null
+++ b/node_modules/braces/index.js
@@ -0,0 +1,170 @@
+'use strict';
+
+const stringify = require('./lib/stringify');
+const compile = require('./lib/compile');
+const expand = require('./lib/expand');
+const parse = require('./lib/parse');
+
+/**
+ * Expand the given pattern or create a regex-compatible string.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
+ * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
+ * ```
+ * @param {String} `str`
+ * @param {Object} `options`
+ * @return {String}
+ * @api public
+ */
+
+const braces = (input, options = {}) => {
+ let output = [];
+
+ if (Array.isArray(input)) {
+ for (let pattern of input) {
+ let result = braces.create(pattern, options);
+ if (Array.isArray(result)) {
+ output.push(...result);
+ } else {
+ output.push(result);
+ }
+ }
+ } else {
+ output = [].concat(braces.create(input, options));
+ }
+
+ if (options && options.expand === true && options.nodupes === true) {
+ output = [...new Set(output)];
+ }
+ return output;
+};
+
+/**
+ * Parse the given `str` with the given `options`.
+ *
+ * ```js
+ * // braces.parse(pattern, [, options]);
+ * const ast = braces.parse('a/{b,c}/d');
+ * console.log(ast);
+ * ```
+ * @param {String} pattern Brace pattern to parse
+ * @param {Object} options
+ * @return {Object} Returns an AST
+ * @api public
+ */
+
+braces.parse = (input, options = {}) => parse(input, options);
+
+/**
+ * Creates a braces string from an AST, or an AST node.
+ *
+ * ```js
+ * const braces = require('braces');
+ * let ast = braces.parse('foo/{a,b}/bar');
+ * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
+ * ```
+ * @param {String} `input` Brace pattern or AST.
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces.stringify = (input, options = {}) => {
+ if (typeof input === 'string') {
+ return stringify(braces.parse(input, options), options);
+ }
+ return stringify(input, options);
+};
+
+/**
+ * Compiles a brace pattern into a regex-compatible, optimized string.
+ * This method is called by the main [braces](#braces) function by default.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces.compile('a/{b,c}/d'));
+ * //=> ['a/(b|c)/d']
+ * ```
+ * @param {String} `input` Brace pattern or AST.
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces.compile = (input, options = {}) => {
+ if (typeof input === 'string') {
+ input = braces.parse(input, options);
+ }
+ return compile(input, options);
+};
+
+/**
+ * Expands a brace pattern into an array. This method is called by the
+ * main [braces](#braces) function when `options.expand` is true. Before
+ * using this method it's recommended that you read the [performance notes](#performance))
+ * and advantages of using [.compile](#compile) instead.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces.expand('a/{b,c}/d'));
+ * //=> ['a/b/d', 'a/c/d'];
+ * ```
+ * @param {String} `pattern` Brace pattern
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces.expand = (input, options = {}) => {
+ if (typeof input === 'string') {
+ input = braces.parse(input, options);
+ }
+
+ let result = expand(input, options);
+
+ // filter out empty strings if specified
+ if (options.noempty === true) {
+ result = result.filter(Boolean);
+ }
+
+ // filter out duplicates if specified
+ if (options.nodupes === true) {
+ result = [...new Set(result)];
+ }
+
+ return result;
+};
+
+/**
+ * Processes a brace pattern and returns either an expanded array
+ * (if `options.expand` is true), a highly optimized regex-compatible string.
+ * This method is called by the main [braces](#braces) function.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
+ * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
+ * ```
+ * @param {String} `pattern` Brace pattern
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces.create = (input, options = {}) => {
+ if (input === '' || input.length < 3) {
+ return [input];
+ }
+
+ return options.expand !== true
+ ? braces.compile(input, options)
+ : braces.expand(input, options);
+};
+
+/**
+ * Expose "braces"
+ */
+
+module.exports = braces;
diff --git a/node_modules/braces/lib/compile.js b/node_modules/braces/lib/compile.js
new file mode 100644
index 0000000..3e984a4
--- /dev/null
+++ b/node_modules/braces/lib/compile.js
@@ -0,0 +1,57 @@
+'use strict';
+
+const fill = require('fill-range');
+const utils = require('./utils');
+
+const compile = (ast, options = {}) => {
+ let walk = (node, parent = {}) => {
+ let invalidBlock = utils.isInvalidBrace(parent);
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
+ let invalid = invalidBlock === true || invalidNode === true;
+ let prefix = options.escapeInvalid === true ? '\\' : '';
+ let output = '';
+
+ if (node.isOpen === true) {
+ return prefix + node.value;
+ }
+ if (node.isClose === true) {
+ return prefix + node.value;
+ }
+
+ if (node.type === 'open') {
+ return invalid ? (prefix + node.value) : '(';
+ }
+
+ if (node.type === 'close') {
+ return invalid ? (prefix + node.value) : ')';
+ }
+
+ if (node.type === 'comma') {
+ return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
+ }
+
+ if (node.value) {
+ return node.value;
+ }
+
+ if (node.nodes && node.ranges > 0) {
+ let args = utils.reduce(node.nodes);
+ let range = fill(...args, { ...options, wrap: false, toRegex: true });
+
+ if (range.length !== 0) {
+ return args.length > 1 && range.length > 1 ? `(${range})` : range;
+ }
+ }
+
+ if (node.nodes) {
+ for (let child of node.nodes) {
+ output += walk(child, node);
+ }
+ }
+ return output;
+ };
+
+ return walk(ast);
+};
+
+module.exports = compile;
diff --git a/node_modules/braces/lib/constants.js b/node_modules/braces/lib/constants.js
new file mode 100644
index 0000000..a937943
--- /dev/null
+++ b/node_modules/braces/lib/constants.js
@@ -0,0 +1,57 @@
+'use strict';
+
+module.exports = {
+ MAX_LENGTH: 1024 * 64,
+
+ // Digits
+ CHAR_0: '0', /* 0 */
+ CHAR_9: '9', /* 9 */
+
+ // Alphabet chars.
+ CHAR_UPPERCASE_A: 'A', /* A */
+ CHAR_LOWERCASE_A: 'a', /* a */
+ CHAR_UPPERCASE_Z: 'Z', /* Z */
+ CHAR_LOWERCASE_Z: 'z', /* z */
+
+ CHAR_LEFT_PARENTHESES: '(', /* ( */
+ CHAR_RIGHT_PARENTHESES: ')', /* ) */
+
+ CHAR_ASTERISK: '*', /* * */
+
+ // Non-alphabetic chars.
+ CHAR_AMPERSAND: '&', /* & */
+ CHAR_AT: '@', /* @ */
+ CHAR_BACKSLASH: '\\', /* \ */
+ CHAR_BACKTICK: '`', /* ` */
+ CHAR_CARRIAGE_RETURN: '\r', /* \r */
+ CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
+ CHAR_COLON: ':', /* : */
+ CHAR_COMMA: ',', /* , */
+ CHAR_DOLLAR: '$', /* . */
+ CHAR_DOT: '.', /* . */
+ CHAR_DOUBLE_QUOTE: '"', /* " */
+ CHAR_EQUAL: '=', /* = */
+ CHAR_EXCLAMATION_MARK: '!', /* ! */
+ CHAR_FORM_FEED: '\f', /* \f */
+ CHAR_FORWARD_SLASH: '/', /* / */
+ CHAR_HASH: '#', /* # */
+ CHAR_HYPHEN_MINUS: '-', /* - */
+ CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
+ CHAR_LEFT_CURLY_BRACE: '{', /* { */
+ CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
+ CHAR_LINE_FEED: '\n', /* \n */
+ CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
+ CHAR_PERCENT: '%', /* % */
+ CHAR_PLUS: '+', /* + */
+ CHAR_QUESTION_MARK: '?', /* ? */
+ CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
+ CHAR_RIGHT_CURLY_BRACE: '}', /* } */
+ CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
+ CHAR_SEMICOLON: ';', /* ; */
+ CHAR_SINGLE_QUOTE: '\'', /* ' */
+ CHAR_SPACE: ' ', /* */
+ CHAR_TAB: '\t', /* \t */
+ CHAR_UNDERSCORE: '_', /* _ */
+ CHAR_VERTICAL_LINE: '|', /* | */
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
+};
diff --git a/node_modules/braces/lib/expand.js b/node_modules/braces/lib/expand.js
new file mode 100644
index 0000000..376c748
--- /dev/null
+++ b/node_modules/braces/lib/expand.js
@@ -0,0 +1,113 @@
+'use strict';
+
+const fill = require('fill-range');
+const stringify = require('./stringify');
+const utils = require('./utils');
+
+const append = (queue = '', stash = '', enclose = false) => {
+ let result = [];
+
+ queue = [].concat(queue);
+ stash = [].concat(stash);
+
+ if (!stash.length) return queue;
+ if (!queue.length) {
+ return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
+ }
+
+ for (let item of queue) {
+ if (Array.isArray(item)) {
+ for (let value of item) {
+ result.push(append(value, stash, enclose));
+ }
+ } else {
+ for (let ele of stash) {
+ if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
+ result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
+ }
+ }
+ }
+ return utils.flatten(result);
+};
+
+const expand = (ast, options = {}) => {
+ let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
+
+ let walk = (node, parent = {}) => {
+ node.queue = [];
+
+ let p = parent;
+ let q = parent.queue;
+
+ while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
+ p = p.parent;
+ q = p.queue;
+ }
+
+ if (node.invalid || node.dollar) {
+ q.push(append(q.pop(), stringify(node, options)));
+ return;
+ }
+
+ if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
+ q.push(append(q.pop(), ['{}']));
+ return;
+ }
+
+ if (node.nodes && node.ranges > 0) {
+ let args = utils.reduce(node.nodes);
+
+ if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
+ throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
+ }
+
+ let range = fill(...args, options);
+ if (range.length === 0) {
+ range = stringify(node, options);
+ }
+
+ q.push(append(q.pop(), range));
+ node.nodes = [];
+ return;
+ }
+
+ let enclose = utils.encloseBrace(node);
+ let queue = node.queue;
+ let block = node;
+
+ while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
+ block = block.parent;
+ queue = block.queue;
+ }
+
+ for (let i = 0; i < node.nodes.length; i++) {
+ let child = node.nodes[i];
+
+ if (child.type === 'comma' && node.type === 'brace') {
+ if (i === 1) queue.push('');
+ queue.push('');
+ continue;
+ }
+
+ if (child.type === 'close') {
+ q.push(append(q.pop(), queue, enclose));
+ continue;
+ }
+
+ if (child.value && child.type !== 'open') {
+ queue.push(append(queue.pop(), child.value));
+ continue;
+ }
+
+ if (child.nodes) {
+ walk(child, node);
+ }
+ }
+
+ return queue;
+ };
+
+ return utils.flatten(walk(ast));
+};
+
+module.exports = expand;
diff --git a/node_modules/braces/lib/parse.js b/node_modules/braces/lib/parse.js
new file mode 100644
index 0000000..145ea26
--- /dev/null
+++ b/node_modules/braces/lib/parse.js
@@ -0,0 +1,333 @@
+'use strict';
+
+const stringify = require('./stringify');
+
+/**
+ * Constants
+ */
+
+const {
+ MAX_LENGTH,
+ CHAR_BACKSLASH, /* \ */
+ CHAR_BACKTICK, /* ` */
+ CHAR_COMMA, /* , */
+ CHAR_DOT, /* . */
+ CHAR_LEFT_PARENTHESES, /* ( */
+ CHAR_RIGHT_PARENTHESES, /* ) */
+ CHAR_LEFT_CURLY_BRACE, /* { */
+ CHAR_RIGHT_CURLY_BRACE, /* } */
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
+ CHAR_RIGHT_SQUARE_BRACKET, /* ] */
+ CHAR_DOUBLE_QUOTE, /* " */
+ CHAR_SINGLE_QUOTE, /* ' */
+ CHAR_NO_BREAK_SPACE,
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE
+} = require('./constants');
+
+/**
+ * parse
+ */
+
+const parse = (input, options = {}) => {
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ let opts = options || {};
+ let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
+ if (input.length > max) {
+ throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
+ }
+
+ let ast = { type: 'root', input, nodes: [] };
+ let stack = [ast];
+ let block = ast;
+ let prev = ast;
+ let brackets = 0;
+ let length = input.length;
+ let index = 0;
+ let depth = 0;
+ let value;
+ let memo = {};
+
+ /**
+ * Helpers
+ */
+
+ const advance = () => input[index++];
+ const push = node => {
+ if (node.type === 'text' && prev.type === 'dot') {
+ prev.type = 'text';
+ }
+
+ if (prev && prev.type === 'text' && node.type === 'text') {
+ prev.value += node.value;
+ return;
+ }
+
+ block.nodes.push(node);
+ node.parent = block;
+ node.prev = prev;
+ prev = node;
+ return node;
+ };
+
+ push({ type: 'bos' });
+
+ while (index < length) {
+ block = stack[stack.length - 1];
+ value = advance();
+
+ /**
+ * Invalid chars
+ */
+
+ if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
+ continue;
+ }
+
+ /**
+ * Escaped chars
+ */
+
+ if (value === CHAR_BACKSLASH) {
+ push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
+ continue;
+ }
+
+ /**
+ * Right square bracket (literal): ']'
+ */
+
+ if (value === CHAR_RIGHT_SQUARE_BRACKET) {
+ push({ type: 'text', value: '\\' + value });
+ continue;
+ }
+
+ /**
+ * Left square bracket: '['
+ */
+
+ if (value === CHAR_LEFT_SQUARE_BRACKET) {
+ brackets++;
+
+ let closed = true;
+ let next;
+
+ while (index < length && (next = advance())) {
+ value += next;
+
+ if (next === CHAR_LEFT_SQUARE_BRACKET) {
+ brackets++;
+ continue;
+ }
+
+ if (next === CHAR_BACKSLASH) {
+ value += advance();
+ continue;
+ }
+
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
+ brackets--;
+
+ if (brackets === 0) {
+ break;
+ }
+ }
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Parentheses
+ */
+
+ if (value === CHAR_LEFT_PARENTHESES) {
+ block = push({ type: 'paren', nodes: [] });
+ stack.push(block);
+ push({ type: 'text', value });
+ continue;
+ }
+
+ if (value === CHAR_RIGHT_PARENTHESES) {
+ if (block.type !== 'paren') {
+ push({ type: 'text', value });
+ continue;
+ }
+ block = stack.pop();
+ push({ type: 'text', value });
+ block = stack[stack.length - 1];
+ continue;
+ }
+
+ /**
+ * Quotes: '|"|`
+ */
+
+ if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
+ let open = value;
+ let next;
+
+ if (options.keepQuotes !== true) {
+ value = '';
+ }
+
+ while (index < length && (next = advance())) {
+ if (next === CHAR_BACKSLASH) {
+ value += next + advance();
+ continue;
+ }
+
+ if (next === open) {
+ if (options.keepQuotes === true) value += next;
+ break;
+ }
+
+ value += next;
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Left curly brace: '{'
+ */
+
+ if (value === CHAR_LEFT_CURLY_BRACE) {
+ depth++;
+
+ let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
+ let brace = {
+ type: 'brace',
+ open: true,
+ close: false,
+ dollar,
+ depth,
+ commas: 0,
+ ranges: 0,
+ nodes: []
+ };
+
+ block = push(brace);
+ stack.push(block);
+ push({ type: 'open', value });
+ continue;
+ }
+
+ /**
+ * Right curly brace: '}'
+ */
+
+ if (value === CHAR_RIGHT_CURLY_BRACE) {
+ if (block.type !== 'brace') {
+ push({ type: 'text', value });
+ continue;
+ }
+
+ let type = 'close';
+ block = stack.pop();
+ block.close = true;
+
+ push({ type, value });
+ depth--;
+
+ block = stack[stack.length - 1];
+ continue;
+ }
+
+ /**
+ * Comma: ','
+ */
+
+ if (value === CHAR_COMMA && depth > 0) {
+ if (block.ranges > 0) {
+ block.ranges = 0;
+ let open = block.nodes.shift();
+ block.nodes = [open, { type: 'text', value: stringify(block) }];
+ }
+
+ push({ type: 'comma', value });
+ block.commas++;
+ continue;
+ }
+
+ /**
+ * Dot: '.'
+ */
+
+ if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
+ let siblings = block.nodes;
+
+ if (depth === 0 || siblings.length === 0) {
+ push({ type: 'text', value });
+ continue;
+ }
+
+ if (prev.type === 'dot') {
+ block.range = [];
+ prev.value += value;
+ prev.type = 'range';
+
+ if (block.nodes.length !== 3 && block.nodes.length !== 5) {
+ block.invalid = true;
+ block.ranges = 0;
+ prev.type = 'text';
+ continue;
+ }
+
+ block.ranges++;
+ block.args = [];
+ continue;
+ }
+
+ if (prev.type === 'range') {
+ siblings.pop();
+
+ let before = siblings[siblings.length - 1];
+ before.value += prev.value + value;
+ prev = before;
+ block.ranges--;
+ continue;
+ }
+
+ push({ type: 'dot', value });
+ continue;
+ }
+
+ /**
+ * Text
+ */
+
+ push({ type: 'text', value });
+ }
+
+ // Mark imbalanced braces and brackets as invalid
+ do {
+ block = stack.pop();
+
+ if (block.type !== 'root') {
+ block.nodes.forEach(node => {
+ if (!node.nodes) {
+ if (node.type === 'open') node.isOpen = true;
+ if (node.type === 'close') node.isClose = true;
+ if (!node.nodes) node.type = 'text';
+ node.invalid = true;
+ }
+ });
+
+ // get the location of the block on parent.nodes (block's siblings)
+ let parent = stack[stack.length - 1];
+ let index = parent.nodes.indexOf(block);
+ // replace the (invalid) block with it's nodes
+ parent.nodes.splice(index, 1, ...block.nodes);
+ }
+ } while (stack.length > 0);
+
+ push({ type: 'eos' });
+ return ast;
+};
+
+module.exports = parse;
diff --git a/node_modules/braces/lib/stringify.js b/node_modules/braces/lib/stringify.js
new file mode 100644
index 0000000..414b7bc
--- /dev/null
+++ b/node_modules/braces/lib/stringify.js
@@ -0,0 +1,32 @@
+'use strict';
+
+const utils = require('./utils');
+
+module.exports = (ast, options = {}) => {
+ let stringify = (node, parent = {}) => {
+ let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
+ let output = '';
+
+ if (node.value) {
+ if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
+ return '\\' + node.value;
+ }
+ return node.value;
+ }
+
+ if (node.value) {
+ return node.value;
+ }
+
+ if (node.nodes) {
+ for (let child of node.nodes) {
+ output += stringify(child);
+ }
+ }
+ return output;
+ };
+
+ return stringify(ast);
+};
+
diff --git a/node_modules/braces/lib/utils.js b/node_modules/braces/lib/utils.js
new file mode 100644
index 0000000..e3551a6
--- /dev/null
+++ b/node_modules/braces/lib/utils.js
@@ -0,0 +1,112 @@
+'use strict';
+
+exports.isInteger = num => {
+ if (typeof num === 'number') {
+ return Number.isInteger(num);
+ }
+ if (typeof num === 'string' && num.trim() !== '') {
+ return Number.isInteger(Number(num));
+ }
+ return false;
+};
+
+/**
+ * Find a node of the given type
+ */
+
+exports.find = (node, type) => node.nodes.find(node => node.type === type);
+
+/**
+ * Find a node of the given type
+ */
+
+exports.exceedsLimit = (min, max, step = 1, limit) => {
+ if (limit === false) return false;
+ if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
+ return ((Number(max) - Number(min)) / Number(step)) >= limit;
+};
+
+/**
+ * Escape the given node with '\\' before node.value
+ */
+
+exports.escapeNode = (block, n = 0, type) => {
+ let node = block.nodes[n];
+ if (!node) return;
+
+ if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
+ if (node.escaped !== true) {
+ node.value = '\\' + node.value;
+ node.escaped = true;
+ }
+ }
+};
+
+/**
+ * Returns true if the given brace node should be enclosed in literal braces
+ */
+
+exports.encloseBrace = node => {
+ if (node.type !== 'brace') return false;
+ if ((node.commas >> 0 + node.ranges >> 0) === 0) {
+ node.invalid = true;
+ return true;
+ }
+ return false;
+};
+
+/**
+ * Returns true if a brace node is invalid.
+ */
+
+exports.isInvalidBrace = block => {
+ if (block.type !== 'brace') return false;
+ if (block.invalid === true || block.dollar) return true;
+ if ((block.commas >> 0 + block.ranges >> 0) === 0) {
+ block.invalid = true;
+ return true;
+ }
+ if (block.open !== true || block.close !== true) {
+ block.invalid = true;
+ return true;
+ }
+ return false;
+};
+
+/**
+ * Returns true if a node is an open or close node
+ */
+
+exports.isOpenOrClose = node => {
+ if (node.type === 'open' || node.type === 'close') {
+ return true;
+ }
+ return node.open === true || node.close === true;
+};
+
+/**
+ * Reduce an array of text nodes.
+ */
+
+exports.reduce = nodes => nodes.reduce((acc, node) => {
+ if (node.type === 'text') acc.push(node.value);
+ if (node.type === 'range') node.type = 'text';
+ return acc;
+}, []);
+
+/**
+ * Flatten an array
+ */
+
+exports.flatten = (...args) => {
+ const result = [];
+ const flat = arr => {
+ for (let i = 0; i < arr.length; i++) {
+ let ele = arr[i];
+ Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
+ }
+ return result;
+ };
+ flat(args);
+ return result;
+};
diff --git a/node_modules/braces/package.json b/node_modules/braces/package.json
new file mode 100644
index 0000000..3f52e34
--- /dev/null
+++ b/node_modules/braces/package.json
@@ -0,0 +1,77 @@
+{
+ "name": "braces",
+ "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.",
+ "version": "3.0.2",
+ "homepage": "https://github.com/micromatch/braces",
+ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+ "contributors": [
+ "Brian Woodward (https://twitter.com/doowb)",
+ "Elan Shanker (https://github.com/es128)",
+ "Eugene Sharygin (https://github.com/eush77)",
+ "hemanth.hm (http://h3manth.com)",
+ "Jon Schlinkert (http://twitter.com/jonschlinkert)"
+ ],
+ "repository": "micromatch/braces",
+ "bugs": {
+ "url": "https://github.com/micromatch/braces/issues"
+ },
+ "license": "MIT",
+ "files": [
+ "index.js",
+ "lib"
+ ],
+ "main": "index.js",
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "mocha",
+ "benchmark": "node benchmark"
+ },
+ "dependencies": {
+ "fill-range": "^7.0.1"
+ },
+ "devDependencies": {
+ "ansi-colors": "^3.2.4",
+ "bash-path": "^2.0.1",
+ "gulp-format-md": "^2.0.0",
+ "mocha": "^6.1.1"
+ },
+ "keywords": [
+ "alpha",
+ "alphabetical",
+ "bash",
+ "brace",
+ "braces",
+ "expand",
+ "expansion",
+ "filepath",
+ "fill",
+ "fs",
+ "glob",
+ "globbing",
+ "letter",
+ "match",
+ "matches",
+ "matching",
+ "number",
+ "numerical",
+ "path",
+ "range",
+ "ranges",
+ "sh"
+ ],
+ "verb": {
+ "toc": false,
+ "layout": "default",
+ "tasks": [
+ "readme"
+ ],
+ "lint": {
+ "reflinks": true
+ },
+ "plugins": [
+ "gulp-format-md"
+ ]
+ }
+}
diff --git a/node_modules/concat-map/.travis.yml b/node_modules/concat-map/.travis.yml
new file mode 100644
index 0000000..f1d0f13
--- /dev/null
+++ b/node_modules/concat-map/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
diff --git a/node_modules/concat-map/LICENSE b/node_modules/concat-map/LICENSE
new file mode 100644
index 0000000..ee27ba4
--- /dev/null
+++ b/node_modules/concat-map/LICENSE
@@ -0,0 +1,18 @@
+This software is released under the MIT license:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/concat-map/README.markdown b/node_modules/concat-map/README.markdown
new file mode 100644
index 0000000..408f70a
--- /dev/null
+++ b/node_modules/concat-map/README.markdown
@@ -0,0 +1,62 @@
+concat-map
+==========
+
+Concatenative mapdashery.
+
+[](http://ci.testling.com/substack/node-concat-map)
+
+[](http://travis-ci.org/substack/node-concat-map)
+
+example
+=======
+
+``` js
+var concatMap = require('concat-map');
+var xs = [ 1, 2, 3, 4, 5, 6 ];
+var ys = concatMap(xs, function (x) {
+ return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
+});
+console.dir(ys);
+```
+
+***
+
+```
+[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
+```
+
+methods
+=======
+
+``` js
+var concatMap = require('concat-map')
+```
+
+concatMap(xs, fn)
+-----------------
+
+Return an array of concatenated elements by calling `fn(x, i)` for each element
+`x` and each index `i` in the array `xs`.
+
+When `fn(x, i)` returns an array, its result will be concatenated with the
+result array. If `fn(x, i)` returns anything else, that value will be pushed
+onto the end of the result array.
+
+install
+=======
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install concat-map
+```
+
+license
+=======
+
+MIT
+
+notes
+=====
+
+This module was written while sitting high above the ground in a tree.
diff --git a/node_modules/concat-map/example/map.js b/node_modules/concat-map/example/map.js
new file mode 100644
index 0000000..3365621
--- /dev/null
+++ b/node_modules/concat-map/example/map.js
@@ -0,0 +1,6 @@
+var concatMap = require('../');
+var xs = [ 1, 2, 3, 4, 5, 6 ];
+var ys = concatMap(xs, function (x) {
+ return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
+});
+console.dir(ys);
diff --git a/node_modules/concat-map/index.js b/node_modules/concat-map/index.js
new file mode 100644
index 0000000..b29a781
--- /dev/null
+++ b/node_modules/concat-map/index.js
@@ -0,0 +1,13 @@
+module.exports = function (xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ var x = fn(xs[i], i);
+ if (isArray(x)) res.push.apply(res, x);
+ else res.push(x);
+ }
+ return res;
+};
+
+var isArray = Array.isArray || function (xs) {
+ return Object.prototype.toString.call(xs) === '[object Array]';
+};
diff --git a/node_modules/concat-map/package.json b/node_modules/concat-map/package.json
new file mode 100644
index 0000000..d3640e6
--- /dev/null
+++ b/node_modules/concat-map/package.json
@@ -0,0 +1,43 @@
+{
+ "name" : "concat-map",
+ "description" : "concatenative mapdashery",
+ "version" : "0.0.1",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/substack/node-concat-map.git"
+ },
+ "main" : "index.js",
+ "keywords" : [
+ "concat",
+ "concatMap",
+ "map",
+ "functional",
+ "higher-order"
+ ],
+ "directories" : {
+ "example" : "example",
+ "test" : "test"
+ },
+ "scripts" : {
+ "test" : "tape test/*.js"
+ },
+ "devDependencies" : {
+ "tape" : "~2.4.0"
+ },
+ "license" : "MIT",
+ "author" : {
+ "name" : "James Halliday",
+ "email" : "mail@substack.net",
+ "url" : "http://substack.net"
+ },
+ "testling" : {
+ "files" : "test/*.js",
+ "browsers" : {
+ "ie" : [ 6, 7, 8, 9 ],
+ "ff" : [ 3.5, 10, 15.0 ],
+ "chrome" : [ 10, 22 ],
+ "safari" : [ 5.1 ],
+ "opera" : [ 12 ]
+ }
+ }
+}
diff --git a/node_modules/concat-map/test/map.js b/node_modules/concat-map/test/map.js
new file mode 100644
index 0000000..fdbd702
--- /dev/null
+++ b/node_modules/concat-map/test/map.js
@@ -0,0 +1,39 @@
+var concatMap = require('../');
+var test = require('tape');
+
+test('empty or not', function (t) {
+ var xs = [ 1, 2, 3, 4, 5, 6 ];
+ var ixes = [];
+ var ys = concatMap(xs, function (x, ix) {
+ ixes.push(ix);
+ return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
+ });
+ t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
+ t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
+ t.end();
+});
+
+test('always something', function (t) {
+ var xs = [ 'a', 'b', 'c', 'd' ];
+ var ys = concatMap(xs, function (x) {
+ return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
+ });
+ t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
+ t.end();
+});
+
+test('scalars', function (t) {
+ var xs = [ 'a', 'b', 'c', 'd' ];
+ var ys = concatMap(xs, function (x) {
+ return x === 'b' ? [ 'B', 'B', 'B' ] : x;
+ });
+ t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
+ t.end();
+});
+
+test('undefs', function (t) {
+ var xs = [ 'a', 'b', 'c', 'd' ];
+ var ys = concatMap(xs, function () {});
+ t.same(ys, [ undefined, undefined, undefined, undefined ]);
+ t.end();
+});
diff --git a/node_modules/cordova-android/CONTRIBUTING.md b/node_modules/cordova-android/CONTRIBUTING.md
new file mode 100644
index 0000000..bd2bb9f
--- /dev/null
+++ b/node_modules/cordova-android/CONTRIBUTING.md
@@ -0,0 +1,37 @@
+
+
+# Contributing to Apache Cordova
+
+Anyone can contribute to Cordova. And we need your contributions.
+
+There are multiple ways to contribute: report bugs, improve the docs, and
+contribute code.
+
+For instructions on this, start with the
+[contribution overview](http://cordova.apache.org/contribute/).
+
+The details are explained there, but the important items are:
+ - Check for Github issues that corresponds to your contribution and link or create them if necessary.
+ - Run the tests so your patch doesn't break existing functionality.
+
+We look forward to your contributions!
+
diff --git a/node_modules/cordova-android/LICENSE b/node_modules/cordova-android/LICENSE
new file mode 100644
index 0000000..c2f944b
--- /dev/null
+++ b/node_modules/cordova-android/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2015-2020 Apache Cordova
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/node_modules/cordova-android/NOTICE b/node_modules/cordova-android/NOTICE
new file mode 100644
index 0000000..2ce6eee
--- /dev/null
+++ b/node_modules/cordova-android/NOTICE
@@ -0,0 +1,5 @@
+Apache Cordova
+Copyright 2015-2020 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/node_modules/cordova-android/README.md b/node_modules/cordova-android/README.md
new file mode 100644
index 0000000..982d72d
--- /dev/null
+++ b/node_modules/cordova-android/README.md
@@ -0,0 +1,71 @@
+
+
+# Cordova Android
+
+[](https://nodei.co/npm/cordova-android/)
+
+[](https://github.com/apache/cordova-android/actions?query=branch%3Amaster)
+[](https://codecov.io/github/apache/cordova-android?branch=master)
+
+Cordova Android is an Android application library that allows for Cordova-based projects to be built for the Android Platform. Cordova based applications are, at the core, applications written with web technology: HTML, CSS and JavaScript.
+
+[Apache Cordova](https://cordova.apache.org/) is a project of [The Apache Software Foundation (ASF)](https://apache.org/).
+
+## Requirements
+
+* Java Development Kit (JDK) 11
+* [Android SDK](https://developer.android.com/)
+* [Node.js](https://nodejs.org)
+
+## Create a Cordova project
+
+Follow the instructions in the [**Create your first Cordova app**](https://cordova.apache.org/docs/en/latest/guide/cli/index.html) section of [Apache Cordova Docs](https://cordova.apache.org/docs/en/latest/)
+
+To use a **shared framework**, for example in development, link the appropriate cordova-android platform folder path:
+
+```bash
+cordova platform add --link /path/to/cordova-android
+```
+
+## Updating a Cordova project
+
+When you install a new version of the [`Cordova CLI`](https://www.npmjs.com/package/cordova) that pins a new version of the [`Cordova-Android`](https://www.npmjs.com/package/cordova-android) platform, you can follow these simple upgrade steps within your project:
+
+```bash
+cordova platform rm android
+cordova platform add android
+```
+
+## Debugging in Android Studio
+
+Import project in Android Studio through _File > Open_ and targeting `/path/to/your-cdv-project/platforms/android/`.
+
+## How to Test Repo Development
+
+```bash
+npm install
+npm test
+```
+
+## Further reading
+
+* [Apache Cordova](https://cordova.apache.org/)
diff --git a/node_modules/cordova-android/RELEASENOTES.md b/node_modules/cordova-android/RELEASENOTES.md
new file mode 100644
index 0000000..63ad850
--- /dev/null
+++ b/node_modules/cordova-android/RELEASENOTES.md
@@ -0,0 +1,1073 @@
+
+## Release Notes for Cordova (Android)
+
+### 10.1.2 (Apr 11, 2022)
+
+**Fixes:**
+
+* [GH-1372](https://github.com/apache/cordova-android/pull/1372) fix(`AndroidManifest`): explicitly define the `activity` attribute `android:exported`
+* [GH-1406](https://github.com/apache/cordova-android/pull/1406) fix: detect `JAVA_HOME` with Java 11
+* [GH-1401](https://github.com/apache/cordova-android/pull/1401) fix(GH-1391): Reword minimum build tools version to make it more clear what is actually required.
+* [GH-1384](https://github.com/apache/cordova-android/pull/1384) fix: escape `strings.xml` app name
+
+**Chores:**
+
+* [GH-1413](https://github.com/apache/cordova-android/pull/1413) chore: update `package-lock` to satisfy `npm audit`
+* [GH-1348](https://github.com/apache/cordova-android/pull/1348) chore: `npmrc`
+
+### 10.1.1 (Sep 13, 2021)
+
+**Fixes:**
+
+* [GH-1349](https://github.com/apache/cordova-android/pull/1349) fix(`PluginManager`): `AllowNavigation` default policy to handle scheme & hostname
+* [GH-1342](https://github.com/apache/cordova-android/pull/1342) fix(`AllowListPlugin`): Safely handle default allow navigation policy in allow request
+* [GH-1332](https://github.com/apache/cordova-android/pull/1332) fix(`PluginManager`): `AllowBridgeAccess` default policy to handle scheme & hostname
+
+### 10.1.0 (Aug 13, 2021)
+
+**Features:**
+
+* [GH-1213](https://github.com/apache/cordova-android/pull/1213) feat: unify `create` default values & stop project name transform
+* [GH-1306](https://github.com/apache/cordova-android/pull/1306) feat: bump `ANDROIDX_APP_COMPAT@1.3.1`
+* [GH-1303](https://github.com/apache/cordova-android/pull/1303) feat: bump `Google Services Gradle Plugin@4.3.8`
+* [GH-1302](https://github.com/apache/cordova-android/pull/1302) feat: bump `kotlin@1.5.21`
+* [GH-1298](https://github.com/apache/cordova-android/pull/1298) feat: support `http` w/ `content` `src` fix
+
+**Fixes:**
+
+* [GH-1214](https://github.com/apache/cordova-android/pull/1214) fix: display project name in Android Studio
+* [GH-1300](https://github.com/apache/cordova-android/pull/1300) fix: fall back to project root `repositories.gradle`
+
+**Docs:**
+
+* [GH-1308](https://github.com/apache/cordova-android/pull/1308) doc: update `README` about development & testing
+
+### 10.0.1 (Jul 27, 2021)
+
+**Fixes:**
+
+* [GH-1295](https://github.com/apache/cordova-android/pull/1295) fix: `maven-publish` setup
+* [GH-1293](https://github.com/apache/cordova-android/pull/1293) fix: `gradle` build tools config
+* [GH-1294](https://github.com/apache/cordova-android/pull/1294) fix: automatic latest build tools finding
+* [GH-1287](https://github.com/apache/cordova-android/pull/1287) fix: Google Services Gradle Plugin version check failure
+
+**Chores:**
+
+* [GH-1291](https://github.com/apache/cordova-android/pull/1291) chore: add missing release notes
+* [GH-1286](https://github.com/apache/cordova-android/pull/1286) chore: update `README` requirements
+
+### 10.0.0 (Jul 17, 2021)
+
+**Breaking:**
+
+* [GH-1052](https://github.com/apache/cordova-android/pull/1052) feat!: only support `AndroidX`
+* [GH-1137](https://github.com/apache/cordova-android/pull/1137) feat!: implement `WebViewAssetLoader`
+* [GH-1268](https://github.com/apache/cordova-android/pull/1268) feat!: release build defaults to `aab` package type
+* [GH-1182](https://github.com/apache/cordova-android/pull/1182) feat!: bump `target sdk@30` w/ `build-tool@30.0.3`
+* [GH-1257](https://github.com/apache/cordova-android/pull/1257) feat!: upgrade `gradle@7.1.1`
+* [GH-1197](https://github.com/apache/cordova-android/pull/1197) feat!: upgrade `gradle@6.8.3`
+* [GH-1256](https://github.com/apache/cordova-android/pull/1256) feat!: upgrade `kotlin@1.5.20`
+* [GH-1204](https://github.com/apache/cordova-android/pull/1204) feat!: upgrade `kotlin@1.4.32`
+* [GH-1200](https://github.com/apache/cordova-android/pull/1200) feat!: upgrade `kotlin@1.4.31`
+* [GH-1255](https://github.com/apache/cordova-android/pull/1255) feat!: upgrade `android-gradle-plugin@4.2.2`
+* [GH-1232](https://github.com/apache/cordova-android/pull/1232) feat!: upgrade `android-gradle-plugin@4.2.1`
+* [GH-1198](https://github.com/apache/cordova-android/pull/1198) feat!: upgrade `android-gradle-plugin@4.1.3`
+* [GH-1199](https://github.com/apache/cordova-android/pull/1199) feat!: upgrade `Google Services Gradle Plugin@4.3.5`
+* [GH-1262](https://github.com/apache/cordova-android/pull/1262) feat!: bump `appcompat@1.3.0`
+* [GH-1258](https://github.com/apache/cordova-android/pull/1258) feat!: bump `android.webkit@1.4.0`
+* [GH-1252](https://github.com/apache/cordova-android/pull/1252) feat!: drop abandoned `com.github.dcendents:android-maven-gradle-plugin`
+* [GH-1212](https://github.com/apache/cordova-android/pull/1212) feat!: unify & fix gradle library/tooling overrides
+* [GH-1138](https://github.com/apache/cordova-android/pull/1138) feat(allow-list)!: integrate and refactor core plugin
+* [GH-1201](https://github.com/apache/cordova-android/pull/1201) feat!: upgrade jfrog `gradle-bintray-plugin@1.8.5`
+* [GH-1279](https://github.com/apache/cordova-android/pull/1279) chore!: bump all dependencies
+* [GH-1278](https://github.com/apache/cordova-android/pull/1278) chore!: drop `node` 10 support
+* [GH-1205](https://github.com/apache/cordova-android/pull/1205) chore! (`npm`): update all dependencies
+* [GH-1274](https://github.com/apache/cordova-android/pull/1274) cleanup!: remove deprecated settings & add todo comments
+* [GH-1048](https://github.com/apache/cordova-android/pull/1048) cleanup!: remove `keystore` password prompt
+* [GH-1251](https://github.com/apache/cordova-android/pull/1251) cleanup!: drop `jcenter` & update dependencies
+* [GH-1269](https://github.com/apache/cordova-android/pull/1269) refactor!: do not copy JS lib to platform project
+* [GH-1270](https://github.com/apache/cordova-android/pull/1270) refactor(Api)!: use version from `package.json`
+* [GH-1266](https://github.com/apache/cordova-android/pull/1266) refactor(run)!: `run` method
+* [GH-1083](https://github.com/apache/cordova-android/pull/1083) refactor!: drop support for `android` SDK tool
+* [GH-1100](https://github.com/apache/cordova-android/pull/1100) refactor!: remove most platform binaries
+
+**Features:**
+
+* [GH-1241](https://github.com/apache/cordova-android/pull/1241) feat: remove `java` 1.8 version check
+* [GH-1254](https://github.com/apache/cordova-android/pull/1254) feat: support `webkit` version override
+* [GH-1229](https://github.com/apache/cordova-android/pull/1229) feat: `CORDOVA_JAVA_HOME` env variable
+* [GH-1222](https://github.com/apache/cordova-android/pull/1222) feat: add backwards compatibility mode for `WebViewAssetLoader`
+* [GH-1166](https://github.com/apache/cordova-android/pull/1166) feat: overload `PluginEntry` constructor to set onload property
+* [GH-1208](https://github.com/apache/cordova-android/pull/1208) feat: allow `appcompat` version to be configurable
+* [GH-1047](https://github.com/apache/cordova-android/pull/1047) feat: Deprecated `onRequestPermissionResult` in favour for `onRequestPermissionsResult` for consistency
+
+**Fixes:**
+
+* [GH-1283](https://github.com/apache/cordova-android/pull/1283) fix: add missing apache-license header to `getASPath.bat`
+* [GH-1275](https://github.com/apache/cordova-android/pull/1275) fix: add `WebViewAssetloader` to default allow list
+* [GH-1216](https://github.com/apache/cordova-android/pull/1216) fix: request focus after custom view hided
+* [GH-1264](https://github.com/apache/cordova-android/pull/1264) fix: missing `super.onRequestPermissionsResult` error (`MissingSuperCall`)
+* [GH-563](https://github.com/apache/cordova-android/pull/563) fix(build): support tilde expansion on Windows
+* [GH-1220](https://github.com/apache/cordova-android/pull/1220) fix(`requirements` check): use regex to get java version from javac output
+* [GH-1227](https://github.com/apache/cordova-android/pull/1227) fix(prepare): delete splash screens if none are used
+* [GH-1228](https://github.com/apache/cordova-android/pull/1228) fix: java checks
+* [GH-1276](https://github.com/apache/cordova-android/pull/1276) fix: remove forced default `gradle.daemon` setting
+
+**Refactors:**
+
+* [GH-1265](https://github.com/apache/cordova-android/pull/1265) refactor: do not infer project root from script location
+* [GH-1267](https://github.com/apache/cordova-android/pull/1267) refactor: use target SDK of built APK to determine best emulator
+* [GH-1253](https://github.com/apache/cordova-android/pull/1253) refactor: `gradle` cleanup
+* [GH-1260](https://github.com/apache/cordova-android/pull/1260) refactor(`check_reqs`): drop `originalError` param from `check_android_target`
+* [GH-1246](https://github.com/apache/cordova-android/pull/1246) refactor(`env/java`): improve tests and implementation
+
+**Chores & Cleanup:**
+
+* [GH-1273](https://github.com/apache/cordova-android/pull/1273) chore: remove old `VERSION` file
+* [GH-1272](https://github.com/apache/cordova-android/pull/1272) cleanup: delete old ANT & Eclipse files
+* [GH-1141](https://github.com/apache/cordova-android/pull/1141) cleanup: remove app cache settings
+
+**CI, Build & Testing:**
+
+* [GH-1218](https://github.com/apache/cordova-android/pull/1218) ci: Add `Node16` to CI matrix
+* [GH-1271](https://github.com/apache/cordova-android/pull/1271) build: build `cordova.js` during npm prepare
+* [GH-1207](https://github.com/apache/cordova-android/pull/1207) test(`AndroidManifest`): update theme to `Theme.AppCompat.NoActionBar`
+* [GH-1263](https://github.com/apache/cordova-android/pull/1263) test(`check_reqs`): do not hardcode `DEFAULT_TARGET_API`
+* [GH-1259](https://github.com/apache/cordova-android/pull/1259) test(`prepare`): factor out common vars
+
+### 9.1.0 (Apr 09, 2021)
+
+**Features:**
+
+* [GH-1104](https://github.com/apache/cordova-android/pull/1104) feat: support `gzip` encoding requests & use `GZIPInputStream`
+* [GH-1167](https://github.com/apache/cordova-android/pull/1167) feat: handle `intent://` scheme links with `browser_fallback_url` param
+* [GH-1179](https://github.com/apache/cordova-android/pull/1179) feat: add `repositories` support
+* [GH-1173](https://github.com/apache/cordova-android/pull/1173) feat(android-studio): display app name as project name
+* [GH-1113](https://github.com/apache/cordova-android/pull/1113) feat: `webp` support for splashscreen
+* [GH-1125](https://github.com/apache/cordova-android/pull/1125) feat(Adb): list `devices` _and_ `emulators` in one go
+
+**Fixes:**
+
+* [GH-1186](https://github.com/apache/cordova-android/pull/1186) fix: copy `repositories.gradle` to project on create
+* [GH-1184](https://github.com/apache/cordova-android/pull/1184) fix: unit-test failure
+* [GH-733](https://github.com/apache/cordova-android/pull/733) fix(splashscreen): nav & title bar showing in fullscreen mode
+* [GH-1157](https://github.com/apache/cordova-android/pull/1157) fix: restore key event handlers when DOM element is fullscreen
+* [GH-1073](https://github.com/apache/cordova-android/pull/1073) fix(android): Avoid Crash Report: ConcurrentModificationException
+* [GH-1148](https://github.com/apache/cordova-android/pull/1148) fix: add not null checks to prevent running on destroyed activity
+* [GH-1091](https://github.com/apache/cordova-android/pull/1091) fix: concurrent modification exception (#924)
+* [GH-1153](https://github.com/apache/cordova-android/pull/1153) fix: optional arch parameter
+* [GH-1136](https://github.com/apache/cordova-android/pull/1136) fix(prepare): `mapImageResources` always returning `[]`
+* [GH-1111](https://github.com/apache/cordova-android/pull/1111) fix(android): allow file access for existing behavior
+* [GH-1045](https://github.com/apache/cordova-android/pull/1045) fix: Reflect minimum required NodeJS
+* [GH-1084](https://github.com/apache/cordova-android/pull/1084) fix(prepare): fix pattern used to collect image resources
+* [GH-1014](https://github.com/apache/cordova-android/pull/1014) fix(`pluginHandlers`): properly check if path is inside another
+* [GH-1018](https://github.com/apache/cordova-android/pull/1018) fix: gradle ignore properties
+* [GH-1185](https://github.com/apache/cordova-android/pull/1185) fix(regression): Cannot read version of undefined caused by Java refactor
+* [GH-1117](https://github.com/apache/cordova-android/pull/1117) fix: allow changing min sdk version
+
+**Refactors:**
+
+* [GH-1101](https://github.com/apache/cordova-android/pull/1101) refactor: unify target resolution for devices & emulators
+* [GH-1130](https://github.com/apache/cordova-android/pull/1130) refactor: java checks
+* [GH-1099](https://github.com/apache/cordova-android/pull/1099) refactor(`ProjectBuilder`): clean up output file collection code
+* [GH-1123](https://github.com/apache/cordova-android/pull/1123) refactor: unify installation on devices & emulators
+* [GH-1102](https://github.com/apache/cordova-android/pull/1102) refactor(`check_reqs`): cleanup default Java location detection on **Windows**
+* [GH-1103](https://github.com/apache/cordova-android/pull/1103) refactor: do not kill adb on UNIX-like systems
+* [GH-1086](https://github.com/apache/cordova-android/pull/1086) refactor(retry): simplify retryPromise using modern JS
+* [GH-1085](https://github.com/apache/cordova-android/pull/1085) refactor(utils): reduce number of utils
+* [GH-1046](https://github.com/apache/cordova-android/pull/1046) refactor: Stop suppressing un-needed TruelyRandom lints
+* [GH-1016](https://github.com/apache/cordova-android/pull/1016) refactor: save `ProjectBuilder` instance in Api instance
+* [GH-1108](https://github.com/apache/cordova-android/pull/1108) refactor: remove copied Adb.install from `emulator.install`
+
+**Chores:**
+
+* [GH-1196](https://github.com/apache/cordova-android/pull/1196) chore: add missing header license
+* chore(asf): Update GitHub repo metadata
+* [GH-1183](https://github.com/apache/cordova-android/pull/1183) chore: rebuilt package-lock
+* [GH-1015](https://github.com/apache/cordova-android/pull/1015) chore: remove unnecessary stuff
+* [GH-1081](https://github.com/apache/cordova-android/pull/1081) chore(pkg): remove deprecated `no-op` field `"engineStrict"`
+* [GH-1019](https://github.com/apache/cordova-android/pull/1019) chore: remove unused `emulator.create_image` and its dependencies
+
+**Tests & CI:**
+
+* [GH-1017](https://github.com/apache/cordova-android/pull/1017) test(java): fix, improve and move clean script
+* [GH-1012](https://github.com/apache/cordova-android/pull/1012) test: fix missing stack traces in jasmine output
+* [GH-1013](https://github.com/apache/cordova-android/pull/1013) test(`pluginHandlers/common`): better setup & teardown
+* [GH-1094](https://github.com/apache/cordova-android/pull/1094) test: fix unit test failures for certain random orders
+* [GH-1094](https://github.com/apache/cordova-android/pull/1094) test: ensure single top-level describe block in test file
+* [GH-1129](https://github.com/apache/cordova-android/pull/1129) test(java): remove duplicate code in `BackButtonMultipageTest`
+* [GH-975](https://github.com/apache/cordova-android/pull/975) ci: Added Node 14.x
+
+### 9.0.0 (Jun 23, 2020)
+
+* [GH-1005](https://github.com/apache/cordova-android/pull/1005) chore: set AndroidX off by default
+* [GH-971](https://github.com/apache/cordova-android/pull/971) fix: Accept multiple mime types on file input
+* [GH-1001](https://github.com/apache/cordova-android/pull/1001) fix: support both adaptive and standard icons at the same time
+* [GH-985](https://github.com/apache/cordova-android/pull/985) fix: Plugin install fails when preview sdk is installed
+* [GH-994](https://github.com/apache/cordova-android/pull/994) chore: cleanup yaml files
+* [GH-999](https://github.com/apache/cordova-android/pull/999) chore: remove trailing spaces from Java sources
+* [GH-992](https://github.com/apache/cordova-android/pull/992) chore: update some dependencies
+* [GH-998](https://github.com/apache/cordova-android/pull/998) chore: remove trailing spaces from framework build files
+* [GH-997](https://github.com/apache/cordova-android/pull/997) chore: remove trailing spaces from project template
+* [GH-996](https://github.com/apache/cordova-android/pull/996) chore: remove trailing spaces from bat files
+* [GH-995](https://github.com/apache/cordova-android/pull/995) remove trailing spaces from markdown files
+* [GH-993](https://github.com/apache/cordova-android/pull/993) chore: update `devDependencies`
+* [GH-987](https://github.com/apache/cordova-android/pull/987) breaking: reduce combined response cutoff to 16 MB
+* [GH-988](https://github.com/apache/cordova-android/pull/988) major: Gradle 6.5 & **Android** Gradle plugin 4.0.0 updates
+* [GH-990](https://github.com/apache/cordova-android/pull/990) chore: remove trailing spaces from `app/build.gradle`
+* [GH-989](https://github.com/apache/cordova-android/pull/989) breaking: remove `legacy/build.gradle` from template
+* [GH-978](https://github.com/apache/cordova-android/pull/978) fix: `wait_for_boot` waiting forever
+* [GH-965](https://github.com/apache/cordova-android/pull/965) fix: Increased `detectArchitecture()` timeout
+* [GH-962](https://github.com/apache/cordova-android/pull/962) breaking: Bump **Android** gradle plugin to 3.6.0
+* [GH-948](https://github.com/apache/cordova-android/pull/948) feature: JVM Args flag
+* [GH-951](https://github.com/apache/cordova-android/pull/951) fix: `ANDROID_SDK_ROOT` variable
+* [GH-959](https://github.com/apache/cordova-android/pull/959) test: synced AndroidX gradle versions to the same version as the **Android** test
+* [GH-960](https://github.com/apache/cordova-android/pull/960) feat: `com.android.tools.build:gradle:3.5.3`
+* [GH-956](https://github.com/apache/cordova-android/pull/956) chore(npm): add `package-lock.json`
+* [GH-958](https://github.com/apache/cordova-android/pull/958) chore(npm): add ignore list
+* [GH-957](https://github.com/apache/cordova-android/pull/957) chore: various cleanup
+* [GH-955](https://github.com/apache/cordova-android/pull/955) chore(eslint): bump package & apply eslint fix
+* [GH-954](https://github.com/apache/cordova-android/pull/954) breaking(npm): bump packages
+* [GH-953](https://github.com/apache/cordova-android/pull/953) chore(npm): use short notation in `package.json`
+* [GH-823](https://github.com/apache/cordova-android/pull/823) fix: prevent exit fullscreen mode from closing application
+* [GH-950](https://github.com/apache/cordova-android/pull/950) fix: removed redundent logcat print
+* [GH-915](https://github.com/apache/cordova-android/pull/915) breaking: bump minSdkVersion to 22 and drop pre-Lollipop specific code
+* [GH-941](https://github.com/apache/cordova-android/pull/941) fix: GH-873 App bundle builds to obey command-line arguments
+* [GH-940](https://github.com/apache/cordova-android/pull/940) ci: drop travis & move codecov to gh-actions
+* [GH-929](https://github.com/apache/cordova-android/pull/929) chore: updated `README` to reflect what **Android** requires more accurately, which is Java 8, not anything less, not anything greater. Java 1.8.x is required.
+* [GH-937](https://github.com/apache/cordova-android/pull/937) fix: GH-935 replaced `compare-func` with native sort method
+* [GH-939](https://github.com/apache/cordova-android/pull/939) fix: test failure with shebang interpreter in `rewired` files
+* [GH-911](https://github.com/apache/cordova-android/pull/911) refactor: use es6 class
+* [GH-910](https://github.com/apache/cordova-android/pull/910) refactor (eslint): use `cordova-eslint`
+* [GH-909](https://github.com/apache/cordova-android/pull/909) chore: remove appveyor residual
+* [GH-895](https://github.com/apache/cordova-android/pull/895) feat: add github actions
+* [GH-842](https://github.com/apache/cordova-android/pull/842) refactor: remove `shelljs` dependency
+* [GH-896](https://github.com/apache/cordova-android/pull/896) feat: add Kotlin support
+* [GH-901](https://github.com/apache/cordova-android/pull/901) feat: add AndroidX support
+* [GH-849](https://github.com/apache/cordova-android/pull/849) fix: cordova requirements consider the `android-targetSdkVersion`
+* [GH-904](https://github.com/apache/cordova-android/pull/904) fix (adb): shell to return expected stdout
+* [GH-792](https://github.com/apache/cordova-android/pull/792) feat: upgrade `gradle` to 6.1 & gradle build tools to 3.5.3
+* [GH-902](https://github.com/apache/cordova-android/pull/902) chore: remove `.project` file & add `.settings` to `gitignore`
+* [GH-900](https://github.com/apache/cordova-android/pull/900) refactor: simplify `doFindLatestInstalledBuildTools`
+* [GH-751](https://github.com/apache/cordova-android/pull/751) feat: use Java package name for loading `BuildConfig`
+* [GH-898](https://github.com/apache/cordova-android/pull/898) chore: rename gradle plugin google services `preference` options
+* [GH-893](https://github.com/apache/cordova-android/pull/893) feat: add Google Services support
+* [GH-709](https://github.com/apache/cordova-android/pull/709) feat: add `version-compare` library to compare `build-tools` versions properly.
+* [GH-831](https://github.com/apache/cordova-android/pull/831) chore: ignore auto-generated eclipse buildship files
+* [GH-848](https://github.com/apache/cordova-android/pull/848) breaking: increased default target sdk to 29
+* [GH-859](https://github.com/apache/cordova-android/pull/859) breaking: removed unnecessary project name restriction
+* [GH-833](https://github.com/apache/cordova-android/pull/833) chore: drop `q` module
+* [GH-862](https://github.com/apache/cordova-android/pull/862) chore: replace `superspawn` & `child_process` with `execa`
+* [GH-860](https://github.com/apache/cordova-android/pull/860) feat: don't filter gradle's stderr anymore
+* [GH-832](https://github.com/apache/cordova-android/pull/832) chore: drop node 6 and 8 support
+* [GH-890](https://github.com/apache/cordova-android/pull/890) chore: bump version to 9.0.0-dev
+* [GH-697](https://github.com/apache/cordova-android/pull/697) chore: optimization code
+* [GH-863](https://github.com/apache/cordova-android/pull/863) chore: removed comment that serves no purpose
+* [GH-861](https://github.com/apache/cordova-android/pull/861) chore: update `jasmine` to 3.5.0
+* [GH-858](https://github.com/apache/cordova-android/pull/858) chore: modernize our one E2E test
+* [GH-854](https://github.com/apache/cordova-android/pull/854) chore: ensure to lint as many files as possible
+
+### 8.1.0 (Sep 11, 2019)
+
+* [GH-827](https://github.com/apache/cordova-android/pull/827) chore: bump dependencies for release 8.1.0
+* [GH-651](https://github.com/apache/cordova-android/pull/651) feat: added multiple selection for filepicker
+* [GH-672](https://github.com/apache/cordova-android/pull/672) chore: compress files in /res with tinypng.com
+* [GH-815](https://github.com/apache/cordova-android/pull/815) fix: `clean` command
+* [GH-750](https://github.com/apache/cordova-android/pull/750) Don't request focus explicitly if not needed
+* [GH-800](https://github.com/apache/cordova-android/pull/800) [GH-799](https://github.com/apache/cordova-android/pull/799) (android) Stop webview from restarting when activity resizes
+* [GH-764](https://github.com/apache/cordova-android/pull/764) feat: Build app bundles (.aab files)
+* [GH-788](https://github.com/apache/cordova-android/pull/788) Simplify `apkSorter` using `compare-func` package
+* [GH-787](https://github.com/apache/cordova-android/pull/787) Simplify and fix promise handling in specs
+* [GH-784](https://github.com/apache/cordova-android/pull/784) Properly handle promise in create script
+* [GH-783](https://github.com/apache/cordova-android/pull/783) Do not clobber process properties with test mocks
+* [GH-782](https://github.com/apache/cordova-android/pull/782) Do not clobber `console.log` to spy on it
+* [GH-724](https://github.com/apache/cordova-android/pull/724) Add Node.js 12 to CI Services
+* [GH-777](https://github.com/apache/cordova-android/pull/777) ci(travis): set `dist: trusty` in `.travis.yml`
+* [GH-779](https://github.com/apache/cordova-android/pull/779) Consistent order from `ProjectBuilder.apkSorter`
+* [GH-778](https://github.com/apache/cordova-android/pull/778) test: use verbose spec reporter
+* [GH-774](https://github.com/apache/cordova-android/pull/774) `rewire` workaround for NodeJS 12
+* [GH-772](https://github.com/apache/cordova-android/pull/772) `nyc@14` update in devDependencies
+* [GH-765](https://github.com/apache/cordova-android/pull/765) ci(travis): Fix **Android** SDK
+* [GH-713](https://github.com/apache/cordova-android/pull/713) Do not explicitly require modules from project directory
+* [GH-676](https://github.com/apache/cordova-android/pull/676) Added allprojects repositories for Framework Release Builds
+* [GH-699](https://github.com/apache/cordova-android/pull/699) Improve Gradle Build Arguments
+* [GH-710](https://github.com/apache/cordova-android/pull/710) Fix deprecation warning in `SystemCookieManager`
+* [GH-691](https://github.com/apache/cordova-android/pull/691) [GH-690](https://github.com/apache/cordova-android/pull/690): Run `prepare` with the correct `ConfigParser`
+* [GH-673](https://github.com/apache/cordova-android/pull/673) Updated `Android_HOME` Test to Follow [GH-656](https://github.com/apache/cordova-android/pull/656) Change
+
+### 8.0.0 (Feb 13, 2019)
+* [GH-669](https://github.com/apache/cordova-android/pull/669) Added Missing License Headers
+* [GH-655](https://github.com/apache/cordova-android/pull/655) Use custom Gradle properties to read minSdkVersion value from `config.xml`
+* [GH-656](https://github.com/apache/cordova-android/pull/656) Quick fix to support **Android**_SDK_ROOT
+* [GH-632](https://github.com/apache/cordova-android/pull/632) Ignore more Gradle build artifacts in **Android** project
+* [GH-642](https://github.com/apache/cordova-android/pull/642) **Android** tools 3.3 & **Gradle** 4.10.3 update
+* [GH-654](https://github.com/apache/cordova-android/pull/654) Quick updates to top-level `project.properties`
+* [GH-635](https://github.com/apache/cordova-android/pull/635) Ignore **Android** Studio `.idea` files in project
+* [GH-624](https://github.com/apache/cordova-android/pull/624) Add missing log to Java version check
+* [GH-630](https://github.com/apache/cordova-android/pull/630) Update `emulator.js` to fix issue [GH-608](https://github.com/apache/cordova-android/pull/608)
+* [GH-626](https://github.com/apache/cordova-android/pull/626) Added `package-lock.json` to `.gitignore`
+* [GH-620](https://github.com/apache/cordova-android/pull/620) Fix requirements error messages for JDK 8
+* [GH-619](https://github.com/apache/cordova-android/pull/619) javac error message fixes in requirements check
+* [GH-612](https://github.com/apache/cordova-android/pull/612) Android Platform Release Preparation (Cordova 9)
+* [GH-607](https://github.com/apache/cordova-android/pull/607) Copy `node_modules` if the directory exists
+* [GH-582](https://github.com/apache/cordova-android/pull/582) Improve Test `README`
+* [GH-589](https://github.com/apache/cordova-android/pull/589) Rewrite install dir resolution for legacy plugins
+* [GH-572](https://github.com/apache/cordova-android/pull/572) Resolve issue with plugin `target-dir="app*"` subdirs
+* [GH-567](https://github.com/apache/cordova-android/pull/567) Output current package name if package name can't be validated
+* [GH-507](https://github.com/apache/cordova-android/pull/507) Gradle Updates
+* [GH-559](https://github.com/apache/cordova-android/pull/559) Eslint ignore version file
+* [GH-550](https://github.com/apache/cordova-android/pull/550) Fix for old plugins with non-Java sources
+* [GH-558](https://github.com/apache/cordova-android/pull/558) Update `cordova.js` from `cordova-js@4.2.3`
+* [GH-553](https://github.com/apache/cordova-android/pull/553) Check for `build-extras.gradle` in the app-parent directory
+* [GH-551](https://github.com/apache/cordova-android/pull/551) Add missing cast for `cdvMinSdkVersion`
+* [GH-539](https://github.com/apache/cordova-android/pull/539) Fix destination path fallback
+* [GH-544](https://github.com/apache/cordova-android/pull/544) Remove obsolete check for JellyBean
+* [GH-465](https://github.com/apache/cordova-android/pull/465) Removes Gradle property in-line command arguments for `gradle.properties`
+* [GH-523](https://github.com/apache/cordova-android/pull/523) Always put the Google repo above jcenter
+* [GH-486](https://github.com/apache/cordova-android/pull/486) Change deprecated "compile" to "implementation"
+* [GH-495](https://github.com/apache/cordova-android/pull/495) Incorrect default sdk version issue fix
+* [GH-493](https://github.com/apache/cordova-android/pull/493) Remove bundled dependencies
+* [GH-490](https://github.com/apache/cordova-android/pull/490) Fixes build & run related bugs from builder refactor
+* [GH-464](https://github.com/apache/cordova-android/pull/464) Unit tests for **Android**_sdk and **Android**Project
+* [GH-448](https://github.com/apache/cordova-android/pull/448) [CB-13685](https://issues.apache.org/jira/browse/CB-13685) Adaptive Icon Support
+* [GH-487](https://github.com/apache/cordova-android/pull/487) Do not attempt an activity intent AND a url load into the webview, return from the internal webview load.
+* [GH-461](https://github.com/apache/cordova-android/pull/461) Remove old builders code
+* [GH-463](https://github.com/apache/cordova-android/pull/463) Emulator: Add unit tests and remove Q
+* [GH-462](https://github.com/apache/cordova-android/pull/462) Device: Add unit tests and remove Q
+* [GH-457](https://github.com/apache/cordova-android/pull/457) Emulator: handle "device still connecting" error
+* [GH-445](https://github.com/apache/cordova-android/pull/445) Run and retryPromise improvements and tests
+* [GH-453](https://github.com/apache/cordova-android/pull/453) Lint JS files w/out extension too
+* [GH-452](https://github.com/apache/cordova-android/pull/452) Emit log event instead of logging directly
+* [GH-449](https://github.com/apache/cordova-android/pull/449) Increase old plugin compatibility
+* [GH-442](https://github.com/apache/cordova-android/pull/442) Fixes and cleanup for Java tests and CI
+* [GH-446](https://github.com/apache/cordova-android/pull/446) [CB-14101](https://issues.apache.org/jira/browse/CB-14101) Fix Java version check for Java >= 9
+* [CB-14127](https://issues.apache.org/jira/browse/CB-14127) Move google maven repo ahead of jcenter
+* [CB-14038](https://issues.apache.org/jira/browse/CB-14038) Fix false positive detecting project type
+* [CB-14008](https://issues.apache.org/jira/browse/CB-14008) Updating Gradle Libraries to work with **Android** Studio 3.1.0
+* [CB-13975](https://issues.apache.org/jira/browse/CB-13975) Fix to fire pause event when cdvStartInBackground=true
+* [CB-13830](https://issues.apache.org/jira/browse/CB-13830) Add handlers for plugins that use non-Java source files, such as Camera
+* [CB-13923](https://issues.apache.org/jira/browse/CB-13923) Fix -1 length for compressed files
+
+### 7.1.4 (Nov 22, 2018)
+
+* Update android-versions to `1.4.0`, with added support for Android Pie ([#573](https://github.com/apache/cordova-android/pull/573))
+* Output current package name if package name can't be validated ([#567](https://github.com/apache/cordova-android/pull/567))
+* Resolve issue with plugin `target-dir="*app*"` subdirs ([#572](https://github.com/apache/cordova-android/pull/572))
+
+### 7.1.3 (Nov 19, 2018)
+
+* [GH-495](https://github.com/apache/cordova-android/pull/495) Incorrect default sdk version issue fix
+* [GH-496](https://github.com/apache/cordova-android/pull/496) update comments in `build.gradle`
+* [GH-539](https://github.com/apache/cordova-android/pull/539) Fix dest overwrite, in case of of plugin `source-file` element with `target-dir` that does not need remapping
+* [GH-540](https://github.com/apache/cordova-android/issues/540) support plugin `source-file` element with any app `target-dir` value
+* [GH-547](https://github.com/apache/cordova-android/issues/547) Compatibility of old plugins with non-Java `source-file` entries (individual files)
+* [GH-551](https://github.com/apache/cordova-android/pull/551) add missing cast for cdvMinSdkVersion to `build.gradle`
+* [GH-552](https://github.com/apache/cordova-android/issues/552) check for `build-extras.gradle` in the parent app directory
+
+### 7.1.2 (Nov 08, 2018)
+* [CB-14127](https://issues.apache.org/jira/browse/CB-14127): Always put the Google repo above jcenter
+* [CB-14165](https://issues.apache.org/jira/browse/CB-14165): Emulator: handle "device still connecting" error (#457)
+* [CB-14125](https://issues.apache.org/jira/browse/CB-14125): Increase old plugin compatibility
+* [CB-13830](https://issues.apache.org/jira/browse/CB-13830): Add handlers for plugins that use non-Java source files, such as Camera
+* [CB-14038](https://issues.apache.org/jira/browse/CB-14038): fix false positive detecting project type
+
+### 7.1.1 (Jul 11, 2018)
+* Fix unsafe property access in run.js (#445)
+* Emit log event instead of logging directly (#452)
+* [CB-14101](https://issues.apache.org/jira/browse/CB-14101) Fix Java version check for Java >= 9 (#446)
+* [CB-14127](https://issues.apache.org/jira/browse/CB-14127) (android) Move google maven repo ahead of jcenter
+* [CB-13923](https://issues.apache.org/jira/browse/CB-13923) (android) fix -1 length for compressed files
+* [CB-14145](https://issues.apache.org/jira/browse/CB-14145) use cordova-common@2.2.5 and update other dependencies to resolve `npm audit` warnings
+* [CB-9366](https://issues.apache.org/jira/browse/CB-9366) log error.stack in cordova.js
+
+### 7.1.0 (Feb 20, 2018)
+* [CB-13879](https://issues.apache.org/jira/browse/CB-13879) updated gradle tools dependency to 3.0.1 for project template
+* [CB-13831](https://issues.apache.org/jira/browse/CB-13831) Update `android-versions` to 1.3.0 to support SDK 27.
+* [CB-13800](https://issues.apache.org/jira/browse/CB-13800) Drop pre-KitKat specific code
+* [CB-13724](https://issues.apache.org/jira/browse/CB-13724) Updated the **Android** Tooling required for the latest version on both the test project, and the template
+* [CB-13724](https://issues.apache.org/jira/browse/CB-13724) Bump Target SDK to API 27
+* [CB-13646](https://issues.apache.org/jira/browse/CB-13646) Using the deprecated `NDK` by default breaks the build. Crosswalk users need to specify the Gradle parameters to keep it working.
+* [CB-12218](https://issues.apache.org/jira/browse/CB-12218) Fix consistency of null result message
+* [CB-13571](https://issues.apache.org/jira/browse/CB-13571) Prevent crash with unrecognized **Android** version
+* [CB-13721](https://issues.apache.org/jira/browse/CB-13721) Fix build apps that use `cdvHelpers.getConfigPreference`
+* [CB-13621](https://issues.apache.org/jira/browse/CB-13621) Wrote similar warning to [CB-12948](https://issues.apache.org/jira/browse/CB-12948) on **iOS**. We no longer support `cordova update` command.
+
+### 7.0.0 (Nov 30, 2017)
+* [CB-13612](https://issues.apache.org/jira/browse/CB-13612) Fix the remapper so that XML files copy over and the Camera works again.
+* [CB-13741](https://issues.apache.org/jira/browse/CB-13741) Bump `package.json` so we can install plugins
+* [CB-13610](https://issues.apache.org/jira/browse/CB-13610) Compress the default app assets
+* [CB-12835](https://issues.apache.org/jira/browse/CB-12835) add a Context getter in CordovaInterface
+* [CB-8976](https://issues.apache.org/jira/browse/CB-8976) Added the `cdvVersionCodeForceAbiDigit` flag to the template build.gradle that appends 0 to the versionCode when `cdvBuildMultipleApks` is not set
+* [CB-12291](https://issues.apache.org/jira/browse/CB-12291) (android) Add x86_64, arm64 and armeabi architecture flavors
+* [CB-13602](https://issues.apache.org/jira/browse/CB-13602) We were setting the path wrong, this is hacky but it works
+* [CB-13601](https://issues.apache.org/jira/browse/CB-13601) Fixing the standalone run scripts to make sure this works without using the CLI
+* [CB-13580](https://issues.apache.org/jira/browse/CB-13580) fix build for multiple apks (different product flavors)
+* [CB-13558](https://issues.apache.org/jira/browse/CB-13558) Upgrading the gradle so we can upload the AAR
+* [CB-13297](https://issues.apache.org/jira/browse/CB-13297) This just works once you bump the project structure. Java 1.8 compatibility baked-in
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) **Android** Studio 3 work, things have changed with how the platform is built
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Found bug where the gradle subproject changes weren't actually getting written to the correct gradle file
+* [CB-13470](https://issues.apache.org/jira/browse/CB-13470) Fix Clean so that it cleans the **Android** Studio structure
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Adding specs for resource files inside an **Android** Studio Project
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Added remapping for drawables
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Found bug in Api.js where xml/strings.xml is used instead of values/strings.xml
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Setup Api.js to support multiple builders based on project structure
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Changing directory creation, will most likely hide this behind a flag for the next release of `cordova-android`, and then make it default in the next major pending feedback
+* Adding the Studio Builder to build a project based on **Android** Studio, and deleting Ant, since Google does not support Ant Builds anymore. Sorry guys!
+
+### 6.4.0 (Nov 06, 2017)
+* [CB-13289](https://issues.apache.org/jira/browse/CB-13289) Fixing build problems with Studio Three, but keeping **Windows** Gradle fix for now, will be deprecated
+* [CB-13289](https://issues.apache.org/jira/browse/CB-13289) Fix test to work with new Google **Android** Gradle DSL
+* :CB-13501 : update appveyor node versions to support node 8
+* [CB-13499](https://issues.apache.org/jira/browse/CB-13499) Remove duplicate "setting" in error strings
+* Include missing values for task.name when 'cdvBuildMultipleApks' option is true, 'task.name' can have 'validateSigningArmv7Release' or 'validateSigningX86Release' values too.
+* [CB-13406](https://issues.apache.org/jira/browse/CB-13406) Fixed AVD API level comparison when choosing sub-par API level match. Added tests for the best_image method.
+* [CB-13404](https://issues.apache.org/jira/browse/CB-13404) add **Android**-versions to bundledDependencies. Ignore best emulator selection when parsed AVD information does not include API level in the target
+* [CB-12895](https://issues.apache.org/jira/browse/CB-12895) : eslint ignoring cordova.js
+* [CB-12895](https://issues.apache.org/jira/browse/CB-12895) Temporarily disabling eslint since cordova-js does not have eslint yet.
+
+### 6.3.0 (Sep 25, 2017)
+* [CB-6936](https://issues.apache.org/jira/browse/CB-6936) fix crash when calling methods on a destroyed webview
+* [CB-12981](https://issues.apache.org/jira/browse/CB-12981) handle SDK 26.0.2 slightly different AVD list output for **Android** 8+ AVDs. Would cause "cannot read property replace of undefined" errors when trying to deploy an **Android** 8 emulator.
+* Updated maven repo to include most recent lib versions
+* [CB-13177](https://issues.apache.org/jira/browse/CB-13177) Updating to API Level 26
+* Revert [CB-12015](https://issues.apache.org/jira/browse/CB-12015) initial-scale values less than 1.0 are ignored on **Android**
+* [CB-12730](https://issues.apache.org/jira/browse/CB-12730) The Cordova Compatibility Plugin is now integrated into cordova-android
+* [CB-12453](https://issues.apache.org/jira/browse/CB-12453) Remove unnecessary double quotes from .bat files which are the causes of crash if project path contains spaces
+* [CB-13031](https://issues.apache.org/jira/browse/CB-13031) Fix bug with case-sensitivity of **Android**-packageName
+* [CB-10916](https://issues.apache.org/jira/browse/CB-10916) Support display name for **Android**
+* [CB-12423](https://issues.apache.org/jira/browse/CB-12423) make explicit JDK 1.8 or greater is needed in the `README`, we require 1.8 for compilation, but do not have 1.8 Java features yet
+* [CB-13006](https://issues.apache.org/jira/browse/CB-13006) removed create and update end-to-end tests, and instead added more unit test coverage. tweaked code coverage invocation so that we get coverage details on the create.js module. slight changes to the create.js module so that it is slightly easier to test.
+* [CB-12950](https://issues.apache.org/jira/browse/CB-12950) lots of tweaks for end-to-end test runs, especially on CI: - rename npm tasks to reflect what they do (npm run unit-tests, npm run e2e-tests). main `npm test` runs linter, unit tests and e2e tests now. - locked jasmine down to ~2.6.0. - consolidate gitignores. - updated travis to run `npm test`. add **Android** sdk installation to appveyor ci run.align **Android** dpendencies across travis and appveyor. have appveyor install gradle. force gradle to version 3.4.1 in appveyor, as that seems to be the only version choco has. explicitly invoke sdkmanager to move license accepting process along.
+* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) In **Windows** get **Android** studio path from the registry
+* [CB-12762](https://issues.apache.org/jira/browse/CB-12762) : pointed `package.json` repo items to github mirrors instead of apache repos site
+* [CB-12617](https://issues.apache.org/jira/browse/CB-12617) : removed node0.x support for platforms and added engineStrict
+
+### 6.2.3 (May 2, 2017)
+* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) better handling of unrecognized Android SDK commands on **Windows**.
+* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) flipped avd parsing logic so that it always tries to use avdmanager to retrieve avds first, then falls back to android command if avdmanager cannot be found (and errors with ENOENT). updated tests - and added explicit tests to ensure to shell out to singular forms of sub-commands when executing `android`
+* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) support for android sdk tools 26.0.1.
+
+### 6.2.2 (Apr 24, 2017)
+* [CB-12697](https://issues.apache.org/jira/browse/CB-12697) Updated checked-in `node_modules`
+
+### 6.2.1 (Apr 02, 2017)
+* [CB-12621](https://issues.apache.org/jira/browse/CB-12621) reverted elementtree dep to 0.1.6
+
+### 6.2.0 (Mar 28, 2017)
+* [CB-12614](https://issues.apache.org/jira/browse/CB-12614) Adding headers to tests
+* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Prepare copy `resource-files` from `config.xml`
+* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) Fix a requirements check failure on **Windows**
+* [CB-12595](https://issues.apache.org/jira/browse/CB-12595) This should find an **Android Studio** installation and use the sweet gradle center found inside
+* [CB-12546](https://issues.apache.org/jira/browse/CB-12546) leverage `avdmanager` if `android` warns it is no longer useful, which happens in **Android SDK Tools 25.3.1**. Explicitly set the `CWD` of the spawned emulator process to workaround a recent google android sdk bug. Rename `android_sdk_version.js` to `android_sdk.js`, to better reflect its contents. Have `create.js` copy over the `android_sdk_version` batch file.
+* [CB-12524](https://issues.apache.org/jira/browse/CB-12524) Fix for missing gradle template error. This now fetches the template from inside of the **Android Studio** directory, and falls back to a locally installed Gradle instance
+* [CB-12465](https://issues.apache.org/jira/browse/CB-12465) Writing new JUnit Test Instrumentation to replace tests and retire problmatic tests
+
+### 6.1.2 (Jan 26, 2017)
+* **Security** Change to `https` by default
+* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated tests to work with jasmine (promise matcher tests commented out for now)
+* created directories and corresponding images for `xxhdpi` and `xxxhdpi`, both drawables and `mipmaps`
+
+### 6.1.1 (Jan 03, 2017)
+* [CB-12159](https://issues.apache.org/jira/browse/CB-12159) **Android** Keystore password prompt won't show up
+* [CB-12169](https://issues.apache.org/jira/browse/CB-12169) Check for build directory before running a clean
+* Fixed `AndroidStudio` tests to actually run, removed `app/src/main/assets/` as a requirement and added `app/src/main/res` instead, added placeholder for `build/` folder, Removed dupe `gitignore`
+
+### 6.1.0 (Nov 02, 2016)
+* [CB-12108](https://issues.apache.org/jira/browse/CB-12108) Updating gradle files to work with the latest version of Android Studio
+* [CB-12102](https://issues.apache.org/jira/browse/CB-12102) Bump travis to build to API 25
+* Bumping up the version
+* [CB-12101](https://issues.apache.org/jira/browse/CB-12101) Fix so that CLI builds don't conflict with Android Studio builds
+* [CB-12077](https://issues.apache.org/jira/browse/CB-12077) Fix paths for Android icons/splashscreens
+* added framework/build to .ratignore
+* Fix for broken testUrl test
+* Last minute change of test targets
+* Update JS snapshot to version 6.1.0-dev (via coho)
+* Set VERSION to 6.1.0-dev (via coho)
+
+### 6.0.0 (Oct 20, 2016)
+
+This release adds significant functionality, and also introduces a number
+of breaking changes. Some of the changes to the code base will be of
+particular interest to third party webview plugin developers.
+
+#### Major Changes ####
+* Primary bridge is the EVAL_BRIDGE, which tells the WebView to execute JS directly. This is more stable than the ONLINE_EVENT bridge
+* Full Support for Android Nougat (API 24)
+* Ice Cream Sandwich Support has been deprecated. Minimum Supported Android Version is Jellybean (API 16/ Android 4.1)
+* Plugin Installation now CLEANS the build directory, this speeds up gradle build times and allows for CLI develoment to be more predictable
+
+Changes For Third-Party WebView Developers:
+* executeJavascript method added and is an abstract method that must be implemented
+* the EVAL_BRIDGE must be added to the WebView
+
+
+#### Curated Changes from the Git Commit Logs ####
+* Updating the gradle build for test to use the latest
+* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Fixing syncronous file check and future-proofing the JS for Travis
+* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe
+* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Plugin build script for dependencies without a gradle file
+* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) The GradleBuidler can tell the difference between a Cordova Plugin Framework and a regular framework based on the name
+* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Fix to deal with custom frameworks with their own Gradle configuration
+* [CB-12003](https://issues.apache.org/jira/browse/CB-12003) updated node_modules
+* [CB-11771](https://issues.apache.org/jira/browse/CB-11771) Deep symlink directories to target project instead of linking the directory itself
+* [CB-11880](https://issues.apache.org/jira/browse/CB-11880) android: Fail-safe for cordova.exec()
+* [CB-11999](https://issues.apache.org/jira/browse/CB-11999) add message, catch exception if require fails
+* fix issue with app_name containing apostrophes
+* [CB-8722](https://issues.apache.org/jira/browse/CB-8722) - Move icons from drawable to mipmap
+* [CB-11964](https://issues.apache.org/jira/browse/CB-11964) Call clean after plugin install and mock it in tests
+* Did a try/catch to deal with the unit tests vs actual project environment, code duplication is needed because of builderEnv
+* [CB-11964](https://issues.apache.org/jira/browse/CB-11964) Do a clean when installing a plugin to et around the bug
+* [CB-11921](https://issues.apache.org/jira/browse/CB-11921) - Add github pull request template
+* [CB-11935](https://issues.apache.org/jira/browse/CB-11935) Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation.
+* [CB-11640](https://issues.apache.org/jira/browse/CB-11640) Fixing check_reqs.js so it actually works
+* [CB-11640](https://issues.apache.org/jira/browse/CB-11640) Changing requirements check to ask for Java 8
+* [CB-11869](https://issues.apache.org/jira/browse/CB-11869) Fix cordova-js android exec tests
+* [CB-11907](https://issues.apache.org/jira/browse/CB-11907) Bumping Gradle to work with Android Studio 2.2 and the Android Gradle Plugin
+* Enable background start of Cordova Android apps
+* fixing jshint issues
+* replace Integer.parseInt with BigInteger so that you can use longer Android version codes
+* [CB-11828](https://issues.apache.org/jira/browse/CB-11828) Adding dirty userAgent checking to see if we're running Jellybean or not for bridge modes
+* [CB-11828](https://issues.apache.org/jira/browse/CB-11828) Switching default bridge back to ONLINE_BRIDGE
+* Add gradle build flag to enable dex in process for large projects
+* added ability for cordova activity to be viewed in a real full screen regardless of android version (as was the case in previous cordova versions)
+* Updating travis
+* Adding Static Method to CoreAndroid Plugin so we can get the BuildConfig data from other plugins
+* Bump Target and Min API levels
+* Make evaluateJavaScript brige default
+* Creating an evaluateJavascript branch
+* [CB-11727](https://issues.apache.org/jira/browse/CB-11727) - travis ci setup is still using 0.10.32 node
+* [CB-11726](https://issues.apache.org/jira/browse/CB-11726) - Update appveyor node versions to 4 and 6, so they will always use the latest versions
+* Close invalid PRs
+* [CB-11683](https://issues.apache.org/jira/browse/CB-11683) Fixed linking to directories during plugin installation.
+* fixed [CB-11078](https://issues.apache.org/jira/browse/CB-11078) Empty string for BackgroundColor preference crashes application This closes #316
+* Update JS snapshot to version 5.3.0-dev (via coho)
+* Set VERSION to 5.3.0-dev (via coho)
+* [CB-11626](https://issues.apache.org/jira/browse/CB-11626) Updated RELEASENOTES and Version for release 5.2.2
+* updated cordoova-common to 1.4.0
+* This closes #195
+* Updaing the gradle for the tests to the latest
+* [CB-11550](https://issues.apache.org/jira/browse/CB-11550) Updated RELEASENOTES for release 5.2.1
+* [CB-9489](https://issues.apache.org/jira/browse/CB-9489) Fixed "endless waiting for emulator" issue
+* Update JS snapshot to version 5.3.0-dev (via coho)
+* Set VERSION to 5.3.0-dev (via coho)
+* [CB-11444](https://issues.apache.org/jira/browse/CB-11444) Updated RELEASENOTES and Version for release 5.2.0
+* [CB-11481](https://issues.apache.org/jira/browse/CB-11481) android-library is deprecated use com.android.library instead
+
+### 5.2.2 (Jul 26, 2016)
+* [CB-11615](https://issues.apache.org/jira/browse/CB-11615) updated `cordoova-common` to `1.4.0`
+
+### 5.2.1 (Jul 11, 2016)
+* [CB-9489](https://issues.apache.org/jira/browse/CB-9489) Fixed "endless waiting for emulator" issue
+* [CB-11481](https://issues.apache.org/jira/browse/CB-11481) android-library is deprecated use com.android.library instead
+
+### 5.2.0 (Jun 29, 2016)
+* [CB-11383](https://issues.apache.org/jira/browse/CB-11383) Update to gradle for using `jcenter` and correct Application plugin
+* [CB-11365](https://issues.apache.org/jira/browse/CB-11365) fixed plugin rm issue with emit being `undefined`
+* [CB-11117](https://issues.apache.org/jira/browse/CB-11117) Use `FileUpdater` to optimize prepare for **android** platform
+* [CB-10096](https://issues.apache.org/jira/browse/CB-10096) Upgrade test project to `Gradle Plugin 2.1.0`
+* [CB-11292](https://issues.apache.org/jira/browse/CB-11292) fix broken `MessageChannel` after plugins are recreated
+* [CB-11259](https://issues.apache.org/jira/browse/CB-11259) Improving build output
+* [CB-10096](https://issues.apache.org/jira/browse/CB-10096) Upgrading to `Gradle Plugin 2.1.0`
+* [CB-11198](https://issues.apache.org/jira/browse/CB-11198) Skip **android** target sdk check. This closes #303.
+* [CB-11138](https://issues.apache.org/jira/browse/CB-11138) Reuse `PluginManager` from `common` to add/rm plugins
+* [CB-11133](https://issues.apache.org/jira/browse/CB-11133) Handle **android** emulator start failure
+* [CB-11132](https://issues.apache.org/jira/browse/CB-11132) Fix Error: Cannot read property `match` of undefined in `cordova-android` `emulator.js`
+* Add simple log for package name being deployed
+* [CB-11015](https://issues.apache.org/jira/browse/CB-11015) Error adding plugin with gradle extras
+* [CB-11095](https://issues.apache.org/jira/browse/CB-11095) Fix plugin add/removal when running on `Node v.010`
+* [CB-11022](https://issues.apache.org/jira/browse/CB-11022) Duplicate www files to both destinations on plugin operations
+* [CB-10964](https://issues.apache.org/jira/browse/CB-10964) Handle `build.json` file starting with a BOM.
+* [CB-10963](https://issues.apache.org/jira/browse/CB-10963) Handle overlapping permission requests from plugins
+* [CB-8582](https://issues.apache.org/jira/browse/CB-8582) Obscure `INSTALL_FAILED_VERSION_DOWNGRADE` error when installing app
+* [CB-10862](https://issues.apache.org/jira/browse/CB-10862) Cannot set `minsdkversion`
+* [CB-10896](https://issues.apache.org/jira/browse/CB-10896) We never enabled cookies on the `WebView` proper
+* [CB-10837](https://issues.apache.org/jira/browse/CB-10837) Support platform-specific orientation on **Android**
+* [CB-10600](https://issues.apache.org/jira/browse/CB-10600) `cordova run android --release` does not use signed and zip-aligned version of `APK`
+* [CB-9710](https://issues.apache.org/jira/browse/CB-9710) Fixing issues parsing `android avd list` output for certain AVDs which resulted in them not being included in the selection process even if they are the best match.
+* [CB-10888](https://issues.apache.org/jira/browse/CB-10888) Enable coverage reports collection via codecov
+* [CB-10846](https://issues.apache.org/jira/browse/CB-10846) Add Travis and AppVeyor badges to readme
+* [CB-10846](https://issues.apache.org/jira/browse/CB-10846) Add AppVeyor configuration
+* [CB-10749](https://issues.apache.org/jira/browse/CB-10749) Use `cordova-common.CordovaLogger` in `cordova-android`
+* [CB-10673](https://issues.apache.org/jira/browse/CB-10673) fixed conflicting plugin install issue with overlapped `` tag. Add `--force` flag.
+* [CB-8976](https://issues.apache.org/jira/browse/CB-8976) Removing the auto-version for non-Crosswalk applications
+* [CB-10768](https://issues.apache.org/jira/browse/CB-10768) Use `cordova-common.superspawn` in `GradleBuilder`
+* [CB-10729](https://issues.apache.org/jira/browse/CB-10729) Move plugin handlers tests for into platform's repo
+* [CB-10669](https://issues.apache.org/jira/browse/CB-10669) `cordova run --list` cannot find `adb`
+* [CB-10660](https://issues.apache.org/jira/browse/CB-10660) fixed the exception when removing a non-existing directory.
+
+### 5.1.1 (Feb 24, 2016)
+* updated `cordova-common` dependnecy to `1.1.0`
+* [CB-10628](https://issues.apache.org/jira/browse/CB-10628) Fix `emulate android --target`
+* [CB-10618](https://issues.apache.org/jira/browse/CB-10618) Handle gradle frameworks on plugin installation/uninstallation
+* [CB-10510](https://issues.apache.org/jira/browse/CB-10510) Add an optional timeout to `emu` start script
+* [CB-10498](https://issues.apache.org/jira/browse/CB-10498) Resume event should be sticky if it has a plugin result
+* fix `HtmlNotFoundTest` so that it passes when file not found is handled correctly
+* [CB-10472](https://issues.apache.org/jira/browse/CB-10472) `NullPointerException`: `org.apache.cordova.PluginManager.onSaveInstanceState` check if `pluginManager` is `null` before using it
+* [CB-10138](https://issues.apache.org/jira/browse/CB-10138) Adds missing plugin metadata to `plugin_list` module.
+* [CB-10443](https://issues.apache.org/jira/browse/CB-10443) Pass original options instead of remaining
+* [CB-10443](https://issues.apache.org/jira/browse/CB-10443) Fix `this.root` null reference
+* [CB-10421](https://issues.apache.org/jira/browse/CB-10421) Fixes exception when calling run script with `--help` option
+* updated `.gitignore`
+* [CB-10406](https://issues.apache.org/jira/browse/CB-10406) Fixes an exception, thrown when building using Ant.
+* [CB-10157](https://issues.apache.org/jira/browse/CB-10157) Uninstall app from device/emulator only when signed apk is already installed
+
+### 5.1.0 (Jan 19, 2016)
+* [CB-10386](https://issues.apache.org/jira/browse/CB-10386) Add `android.useDeprecatedNdk=true` to support `NDK` in `gradle`
+* [CB-8864](https://issues.apache.org/jira/browse/CB-8864) Fixing this to mitigate [CB-8685](https://issues.apache.org/jira/browse/CB-8685) and [CB-10104](https://issues.apache.org/jira/browse/CB-10104)
+* [CB-10105](https://issues.apache.org/jira/browse/CB-10105) Spot fix for tilde errors on paths.
+* Update theme to `Theme.DeviceDefault.NoActionBar`
+* [CB-10014](https://issues.apache.org/jira/browse/CB-10014) Set gradle `applicationId` to `package name`.
+* [CB-9949](https://issues.apache.org/jira/browse/CB-9949) Fixing menu button event not fired in **Android**
+* [CB-9479](https://issues.apache.org/jira/browse/CB-9479) Fixing the conditionals again, we should
+* [CB-8917](https://issues.apache.org/jira/browse/CB-8917) New Plugin API for passing results on resume after Activity destruction
+* [CB-9971](https://issues.apache.org/jira/browse/CB-9971) Suppress `gradlew _JAVA_OPTIONS` output during build
+* [CB-9836](https://issues.apache.org/jira/browse/CB-9836) Add `.gitattributes` to prevent `CRLF` line endings in repos
+* added node_modules back into `.gitignore`
+
+### 5.0.0 (Nov 01, 2015)
+* Update CordovaWebViewEngine.java
+* [CB-9909](https://issues.apache.org/jira/browse/CB-9909) Shouldn't escape spaces in paths on Windows.
+* [CB-9870](https://issues.apache.org/jira/browse/CB-9870) updated hello world template
+* [CB-9880](https://issues.apache.org/jira/browse/CB-9880) Fixes platform update failure when upgrading from android@<4.1.0
+* [CB-9844](https://issues.apache.org/jira/browse/CB-9844) Remove old .java after renaming activity
+* [CB-9800](https://issues.apache.org/jira/browse/CB-9800) Fixing contribute link.
+* [CB-9782](https://issues.apache.org/jira/browse/CB-9782) Check in `cordova-common` dependency
+* Adds licence header to Adb to pass rat audit
+* [CB-9835](https://issues.apache.org/jira/browse/CB-9835) Downgrade `properties-parser` to prevent failures in Node < 4.x
+* [CB-9782](https://issues.apache.org/jira/browse/CB-9782) Implements PlatformApi contract for Android platform.
+* [CB-9826](https://issues.apache.org/jira/browse/CB-9826) Fixed `test-build` script on windows.
+* Refactor of the Cordova Plugin/Permissions API
+* Manually updating version to 5.0.0-dev for engine tags
+* Bump up to API level 23
+* Commiting code to handle permissions, and the special case of the Geolocation Plugin
+* [CB-9608](https://issues.apache.org/jira/browse/CB-9608) cordova-android no longer builds on Node 0.10 or below
+* [CB-9080](https://issues.apache.org/jira/browse/CB-9080) Cordova CLI run for Android versions 4.1.1 and lower throws error
+* [CB-9557](https://issues.apache.org/jira/browse/CB-9557) Fixes apk install failure when switching from debug to release build
+* [CB-9496](https://issues.apache.org/jira/browse/CB-9496) removed permissions added for crosswalk
+* [CB-9402](https://issues.apache.org/jira/browse/CB-9402) Allow to set gradle distubutionUrl via env variable CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
+* [CB-9428](https://issues.apache.org/jira/browse/CB-9428) update script now bumps up minSdkVersion to 14 if it is less than that.
+* [CB-9430](https://issues.apache.org/jira/browse/CB-9430) Fixes check_reqs failure when javac returns an extra line
+* [CB-9172](https://issues.apache.org/jira/browse/CB-9172) Improved emulator deploy stability. This closes #188.
+* [CB-9404](https://issues.apache.org/jira/browse/CB-9404) Fixed an exception when path contained -debug or -release
+* [CB-8320](https://issues.apache.org/jira/browse/CB-8320) Setting up gradle so we can use CordovaLib as a standard Android Library
+* [CB-9185](https://issues.apache.org/jira/browse/CB-9185) Fixed an issue when unsigned apks couldn't be found.
+* [CB-9397](https://issues.apache.org/jira/browse/CB-9397) Fixes minor issues with `cordova requirements android`
+* [CB-9389](https://issues.apache.org/jira/browse/CB-9389) Fixes build/check_reqs hang
+
+### Release 4.1.1 (Aug 2015) ###
+
+* [CB-9428](https://issues.apache.org/jira/browse/CB-9428) update script now bumps up minSdkVersion to 14 if it is less than that
+* [CB-9430](https://issues.apache.org/jira/browse/CB-9430) Fixes check_reqs failure when javac returns an extra line
+
+### Release 4.1.0 (Jul 2015) ###
+* [CB-9392](https://issues.apache.org/jira/browse/CB-9392) Fixed printing flavored versions. This closes #184.
+* [CB-9382](https://issues.apache.org/jira/browse/CB-9382) [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200
+* [CB-9391](https://issues.apache.org/jira/browse/CB-9391) Fixes cdvBuildMultipleApks option casting
+* [CB-9343](https://issues.apache.org/jira/browse/CB-9343) Split the Content-Type to obtain a clean mimetype
+* [CB-9255](https://issues.apache.org/jira/browse/CB-9255) Make getUriType case insensitive.
+* [CB-9149](https://issues.apache.org/jira/browse/CB-9149) Fixes JSHint issue introduced by 899daa9
+* [CB-9372](https://issues.apache.org/jira/browse/CB-9372) Remove unused files: 'main.js' & 'master.css'. This closes #198
+* [CB-9149](https://issues.apache.org/jira/browse/CB-9149) Make gradle alias subprojects in order to handle libs that depend on libs. This closes #182
+* Update min SDK version to 14
+* Update licenses. This closes #190
+* [CB-9185](https://issues.apache.org/jira/browse/CB-9185) Fix signed release build exception. This closes #193.
+* [CB-9286](https://issues.apache.org/jira/browse/CB-9286) Fixes build failure when ANDROID_HOME is not set.
+* [CB-9284](https://issues.apache.org/jira/browse/CB-9284) Fix for handling absolute path for keystore in build.json
+* [CB-9260](https://issues.apache.org/jira/browse/CB-9260) Install Android-22 on Travis-CI
+* Adding .ratignore file.
+* [CB-9119](https://issues.apache.org/jira/browse/CB-9119) Adding lib/retry.js for retrying promise-returning functions. Retrying 'adb install' in emulator.js because it sometimes hangs.
+* [CB-9115](https://issues.apache.org/jira/browse/CB-9115) android: Grant Lollipop permission req
+* Remove extra console message
+* [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Report expected gradle location properly
+* [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Fixes gradle check failure due to missing quotes
+* [CB-9080](https://issues.apache.org/jira/browse/CB-9080) -d option is not supported on Android 4.1.1 and lower, removing
+* [CB-8954](https://issues.apache.org/jira/browse/CB-8954) Adds `requirements` command support to check_reqs module
+* Update JS snapshot to version 4.1.0-dev (via coho)
+* [CB-8417](https://issues.apache.org/jira/browse/CB-8417) updated platform specific files from cordova.js repo
+* Adding tests to confirm that preferences aren't changed by Intents
+* Forgot to remove the method that copied over the intent data
+* Getting around to removing this old Intent code
+* Update JS snapshot to version 4.1.0-dev (via coho)
+* Fix CordovaPluginTest on KitKat (start-up events seem to change)
+* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Allow setting a custom User-Agent (close #162)
+* [CB-8902](https://issues.apache.org/jira/browse/CB-8902) Use immersive mode when available when going fullscreen (close #175)
+* Make BridgeMode methods public (they were always supposed to be)
+* Simplify: EncodingUtils.getBytes(str) -> str.getBytes()
+* Don't show warning when gradlew file is read-only
+* Don't show warning when prepEnv copies gradlew and it's read-only
+* Make gradle wrapper prepEnv code work even when android-sdk is read-only
+* [CB-8897](https://issues.apache.org/jira/browse/CB-8897) Delete drawable/icon.png since it duplicates drawable-mdpi/icon.png
+* Updating the template to target mininumSdkTarget=14
+* [CB-8894](https://issues.apache.org/jira/browse/CB-8894) Updating the template to target mininumSdkTarget=14
+* [CB-8891](https://issues.apache.org/jira/browse/CB-8891) Add a note about when the gradle helpers were added
+* [CB-8891](https://issues.apache.org/jira/browse/CB-8891) Add a gradle helper for retrieving config.xml preference values
+* [CB-8884](https://issues.apache.org/jira/browse/CB-8884) Delete Eclipse tweaks from create script
+* [CB-8834](https://issues.apache.org/jira/browse/CB-8834) Don't fail to install on VERSION_DOWNGRADE
+* Automated tools fail, and you have to remember all four places where this is set.
+* Update the package.json
+* [CB-9042](https://issues.apache.org/jira/browse/CB-9042) coho failed to update version, so here we are
+* CB9042 - Updating Release Notes
+* Adding tests to confirm that preferences aren't changed by Intents
+* updating existing test code
+* Forgot to remove the method that copied over the intent data
+* Getting around to removing this old Intent code
+* [CB-8834](https://issues.apache.org/jira/browse/CB-8834) Don't fail to install on VERSION_DOWNGRADE
+
+### Release 4.0.2 (May 2015) ###
+
+* Removed Intent Functionality from Preferences - Preferences can no longer be set by intents
+
+### Release 4.0.1 (April 2015) ###
+
+* Bug fixed where platform failed to install on a version downgrade
+
+### Release 4.0.0 (March 2015) ###
+
+This release adds significant functionality, and also introduces a number
+of breaking changes. Some of the changes to the code base will be of
+particular interest to plugin developers.
+
+#### Major Changes ####
+* Support for pluggable WebViews
+ * The system WebView can be replaced in your app, via a plugin
+ * Core WebView functionality is encapsulated, with extension points exposed
+ via interfaces
+* Support for Crosswalk to bring the modern Chromium WebView to older devices
+ * Uses the pluggable WebView framework
+ * You will need to add the new [cordova-crosswalk-engine](https://github.com/MobileChromeApps/cordova-crosswalk-engine) plugin
+* Splash screen functionality is now provided via plugin
+ * You will need to add the new [cordova-plugin-splashscreen](https://github.com/apache/cordova-plugin-splashscreen) plugin to continue using a splash screen
+* Whitelist functionality is now provided via plugin (CB-7747)
+ * The whitelist has been enhanced to be more secure and configurable
+ * Setting of Content-Security-Policy is now supported by the framework (see details in plugin readme)
+ * You will need to add the new [cordova-plugin-whitelist](https://github.com/apache/cordova-plugin-whitelist) plugin
+ * Legacy whitelist behaviour is still available via plugin (although not recommended).
+
+Changes For Plugin Developers:
+
+* Develop in Android Studio
+ * Android Studio is now fully supported, and recommended over Eclipse
+* Build using Gradle
+ * All builds [use Gradle by default](Android%20Shell%20Tool%20Guide_building_with_gradle), instead of Ant
+ * Plugins can add their own gradle build steps!
+ * Plugins can depend on Maven libraries using `` tags
+* New APIs: `onStart`, `onStop`, `onConfigurationChanged`
+* `"onScrollChanged"` message removed. Use `view.getViewTreeObserver().addOnScrollChangedListener(...)` instead
+* [CB-8702](https://issues.apache.org/jira/browse/CB-8702) New API for plugins to override `shouldInterceptRequest` with a stream
+
+#### Other Changes ####
+* [CB-8378](https://issues.apache.org/jira/browse/CB-8378) Removed `hidekeyboard` and `showkeyboard` events (apps should use a plugin instead)
+* [CB-8735](https://issues.apache.org/jira/browse/CB-8735) `bin/create` regex relaxed / better support for numbers
+* [CB-8699](https://issues.apache.org/jira/browse/CB-8699) Fix CordovaResourceApi `copyResource` creating zero-length files when src=uncompressed asset
+* [CB-8693](https://issues.apache.org/jira/browse/CB-8693) CordovaLib should not contain icons / splashscreens
+* [CB-8592](https://issues.apache.org/jira/browse/CB-8592) Fix NPE if lifecycle events reach CordovaWebView before `init()` has been called
+* [CB-8588](https://issues.apache.org/jira/browse/CB-8588) Add CATEGORY_BROWSABLE to intents from showWebPage openExternal=true
+* [CB-8587](https://issues.apache.org/jira/browse/CB-8587) Don't allow WebView navigations within showWebPage that are not whitelisted
+* [CB-7827](https://issues.apache.org/jira/browse/CB-7827) Add `--activity-name` for `bin/create`
+* [CB-8548](https://issues.apache.org/jira/browse/CB-8548) Use debug-signing.properties and release-signing.properties when they exist
+* [CB-8545](https://issues.apache.org/jira/browse/CB-8545) Don't add a layout as a parent of the WebView
+* [CB-7159](https://issues.apache.org/jira/browse/CB-7159) BackgroundColor not used when ``, nor during screen rotation
+* [CB-6630](https://issues.apache.org/jira/browse/CB-6630) Removed OkHttp from core library. It's now available as a plugin: [cordova-plugin-okhttp](https://www.npmjs.com/package/cordova-plugin-okhttp)
+
+### Release 3.7.1 (January 2015) ###
+* [CB-8411](https://issues.apache.org/jira/browse/CB-8411) Initialize plugins only after `createViews()` is called (regression in 3.7.0)
+
+### Release 3.7.0 (January 2015) ###
+
+* [CB-8328](https://issues.apache.org/jira/browse/CB-8328) Allow plugins to handle certificate challenges (close #150)
+* [CB-8201](https://issues.apache.org/jira/browse/CB-8201) Add support for auth dialogs into Cordova Android
+* [CB-8017](https://issues.apache.org/jira/browse/CB-8017) Add support for ` ` for Lollipop
+* [CB-8143](https://issues.apache.org/jira/browse/CB-8143) Loads of gradle improvements (try it with cordova/build --gradle)
+* [CB-8329](https://issues.apache.org/jira/browse/CB-8329) Cancel outstanding ActivityResult requests when a new startActivityForResult occurs
+* [CB-8026](https://issues.apache.org/jira/browse/CB-8026) Bumping up Android Version and setting it up to allow third-party cookies. This might change later.
+* [CB-8210](https://issues.apache.org/jira/browse/CB-8210) Use PluginResult for various events from native so that content-security-policy can be used
+* [CB-8168](https://issues.apache.org/jira/browse/CB-8168) Add support for `cordova/run --list` (closes #139)
+* [CB-8176](https://issues.apache.org/jira/browse/CB-8176) Vastly better auto-detection of SDK & JDK locations
+* [CB-8079](https://issues.apache.org/jira/browse/CB-8079) Use activity class package name, but fallback to application package name when looking for splash screen drawable
+* [CB-8147](https://issues.apache.org/jira/browse/CB-8147) Have corodva/build warn about unrecognized flags rather than fail
+* [CB-7881](https://issues.apache.org/jira/browse/CB-7881) Android tooling shouldn't lock application directory
+* [CB-8112](https://issues.apache.org/jira/browse/CB-8112) Turn off mediaPlaybackRequiresUserGesture
+* [CB-6153](https://issues.apache.org/jira/browse/CB-6153) Add a preference for controlling hardware button audio stream (DefaultVolumeStream)
+* [CB-8031](https://issues.apache.org/jira/browse/CB-8031) Fix race condition that shows as ConcurrentModificationException
+* [CB-7974](https://issues.apache.org/jira/browse/CB-7974) Cancel timeout timer if view is destroyed
+* [CB-7940](https://issues.apache.org/jira/browse/CB-7940) Disable exec bridge if bridgeSecret is wrong
+* [CB-7758](https://issues.apache.org/jira/browse/CB-7758) Allow content-url-hosted pages to access the bridge
+* [CB-6511](https://issues.apache.org/jira/browse/CB-6511) Fixes build for android when app name contains unicode characters.
+* [CB-7707](https://issues.apache.org/jira/browse/CB-7707) Added multipart PluginResult
+* [CB-6837](https://issues.apache.org/jira/browse/CB-6837) Fix leaked window when hitting back button while alert being rendered
+* [CB-7674](https://issues.apache.org/jira/browse/CB-7674) Move preference activation back into onCreate()
+* [CB-7499](https://issues.apache.org/jira/browse/CB-7499) Support RTL text direction
+* [CB-7330](https://issues.apache.org/jira/browse/CB-7330) Don't run check_reqs for bin/create.
+
+### 3.6.4 (Sept 30, 2014) ###
+
+* Set VERSION to 3.6.4 (via coho)
+* Update JS snapshot to version 3.6.4 (via coho)
+* [CB-7634](https://issues.apache.org/jira/browse/CB-7634) Detect JAVA_HOME properly on Ubuntu
+* [CB-7579](https://issues.apache.org/jira/browse/CB-7579) Fix run script's ability to use non-arch-specific APKs
+* [CB-6511](https://issues.apache.org/jira/browse/CB-6511) Fixes build for android when app name contains unicode characters.
+* [CB-7463](https://issues.apache.org/jira/browse/CB-7463) Adding licences. I don't know what the gradle syntax is for comments, that still needs to be done.
+* [CB-7463](https://issues.apache.org/jira/browse/CB-7463) Looked at the Apache BigTop git, gradle uses C-style comments
+* [CB-7460](https://issues.apache.org/jira/browse/CB-7460) Fixing bug with KitKat where the background colour would override the CSS colours on the application
+
+### 3.6.0 (Sept 2014) ###
+
+* Set VERSION to 3.6.0 (via coho)
+* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) fix the menu test
+* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) Fix the errorUrl test
+* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) Fix Basic Authentication test
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Allow build and run scripts to select APK by architecture
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add environment variable 'BUILD_MULTIPLE_APKS' for splitting APKs based on architecture
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Ensure that JAR files in libs directory are included
+* [CB-7267](https://issues.apache.org/jira/browse/CB-7267) update RELEASENOTES for 3.5.1
+* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) clarify the title
+* [CB-7385](https://issues.apache.org/jira/browse/CB-7385) update cordova.js for testing prior to branch/tag
+* [CB-7410](https://issues.apache.org/jira/browse/CB-7410) add whitelist entries to get iframe/GoogleMaps working
+* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) propogate change in method signature to the native tests
+* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Restrict meaning of "\*" in internal whitelist to just http and https
+* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Only add file, content and data URLs to internal whitelist
+* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Add defaults to external whitelist
+* [CB-7291](https://issues.apache.org/jira/browse/CB-7291) Add external-launch-whitelist and use it for filtering intent launches
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Read project.properties to configure gradle libraries
+* [CB-7325](https://issues.apache.org/jira/browse/CB-7325) Fix error message in android_sdk_version.js when missing SDK on windows
+* [CB-7335](https://issues.apache.org/jira/browse/CB-7335) Add a .gitignore to android project template
+* [CB-7330](https://issues.apache.org/jira/browse/CB-7330) Fix dangling function call in last commit (broke gradle builds)
+* [CB-7330](https://issues.apache.org/jira/browse/CB-7330) Don't run "android update" during creation
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add gradle support clean command (plus some code cleanup)
+* [CB-7044](https://issues.apache.org/jira/browse/CB-7044) Fix typo in prev commit causing check_reqs to always fail.
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Copy gradle wrapper in build instead of create
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add .gradle template files for "update" as well as "create"
+* [CB-7044](https://issues.apache.org/jira/browse/CB-7044) Add JAVA_HOME when not set. Be stricter about ANDROID_HOME
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Speed up gradle building (incremental builds go from 10s -> 1.5s for me)
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) android: Copy Gradle wrapper from Android SDK rather than bundling a JAR
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add which to checked-in node_modules
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add option to build and install with gradle
+* [CB-3445](https://issues.apache.org/jira/browse/CB-3445) Add an initial set of Gradle build scripts
+* [CB-7321](https://issues.apache.org/jira/browse/CB-7321) Don't require ant for create script
+* CB-7044, [CB-7299](https://issues.apache.org/jira/browse/CB-7299) Fix up PATH problems when possible.
+* Change in test's AndroidManifest.xml needed for the test to run properly. Forgot the manifest.
+* Change in test's AndroidManifest.xml needed for the test to run properly
+* Adding tests related to 3.5.1
+* [CB-7261](https://issues.apache.org/jira/browse/CB-7261) Fix setNativeToJsBridgeMode sometimes crashing when switching to ONLINE_EVENT
+* [CB-7265](https://issues.apache.org/jira/browse/CB-7265) Fix crash when navigating to custom protocol (introduced in 3.5.1)
+* Filter out non-launchable intents
+* Handle unsupported protocol errors in webview better
+* [CB-7238](https://issues.apache.org/jira/browse/CB-7238) I should have collapsed this, but Config.init() must go before the creation of CordovaWebView
+* [CB-7238](https://issues.apache.org/jira/browse/CB-7238) Minor band-aid to get tests running again, this has to go away before 3.6.0 is released, since this is an API change.
+* Extend whitelist to handle URLs without // chars
+* [CB-7172](https://issues.apache.org/jira/browse/CB-7172) Force window to have focus after resume
+* [CB-7159](https://issues.apache.org/jira/browse/CB-7159) Set background color of webView as well as its parent
+* [CB-7018](https://issues.apache.org/jira/browse/CB-7018) Fix setButtonPlumbedToJs never un-listening
+* Undeprecate some just-deprecated symbols in PluginManager.
+* @Deprecate methods of PluginManager that were never meant to be public
+* Move plugin instantiation and instance storing logic PluginEntry->PluginManager
+* Fix broken unit test due to missing Config.init() call
+* Update to check for Google Glass APIs
+* Fix for `android` not being in PATH check on Windows
+* Displaying error when regex does not match.
+* Fix broken compile due to previous commit :(
+* Tweak CordovaPlugin.initialize method to be less deprecated.
+* Un-deprecate CordovaActivity.init() - it's needed to tweak prefs in onCreate
+* Tweak log messages in CordovaBridge with bridgeSecret is wrong
+* Backport CordovaBridge from 4.0.x -> master
+* Update unit tests to not use most deprecated things (e.g. DroidGap)
+* Add non-String overloades for CordovaPreferences.set()
+* Make CordovaWebview resilient to init() not being called (for backwards-compatibility)
+* Add node_module licenses to LICENSE
+* Update cordova.js snapshot to work with bridge changes
+* Provide CordovaPlugin with CordovaPreferences. Add new Plugin.initialize()
+* Convert usages of Config.\* to use the non-static versions
+* Change getProperty -> prefs.get\* within CordovaActivity
+* Make CordovaUriHelper class package-private
+* Fix PluginManager.setPluginEntries not removing old entries
+* Move registration of App plugin from config.xml -> code
+* Make setWebViewClient an override instead of an overload. Delete Location-change JS->Native bridge mode (missed some of it).
+* [CB-4404](https://issues.apache.org/jira/browse/CB-4404) Revert setting android:windowSoftInputMode to "adjustPan"
+* Refactor: Use ConfigXmlParser in activity. Adds CordovaWebView.init()
+* Deprecate some convenience methods on CordovaActivity
+* Fix CordovaPreferences not correctly parsing hex values (valueOf->decode)
+* Refactor: Move url-filter information into PluginEntry.
+* Don't re-parse config.xml in onResume.
+* Move handling of Fullscreen preference to CordovaActivity
+* Delete dead code from CordovaActivity
+* Update .classpath to make Eclipse happy (just re-orders one line)
+* Delete "CB-3064: The errorUrl is..." Log message left over from debugging presumably
+* Refactor Config into ConfigXmlParser, CordovaPreferences
+* Delete Location-change JS->Native bridge mode
+* [CB-5988](https://issues.apache.org/jira/browse/CB-5988) Allow exec() only from file: or start-up URL's domain
+* [CB-6761](https://issues.apache.org/jira/browse/CB-6761) Fix native->JS bridge ceasing to fire when page changes and online is set to false and the JS loads quickly
+* Update the errorurl to no longer use intents
+* This breaks running the JUnit tests, we'll bring it back soon
+* Refactoring the URI handling on Cordova, removing dead code
+* [CB-7018](https://issues.apache.org/jira/browse/CB-7018) Clean up and deprecation of some button-related functions
+* [CB-7017](https://issues.apache.org/jira/browse/CB-7017) Fix onload=true being set on all subsequent plugins
+* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) Fix package / project validation
+* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) Add unit tests to cordova-android
+* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) Factor out package/project name validation logic
+* Delete explicit activity.finish() in back button handling. No change in behaviour.
+* [CB-5971](https://issues.apache.org/jira/browse/CB-5971) This would have been a good first bug, too bad
+* [CB-4404](https://issues.apache.org/jira/browse/CB-4404) Changing where android:windowSoftInputMode is in the manifest so it works
+* Add documentation referencing other implementation.
+* [CB-6851](https://issues.apache.org/jira/browse/CB-6851) Deprecate WebView.sendJavascript()
+* [CB-6876](https://issues.apache.org/jira/browse/CB-6876) Show the correct executable name
+* [CB-6876](https://issues.apache.org/jira/browse/CB-6876) Fix the "print usage"
+* Trivial spelling fix in comments when reading CordovaResourceApi
+* [CB-6818](https://issues.apache.org/jira/browse/CB-6818) I want to remove this code, because Square didn't do their headers properly
+* [CB-6860](https://issues.apache.org/jira/browse/CB-6860) Add activity_name and launcher_name to AndroidManifest.xml & strings.xml
+* Add a comment to custom_rules.xml saying why we move AndroidManifest.xml
+* Remove +x from README.md
+* [CB-6784](https://issues.apache.org/jira/browse/CB-6784) Add missing licenses
+* [CB-6784](https://issues.apache.org/jira/browse/CB-6784) Add license to CONTRIBUTING.md
+* Revert "defaults.xml: Add AndroidLaunchMode preference"
+* updated RELEASENOTES
+* [CB-6315](https://issues.apache.org/jira/browse/CB-6315) Wrapping this so it runs on the UI thread
+* [CB-6723](https://issues.apache.org/jira/browse/CB-6723) Update package name for Robotium
+* [CB-6707](https://issues.apache.org/jira/browse/CB-6707) Update minSdkVersion to 10 consistently
+* [CB-5652](https://issues.apache.org/jira/browse/CB-5652) make visible cordova version
+* Update JS snapshot to version 3.6.0-dev (via coho)
+* Update JS snapshot to version 3.6.0-dev (via coho)
+* Set VERSION to 3.6.0-dev (via coho)
+
+### 3.5.1 (August 2014) ###
+
+This was a security update to address CVE-2014-3500, CVE-2014-3501,
+and CVE-2014-3502. For more information, see
+http://cordova.apache.org/announcements/2014/08/04/android-351.html
+
+* Filter out non-launchable intents
+* Handle unsupported protocol errors in webview better
+* Update the errorurl to no longer use intents
+* Refactoring the URI handling on Cordova, removing dead code
+
+### 3.5.0 (May 2014) ###
+
+* OkHttp has broken headers. Updating for ASF compliance.
+* Revert accidentally removed lines from NOTICE
+* [CB-6552](https://issues.apache.org/jira/browse/CB-6552) added top level package.json
+* [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md
+* [CB-6543](https://issues.apache.org/jira/browse/CB-6543) Fix cordova/run failure when no custom_rules.xml available
+* defaults.xml: Add AndroidLaunchMode preference
+* Add JavaDoc for CordovaResourceApi
+* [CB-6388](https://issues.apache.org/jira/browse/CB-6388) Handle binary data correctly in LOAD_URL bridge
+* Fix [CB-6048](https://issues.apache.org/jira/browse/CB-6048) Set launchMode=singleTop so tapping app icon does not always restart app
+* Remove incorrect usage of AlertDialog.Builder.create
+* Catch uncaught exceptions in from plugins and turn them into error responses.
+* Add NOTICE file
+* [CB-6047](https://issues.apache.org/jira/browse/CB-6047) Fix online sometimes getting in a bad state on page transitions.
+* Add another convenience overload for CordovaResourceApi.copyResource
+* Update framework's .classpath to what Eclipse wants it to be.
+* README.md: `android update` to `android-19`.
+* Fix NPE when POLLING bridge mode is used.
+* Updating NOTICE to include Square for OkHttp
+* [CB-5398](https://issues.apache.org/jira/browse/CB-5398) Apply KitKat content URI fix to all content URIs
+* [CB-5398](https://issues.apache.org/jira/browse/CB-5398) Work-around for KitKat content: URLs not rendering in tags
+* [CB-5908](https://issues.apache.org/jira/browse/CB-5908) add splascreen images to template
+* [CB-5395](https://issues.apache.org/jira/browse/CB-5395) Make scheme and host (but not path) case-insensitive in whitelist
+* Ignore multiple onPageFinished() callbacks & onReceivedError due to stopLoading()
+* Removing addJavascriptInterface support from all Android versions lower than 4.2 due to security vu
+* [CB-4984](https://issues.apache.org/jira/browse/CB-4984) Don't create on CordovaActivity name
+* [CB-5917](https://issues.apache.org/jira/browse/CB-5917) Add a loadUrlIntoView overload that doesn't recreate plugins.
+* Use thread pool for load timeout.
+* [CB-5715](https://issues.apache.org/jira/browse/CB-5715) For CLI, hide assets/www and res/xml/config.xml by default
+* [CB-5793](https://issues.apache.org/jira/browse/CB-5793) ant builds: Rename AndroidManifest during -post-build to avoid Eclipse detecting ant-build/
+* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Make update script find project name instead of using "null" for CordovaLib
+* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Add a message in the update script about needing to import CordovaLib when using an IDE.
+
+### 3.4.0 (Feb 2014) ###
+
+43 commits from 10 authors. Highlights include:
+
+* Removing addJavascriptInterface support from all Android versions lower than 4.2 due to security vulnerability
+* [CB-5917](https://issues.apache.org/jira/browse/CB-5917) Add a loadUrlIntoView overload that doesn't recreate plugins.
+* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Make update script find project name instead of using "null" for CordovaLib
+* [CB-5889](https://issues.apache.org/jira/browse/CB-5889) Add a message in the update script about needing to import CordovaLib when using an IDE.
+* [CB-5793](https://issues.apache.org/jira/browse/CB-5793) Don't clean before build and change output directory to ant-build to avoid conflicts with Eclipse.
+* [CB-5803](https://issues.apache.org/jira/browse/CB-5803) Fix cordova/emulate on windows.
+* [CB-5801](https://issues.apache.org/jira/browse/CB-5801) exec->spawn in build to make sure compile errors are shown.
+* [CB-5799](https://issues.apache.org/jira/browse/CB-5799) Update version of OkHTTP to 1.3
+* [CB-4910](https://issues.apache.org/jira/browse/CB-4910) Update CLI project template to point to config.xml at the root now that it's not in www/ by default.
+* [CB-5504](https://issues.apache.org/jira/browse/CB-5504) Adding onDestroy to app plugin to deregister telephonyReceiver
+* [CB-5715](https://issues.apache.org/jira/browse/CB-5715) Add Eclipse .project file to create template. For CLI projects, it adds refs for root www/ & config.xml and hides platform versions
+* [CB-5447](https://issues.apache.org/jira/browse/CB-5447) Removed android:debuggable=“true” from project template.
+* [CB-5714](https://issues.apache.org/jira/browse/CB-5714) Fix of android build when too big output stops build with error due to buffer overflow.
+* [CB-5592](https://issues.apache.org/jira/browse/CB-5592) Set MIME type for openExternal when scheme is file:
+
+### 3.3.0 (Dec 2013) ###
+
+41 commits from 11 authors. Highlights include:
+
+* [CB-5481](https://issues.apache.org/jira/browse/CB-5481) Fix for Cordova trying to get config.xml from the wrong namespace
+* [CB-5487](https://issues.apache.org/jira/browse/CB-5487) Enable Remote Debugging when your Android app is debuggable.
+* [CB-5445](https://issues.apache.org/jira/browse/CB-5445) Adding onScrollChanged and the ScrollEvent object
+* [CB-5422](https://issues.apache.org/jira/browse/CB-5422) Don't require JAVA_HOME to be defined
+* [CB-5490](https://issues.apache.org/jira/browse/CB-5490) Add javadoc target to ant script
+* [CB-5471](https://issues.apache.org/jira/browse/CB-5471) Deprecated DroidGap class
+* [CB-5255](https://issues.apache.org/jira/browse/CB-5255) Prefer Google API targets over android-## targets when building.
+* [CB-5232](https://issues.apache.org/jira/browse/CB-5232) Change create script to use Cordova as a Library Project instead of a .jar
+* [CB-5302](https://issues.apache.org/jira/browse/CB-5302) Massive movement to get tests working again
+* [CB-4996](https://issues.apache.org/jira/browse/CB-4996) Fix paths with spaces while launching on emulator and device
+* [CB-5209](https://issues.apache.org/jira/browse/CB-5209) Cannot build Android app if project path contains spaces
+
+
+### 3.2.0 (Nov 2013) ###
+
+27 commits from 7 authors. Highlights include:
+
+* [CB-5193](https://issues.apache.org/jira/browse/CB-5193) Fix Android WebSQL sometime throwing SECURITY_ERR.
+* [CB-5191](https://issues.apache.org/jira/browse/CB-5191) Deprecate
+* Updating shelljs to 0.2.6. Copy now preserves mode bits.
+* [CB-4872](https://issues.apache.org/jira/browse/CB-4872) Added android version scripts (android_sdk_version, etc)
+* [CB-5117](https://issues.apache.org/jira/browse/CB-5117) Output confirmation message if check_reqs passes.
+* [CB-5080](https://issues.apache.org/jira/browse/CB-5080) Find resources in a way that works with aapt's --rename-manifest-package
+* [CB-4527](https://issues.apache.org/jira/browse/CB-4527) Don't delete .bat files even when on non-windows platform
+* [CB-4892](https://issues.apache.org/jira/browse/CB-4892) Fix create script only escaping the first space instead of all spaces.
+
+### 3.1.0 (Sept 2013) ###
+
+55 commits from 9 authors. Highlights include:
+
+* [CB-4817](https://issues.apache.org/jira/browse/CB-4817) Remove unused assets in project template.
+* Fail fast in create script if package name is not com.foo.bar.
+* [CB-4782](https://issues.apache.org/jira/browse/CB-4782) Convert ApplicationInfo.java -> appinfo.js
+* [CB-4766](https://issues.apache.org/jira/browse/CB-4766) Deprecated JSONUtils.java (moved into plugins)
+* [CB-4765](https://issues.apache.org/jira/browse/CB-4765) Deprecated ExifHelper.java (moved into plugins)
+* [CB-4764](https://issues.apache.org/jira/browse/CB-4764) Deprecated DirectoryManager.java (moved into plugins)
+* [CB-4763](https://issues.apache.org/jira/browse/CB-4763) Deprecated FileHelper.java (moved into plugins), Move getMimeType() into CordovaResourceApi.
+* [CB-4725](https://issues.apache.org/jira/browse/CB-4725) Add CordovaWebView.CORDOVA_VERSION constant
+* Incrementing version check for Android 4.3 API Level 18
+* [CB-3542](https://issues.apache.org/jira/browse/CB-3542) rewrote cli tooling scripts in node
+* Allow CordovaChromeClient subclasses access to CordovaInterface and CordovaWebView members
+* Refactor CordovaActivity.init so that subclasses can easily override factory methods for webview objects
+* [CB-4652](https://issues.apache.org/jira/browse/CB-4652) Allow default project template to be overridden on create
+* Tweak the online bridge to not send excess online events.
+* [CB-4495](https://issues.apache.org/jira/browse/CB-4495) Modify start-emulator script to exit immediately on a fatal emulator error.
+* Log WebView IOExceptions only when they are not 404s
+* Use a higher threshold for slow exec() warnings when debugger is attached.
+* Fix data URI decoding in CordovaResourceApi
+* [CB-3819](https://issues.apache.org/jira/browse/CB-3819) Made it easier to set SplashScreen delay.
+* [CB-4013](https://issues.apache.org/jira/browse/CB-4013) Fixed loadUrlTimeoutValue preference.
+* Upgrading project to Android 4.3
+* [CB-4198](https://issues.apache.org/jira/browse/CB-4198) bin/create script should be better at handling non-word characters in activity name. Patched windows script as well.
+* [CB-4198](https://issues.apache.org/jira/browse/CB-4198) bin/create should handle spaces in activity better.
+* [CB-4096](https://issues.apache.org/jira/browse/CB-4096) Implemented new unified whitelist for android
+* [CB-3384](https://issues.apache.org/jira/browse/CB-3384) Fix thread assertion when plugins remap URIs
+
diff --git a/node_modules/cordova-android/framework/AndroidManifest.xml b/node_modules/cordova-android/framework/AndroidManifest.xml
new file mode 100644
index 0000000..320c253
--- /dev/null
+++ b/node_modules/cordova-android/framework/AndroidManifest.xml
@@ -0,0 +1,22 @@
+
+
+
+
diff --git a/node_modules/cordova-android/framework/build.gradle b/node_modules/cordova-android/framework/build.gradle
new file mode 100644
index 0000000..38cd42d
--- /dev/null
+++ b/node_modules/cordova-android/framework/build.gradle
@@ -0,0 +1,91 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+buildscript {
+ apply from: 'cordova.gradle'
+ apply from: 'repositories.gradle'
+
+ repositories repos
+
+ dependencies {
+ // Android Gradle Plugin (AGP) Build Tools
+ classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
+ }
+}
+
+allprojects {
+ def hasRepositoriesGradle = file('repositories.gradle').exists()
+ if (hasRepositoriesGradle) {
+ apply from: 'repositories.gradle'
+ } else {
+ apply from: "${project.rootDir}/repositories.gradle"
+ }
+
+ repositories repos
+}
+
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion cordovaConfig.SDK_VERSION
+ buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ // For the Android Cordova Lib, we allow changing the minSdkVersion, but it is at the users own risk
+ defaultConfig {
+ minSdkVersion cordovaConfig.MIN_SDK_VERSION
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ }
+ }
+
+ packagingOptions {
+ exclude 'META-INF/LICENSE'
+ exclude 'META-INF/LICENSE.txt'
+ exclude 'META-INF/DEPENDENCIES'
+ exclude 'META-INF/NOTICE'
+ }
+}
+
+dependencies {
+ implementation "androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
+ implementation "androidx.webkit:webkit:${cordovaConfig.ANDROIDX_WEBKIT_VERSION}"
+}
+
+/**
+ * In a project created though CLI, the `cordova-publish.gradle` file is not copied to the `framework` dir.
+ * App development (CLI) projects can not and should not publish our framework.
+ * In this case, there is no need for the gradle build process to know about the publish process.
+ */
+def cordovaPublishGradle = './cordova-publish.gradle'
+if(file(cordovaPublishGradle).exists()) {
+ apply from: cordovaPublishGradle
+}
diff --git a/node_modules/cordova-android/framework/cdv-gradle-config-defaults.json b/node_modules/cordova-android/framework/cdv-gradle-config-defaults.json
new file mode 100644
index 0000000..bf5caf2
--- /dev/null
+++ b/node_modules/cordova-android/framework/cdv-gradle-config-defaults.json
@@ -0,0 +1,13 @@
+{
+ "MIN_SDK_VERSION": 22,
+ "SDK_VERSION": 30,
+ "GRADLE_VERSION": "7.1.1",
+ "MIN_BUILD_TOOLS_VERSION": "30.0.3",
+ "AGP_VERSION": "4.2.2",
+ "KOTLIN_VERSION": "1.5.21",
+ "ANDROIDX_APP_COMPAT_VERSION": "1.3.1",
+ "ANDROIDX_WEBKIT_VERSION": "1.4.0",
+ "GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.8",
+ "IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": false,
+ "IS_GRADLE_PLUGIN_KOTLIN_ENABLED": false
+}
diff --git a/node_modules/cordova-android/framework/cordova-publish.gradle b/node_modules/cordova-android/framework/cordova-publish.gradle
new file mode 100644
index 0000000..30d9e4e
--- /dev/null
+++ b/node_modules/cordova-android/framework/cordova-publish.gradle
@@ -0,0 +1,125 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+String getCordovaAndroidVersion() {
+ // Fetch Data from Cordova-Android package.json (Used only by framework build/publishing)
+ def cordovaAndroidRepoPackageJson = "$projectDir/../package.json"
+ if(file(cordovaAndroidRepoPackageJson).exists()) {
+ def packageJsonFile = new File(cordovaAndroidRepoPackageJson)
+ def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
+ return packageJson.version
+ }
+}
+
+// Enable signing by default when keyId and secretKeyRingFile is defined.
+ext.cdvEnableSigning = project.hasProperty('signing.keyId') && project.hasProperty('signing.secretKeyRingFile')
+if (cdvEnableSigning) {
+ logger.debug('[Cordova] Signing has been enabled by default because the signing keyId & secretKeyRingFile has been defined.')
+}
+
+if (project.hasProperty('signEnabled')) {
+ if(!cdvEnableSigning && Boolean.valueOf(signEnabled)) {
+ logger.debug("[Cordova] The \"signEnabled\" override can not be set to \"true\" when the signing properties are missing.")
+ } else {
+ // Override the default setting with the "signEnabled" property. (In this case it should only accept false)
+ logger.debug("[Cordova] The \"signEnabled\" property has been detected and forcing enabled signing to \"$signEnabled\".")
+ cdvEnableSigning = signEnabled
+ }
+}
+
+task sourcesJar(type: Jar) {
+ from android.sourceSets.main.java.srcDirs
+ classifier = 'sources'
+}
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ groupId = 'org.apache.cordova'
+ artifactId = 'framework'
+ version = getCordovaAndroidVersion()
+
+ artifact(sourcesJar)
+ artifact("$buildDir/outputs/aar/framework-release.aar")
+
+ pom {
+ name = 'Cordova'
+ description = 'A library to build Cordova-based projects for the Android platform.'
+ url = 'https://cordova.apache.org'
+
+ licenses {
+ license {
+ name = 'Apache License, Version 2.0'
+ url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+
+ developers {
+ developer {
+ id = 'stevengill'
+ name = 'Steve Gill'
+ }
+ developer {
+ id = 'erisu'
+ name = 'Bryan Ellis'
+ email = 'erisu@apache.org'
+ }
+ }
+
+ scm {
+ connection = 'scm:git:https://github.com/apache/cordova-android.git'
+ developerConnection = 'scm:git:git@github.com:apache/cordova-android.git'
+ url = 'https://github.com/apache/cordova-android'
+ }
+ }
+ }
+ }
+
+ repositories {
+ maven {
+ def releasesRepoUrl = 'https://repository.apache.org/content/repositories/releases'
+ def snapshotsRepoUrl = 'https://repository.apache.org/content/repositories/snapshots'
+
+ url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
+
+ credentials {
+ if (project.hasProperty('apacheUsername') && project.hasProperty('apachePassword')) {
+ username apacheUsername
+ password apachePassword
+ }
+ }
+ }
+ }
+
+ signing {
+ if (Boolean.valueOf(cdvEnableSigning)) {
+ sign publishing.publications.mavenJava
+ }
+ }
+}
+
+tasks.whenTaskAdded {task ->
+ if(task.name.contains('sign')) {
+ logger.debug("[Cordova] The task \"${task.name}\" is enabled? ${cdvEnableSigning}")
+ task.enabled = cdvEnableSigning
+ }
+}
diff --git a/node_modules/cordova-android/framework/cordova.gradle b/node_modules/cordova-android/framework/cordova.gradle
new file mode 100644
index 0000000..d6d0d69
--- /dev/null
+++ b/node_modules/cordova-android/framework/cordova.gradle
@@ -0,0 +1,241 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+import java.util.regex.Pattern
+import io.github.g00fy2.versioncompare.Version
+
+String doEnsureValueExists(filePath, props, key) {
+ if (props.get(key) == null) {
+ throw new GradleException(filePath + ': Missing key required "' + key + '"')
+ }
+ return props.get(key)
+}
+
+String doGetProjectTarget() {
+ def props = new Properties()
+ def propertiesFile = 'project.properties';
+ if(!(file(propertiesFile).exists())) {
+ propertiesFile = '../project.properties';
+ }
+ file(propertiesFile).withReader { reader ->
+ props.load(reader)
+ }
+ return doEnsureValueExists('project.properties', props, 'target')
+}
+
+Boolean isVersionValid(version) {
+ return !(new Version(version)).isEqual('0.0.0')
+}
+
+String doFindLatestInstalledBuildTools(String minBuildToolsVersionString) {
+ def buildToolsDirContents
+ try {
+ def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
+ buildToolsDirContents = buildToolsDir.list()
+ } catch (e) {
+ println "An exception occurred while trying to find the Android build tools."
+ throw e
+ }
+
+ def minBuildToolsVersion = new Version(minBuildToolsVersionString)
+ def maxVersion = new Version((minBuildToolsVersion.getMajor() + 1) + ".0.0")
+
+ def highestBuildToolsVersion = buildToolsDirContents
+ .collect { new Version(it) }
+ // Invalid inputs will be handled as 0.0.0
+ .findAll { it.isHigherThan('0.0.0') && it.isLowerThan(maxVersion) }
+ .max()
+
+ if (highestBuildToolsVersion == null) {
+ throw new RuntimeException("""
+ No installed build tools found. Please install the Android build tools
+ version ${minBuildToolsVersionString}.
+ """.replaceAll(/\s+/, ' ').trim())
+ }
+
+ if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {
+ throw new RuntimeException("""
+ No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is
+ ${highestBuildToolsVersion.getOriginalString()}; Recommended version
+ is ${minBuildToolsVersionString}.
+ """.replaceAll(/\s+/, ' ').trim())
+ }
+
+ highestBuildToolsVersion.getOriginalString()
+}
+
+String getAndroidSdkDir() {
+ def rootDir = project.rootDir
+ def androidSdkDir = null
+ String envVar = System.getenv("ANDROID_SDK_ROOT")
+ if (envVar == null) {
+ envVar = System.getenv("ANDROID_HOME")
+ }
+
+ def localProperties = new File(rootDir, 'local.properties')
+ String systemProperty = System.getProperty("android.home")
+ if (envVar != null) {
+ androidSdkDir = envVar
+ } else if (localProperties.exists()) {
+ Properties properties = new Properties()
+ localProperties.withInputStream { instr ->
+ properties.load(instr)
+ }
+ def sdkDirProp = properties.getProperty('sdk.dir')
+ if (sdkDirProp != null) {
+ androidSdkDir = sdkDirProp
+ } else {
+ sdkDirProp = properties.getProperty('android.dir')
+ if (sdkDirProp != null) {
+ androidSdkDir = (new File(rootDir, sdkDirProp)).getAbsolutePath()
+ }
+ }
+ }
+ if (androidSdkDir == null && systemProperty != null) {
+ androidSdkDir = systemProperty
+ }
+ if (androidSdkDir == null) {
+ throw new RuntimeException(
+ "Unable to determine Android SDK directory.")
+ }
+ androidSdkDir
+}
+
+def doExtractIntFromManifest(name) {
+ def manifestFile = file(android.sourceSets.main.manifest.srcFile)
+ def pattern = Pattern.compile(name + "=\"(\\d+)\"")
+ def matcher = pattern.matcher(manifestFile.getText())
+ matcher.find()
+ return new BigInteger(matcher.group(1))
+}
+
+def doExtractStringFromManifest(name) {
+ def manifestFile = file(android.sourceSets.main.manifest.srcFile)
+ def pattern = Pattern.compile(name + "=\"(\\S+)\"")
+ def matcher = pattern.matcher(manifestFile.getText())
+ matcher.find()
+ return matcher.group(1)
+}
+
+def doGetConfigXml() {
+ def xml = file("src/main/res/xml/config.xml").getText()
+ // Disable namespace awareness since Cordova doesn't use them properly
+ return new XmlParser(false, false).parseText(xml)
+}
+
+def doGetConfigPreference(name, defaultValue) {
+ name = name.toLowerCase()
+ def root = doGetConfigXml()
+
+ def ret = defaultValue
+ root.preference.each { it ->
+ def attrName = it.attribute("name")
+ if (attrName && attrName.toLowerCase() == name) {
+ ret = it.attribute("value")
+ }
+ }
+ return ret
+}
+
+def doApplyCordovaConfigCustomization() {
+ // Apply user overide properties that comes from the "--gradleArg=-P" parameters
+ if (project.hasProperty('cdvMinSdkVersion')) {
+ cordovaConfig.MIN_SDK_VERSION = Integer.parseInt('' + cdvMinSdkVersion)
+ }
+ if (project.hasProperty('cdvSdkVersion')) {
+ cordovaConfig.SDK_VERSION = Integer.parseInt('' + cdvSdkVersion)
+ }
+ if (project.hasProperty('cdvMaxSdkVersion')) {
+ cordovaConfig.MAX_SDK_VERSION = Integer.parseInt('' + cdvMaxSdkVersion)
+ }
+ if (project.hasProperty('cdvBuildToolsVersion')) {
+ cordovaConfig.BUILD_TOOLS_VERSION = cdvBuildToolsVersion
+ }
+ if (project.hasProperty('cdvAndroidXAppCompatVersion')) {
+ cordovaConfig.ANDROIDX_APP_COMPAT_VERSION = cdvAndroidXAppCompatVersion
+ }
+ if (project.hasProperty('cdvAndroidXWebKitVersion')) {
+ cordovaConfig.ANDROIDX_WEBKIT_VERSION = cdvAndroidXWebKitVersion
+ }
+
+ if (!cordovaConfig.BUILD_TOOLS_VERSION) {
+ cordovaConfig.BUILD_TOOLS_VERSION = doFindLatestInstalledBuildTools(
+ cordovaConfig.MIN_BUILD_TOOLS_VERSION
+ )
+ }
+
+ // Ensure the configured build tools version is at least our declared minimum
+ def buildToolsVersion = new Version(cordovaConfig.BUILD_TOOLS_VERSION)
+ if (buildToolsVersion.isLowerThan(cordovaConfig.MIN_BUILD_TOOLS_VERSION)) {
+ throw new RuntimeException("""
+ Expected Android Build Tools version >= ${cordovaConfig.MIN_BUILD_TOOLS_VERSION},
+ but got Android Build Tools version ${cordovaConfig.BUILD_TOOLS_VERSION}. Please use version ${cordovaConfig.MIN_BUILD_TOOLS_VERSION} or later.
+ """.replaceAll(/\s+/, ' ').trim())
+ }
+}
+
+// Properties exported here are visible to all plugins.
+ext {
+ def defaultsFilePath = './cdv-gradle-config-defaults.json'
+ def projectConfigFilePath = "$rootDir/cdv-gradle-config.json"
+ def targetConfigFilePath = null
+
+ /**
+ * Check if the project config file path exists. This file will exist if coming from CLI project.
+ * If this file does not exist, falls back onto the default file.
+ * This scenario can occur if building the framework's AAR package for publishing.
+ */
+ if(file(projectConfigFilePath).exists()) {
+ targetConfigFilePath = projectConfigFilePath
+ } else {
+ targetConfigFilePath = defaultsFilePath
+ }
+
+ def jsonFile = new File(targetConfigFilePath)
+ cordovaConfig = new groovy.json.JsonSlurper().parseText(jsonFile.text)
+
+ // Apply Gradle Properties
+ doApplyCordovaConfigCustomization()
+
+ // These helpers are shared, but are not guaranteed to be stable / unchanged.
+ privateHelpers = {}
+ privateHelpers.getProjectTarget = { doGetProjectTarget() }
+ privateHelpers.applyCordovaConfigCustomization = { doApplyCordovaConfigCustomization() }
+ privateHelpers.extractIntFromManifest = { name -> doExtractIntFromManifest(name) }
+ privateHelpers.extractStringFromManifest = { name -> doExtractStringFromManifest(name) }
+ privateHelpers.ensureValueExists = { filePath, props, key -> doEnsureValueExists(filePath, props, key) }
+
+ // These helpers can be used by plugins / projects and will not change.
+ cdvHelpers = {}
+ // Returns a XmlParser for the config.xml. Added in 4.1.0.
+ cdvHelpers.getConfigXml = { doGetConfigXml() }
+ // Returns the value for the desired . Added in 4.1.0.
+ cdvHelpers.getConfigPreference = { name, defaultValue -> doGetConfigPreference(name, defaultValue) }
+}
+
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'io.github.g00fy2:versioncompare:1.4.1@jar'
+ }
+}
diff --git a/node_modules/cordova-android/framework/gradle.properties b/node_modules/cordova-android/framework/gradle.properties
new file mode 100644
index 0000000..30d2ba9
--- /dev/null
+++ b/node_modules/cordova-android/framework/gradle.properties
@@ -0,0 +1,19 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+android.useAndroidX=true
+android.enableJetifier=true
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/node_modules/cordova-android/framework/gradle/wrapper/gradle-wrapper.properties b/node_modules/cordova-android/framework/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..46d87b8
--- /dev/null
+++ b/node_modules/cordova-android/framework/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+#Thu Nov 09 10:50:25 PST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/node_modules/cordova-android/framework/project.properties b/node_modules/cordova-android/framework/project.properties
new file mode 100644
index 0000000..8532755
--- /dev/null
+++ b/node_modules/cordova-android/framework/project.properties
@@ -0,0 +1,12 @@
+# GENERATED FILE! DO NOT EDIT!
+
+# This file was originally created by the Android Tools, but is now
+# used by cordova-android to manage the project configuration.
+
+# Indicates whether an apk should be generated for each density.
+split.density=false
+
+# Project target.
+apk-configurations=
+renderscript.opt.level=O0
+android.library=true
diff --git a/node_modules/cordova-android/framework/repositories.gradle b/node_modules/cordova-android/framework/repositories.gradle
new file mode 100644
index 0000000..01e73fd
--- /dev/null
+++ b/node_modules/cordova-android/framework/repositories.gradle
@@ -0,0 +1,22 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+ext.repos = {
+ google()
+ mavenCentral()
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/AllowList.java b/node_modules/cordova-android/framework/src/org/apache/cordova/AllowList.java
new file mode 100644
index 0000000..4b4bafc
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/AllowList.java
@@ -0,0 +1,170 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.cordova.LOG;
+
+import android.net.Uri;
+
+public class AllowList {
+ private static class URLPattern {
+ public Pattern scheme;
+ public Pattern host;
+ public Integer port;
+ public Pattern path;
+
+ private String regexFromPattern(String pattern, boolean allowWildcards) {
+ final String toReplace = "\\.[]{}()^$?+|";
+ StringBuilder regex = new StringBuilder();
+ for (int i=0; i < pattern.length(); i++) {
+ char c = pattern.charAt(i);
+ if (c == '*' && allowWildcards) {
+ regex.append(".");
+ } else if (toReplace.indexOf(c) > -1) {
+ regex.append('\\');
+ }
+ regex.append(c);
+ }
+ return regex.toString();
+ }
+
+ public URLPattern(String scheme, String host, String port, String path) throws MalformedURLException {
+ try {
+ if (scheme == null || "*".equals(scheme)) {
+ this.scheme = null;
+ } else {
+ this.scheme = Pattern.compile(regexFromPattern(scheme, false), Pattern.CASE_INSENSITIVE);
+ }
+ if ("*".equals(host)) {
+ this.host = null;
+ } else if (host.startsWith("*.")) {
+ this.host = Pattern.compile("([a-z0-9.-]*\\.)?" + regexFromPattern(host.substring(2), false), Pattern.CASE_INSENSITIVE);
+ } else {
+ this.host = Pattern.compile(regexFromPattern(host, false), Pattern.CASE_INSENSITIVE);
+ }
+ if (port == null || "*".equals(port)) {
+ this.port = null;
+ } else {
+ this.port = Integer.parseInt(port,10);
+ }
+ if (path == null || "/*".equals(path)) {
+ this.path = null;
+ } else {
+ this.path = Pattern.compile(regexFromPattern(path, true));
+ }
+ } catch (NumberFormatException e) {
+ throw new MalformedURLException("Port must be a number");
+ }
+ }
+
+ public boolean matches(Uri uri) {
+ try {
+ return ((scheme == null || scheme.matcher(uri.getScheme()).matches()) &&
+ (host == null || host.matcher(uri.getHost()).matches()) &&
+ (port == null || port.equals(uri.getPort())) &&
+ (path == null || path.matcher(uri.getPath()).matches()));
+ } catch (Exception e) {
+ LOG.d(TAG, e.toString());
+ return false;
+ }
+ }
+ }
+
+ private ArrayList allowList;
+
+ public static final String TAG = "CordovaAllowList";
+
+ public AllowList() {
+ this.allowList = new ArrayList();
+ }
+
+ /* Match patterns (from http://developer.chrome.com/extensions/match_patterns.html)
+ *
+ * := ://
+ * := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome-extension'
+ * := '*' | '*.' +
+ * := '/'
+ *
+ * We extend this to explicitly allow a port attached to the host, and we allow
+ * the scheme to be omitted for backwards compatibility. (Also host is not required
+ * to begin with a "*" or "*.".)
+ */
+ public void addAllowListEntry(String origin, boolean subdomains) {
+ if (allowList != null) {
+ try {
+ // Unlimited access to network resources
+ if (origin.compareTo("*") == 0) {
+ LOG.d(TAG, "Unlimited access to network resources");
+ allowList = null;
+ }
+ else { // specific access
+ Pattern parts = Pattern.compile("^((\\*|[A-Za-z-]+):(//)?)?(\\*|((\\*\\.)?[^*/:]+))?(:(\\d+))?(/.*)?");
+ Matcher m = parts.matcher(origin);
+ if (m.matches()) {
+ String scheme = m.group(2);
+ String host = m.group(4);
+ // Special case for two urls which are allowed to have empty hosts
+ if (("file".equals(scheme) || "content".equals(scheme)) && host == null) host = "*";
+ String port = m.group(8);
+ String path = m.group(9);
+ if (scheme == null) {
+ // XXX making it stupid friendly for people who forget to include protocol/SSL
+ allowList.add(new URLPattern("http", host, port, path));
+ allowList.add(new URLPattern("https", host, port, path));
+ } else {
+ allowList.add(new URLPattern(scheme, host, port, path));
+ }
+ }
+ }
+ } catch (Exception e) {
+ LOG.d(TAG, "Failed to add origin %s", origin);
+ }
+ }
+ }
+
+
+ /**
+ * Determine if URL is in approved list of URLs to load.
+ *
+ * @param uri
+ * @return true if wide open or allow listed
+ */
+ public boolean isUrlAllowListed(String uri) {
+ // If there is no allowList, then it's wide open
+ if (allowList == null) return true;
+
+ Uri parsedUri = Uri.parse(uri);
+ // Look for match in allow list
+ Iterator pit = allowList.iterator();
+ while (pit.hasNext()) {
+ URLPattern p = pit.next();
+ if (p.matches(parsedUri)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/AllowListPlugin.java b/node_modules/cordova-android/framework/src/org/apache/cordova/AllowListPlugin.java
new file mode 100644
index 0000000..63dd5a1
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/AllowListPlugin.java
@@ -0,0 +1,160 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.ConfigXmlParser;
+import org.apache.cordova.LOG;
+import org.apache.cordova.AllowList;
+import org.apache.cordova.CordovaPreferences;
+import org.xmlpull.v1.XmlPullParser;
+
+import android.content.Context;
+
+public class AllowListPlugin extends CordovaPlugin {
+ public static final String PLUGIN_NAME = "CordovaAllowListPlugin";
+ protected static final String LOG_TAG = "CordovaAllowListPlugin";
+
+ private AllowList allowedNavigations;
+ private AllowList allowedIntents;
+ private AllowList allowedRequests;
+
+ // Used when instantiated via reflection by PluginManager
+ public AllowListPlugin() { }
+
+ // These can be used by embedders to allow Java-configuration of an allow list.
+ public AllowListPlugin(Context context) {
+ this(new AllowList(), new AllowList(), null);
+ new CustomConfigXmlParser().parse(context);
+ }
+
+ public AllowListPlugin(XmlPullParser xmlParser) {
+ this(new AllowList(), new AllowList(), null);
+ new CustomConfigXmlParser().parse(xmlParser);
+ }
+
+ public AllowListPlugin(AllowList allowedNavigations, AllowList allowedIntents, AllowList allowedRequests) {
+ if (allowedRequests == null) {
+ allowedRequests = new AllowList();
+ allowedRequests.addAllowListEntry("file:///*", false);
+ allowedRequests.addAllowListEntry("data:*", false);
+ }
+
+ this.allowedNavigations = allowedNavigations;
+ this.allowedIntents = allowedIntents;
+ this.allowedRequests = allowedRequests;
+ }
+
+ @Override
+ public void pluginInitialize() {
+ if (this.allowedNavigations == null) {
+ this.allowedNavigations = new AllowList();
+ this.allowedIntents = new AllowList();
+ this.allowedRequests = new AllowList();
+
+ new CustomConfigXmlParser().parse(webView.getContext());
+ }
+ }
+
+ private class CustomConfigXmlParser extends ConfigXmlParser {
+ private CordovaPreferences prefs = new CordovaPreferences();
+
+ @Override
+ public void handleStartTag(XmlPullParser xml) {
+ String strNode = xml.getName();
+ if (strNode.equals("content")) {
+ String startPage = xml.getAttributeValue(null, "src");
+ allowedNavigations.addAllowListEntry(startPage, false);
+ } else if (strNode.equals("allow-navigation")) {
+ String origin = xml.getAttributeValue(null, "href");
+ if ("*".equals(origin)) {
+ allowedNavigations.addAllowListEntry("http://*/*", false);
+ allowedNavigations.addAllowListEntry("https://*/*", false);
+ allowedNavigations.addAllowListEntry("data:*", false);
+ } else {
+ allowedNavigations.addAllowListEntry(origin, false);
+ }
+ } else if (strNode.equals("allow-intent")) {
+ String origin = xml.getAttributeValue(null, "href");
+ allowedIntents.addAllowListEntry(origin, false);
+ } else if (strNode.equals("access")) {
+ String origin = xml.getAttributeValue(null, "origin");
+
+ if (origin != null) {
+ if ("*".equals(origin)) {
+ allowedRequests.addAllowListEntry("http://*/*", false);
+ allowedRequests.addAllowListEntry("https://*/*", false);
+ } else {
+ String subdomains = xml.getAttributeValue(null, "subdomains");
+ allowedRequests.addAllowListEntry(origin, (subdomains != null) && (subdomains.compareToIgnoreCase("true") == 0));
+ }
+ }
+ }
+ }
+
+ @Override
+ public void handleEndTag(XmlPullParser xml) { }
+ }
+
+ @Override
+ public Boolean shouldAllowNavigation(String url) {
+ return this.allowedNavigations.isUrlAllowListed(url)
+ ? true
+ : null; // default policy
+ }
+
+ @Override
+ public Boolean shouldAllowRequest(String url) {
+ return (Boolean.TRUE.equals(this.shouldAllowNavigation(url)) || this.allowedRequests.isUrlAllowListed(url))
+ ? true
+ : null; // default policy
+ }
+
+ @Override
+ public Boolean shouldOpenExternalUrl(String url) {
+ return (this.allowedIntents.isUrlAllowListed(url))
+ ? true
+ : null; // default policy
+ }
+
+ public AllowList getAllowedNavigations() {
+ return this.allowedNavigations;
+ }
+
+ public void setAllowedNavigations(AllowList allowedNavigations) {
+ this.allowedNavigations = allowedNavigations;
+ }
+
+ public AllowList getAllowedIntents() {
+ return this.allowedIntents;
+ }
+
+ public void setAllowedIntents(AllowList allowedIntents) {
+ this.allowedIntents = allowedIntents;
+ }
+
+ public AllowList getAllowedRequests() {
+ return this.allowedRequests;
+ }
+
+ public void setAllowedRequests(AllowList allowedRequests) {
+ this.allowedRequests = allowedRequests;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/AuthenticationToken.java b/node_modules/cordova-android/framework/src/org/apache/cordova/AuthenticationToken.java
new file mode 100644
index 0000000..d3a231a
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/AuthenticationToken.java
@@ -0,0 +1,69 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+/**
+ * The Class AuthenticationToken defines the userName and password to be used for authenticating a web resource
+ */
+public class AuthenticationToken {
+ private String userName;
+ private String password;
+
+ /**
+ * Gets the user name.
+ *
+ * @return the user name
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * Sets the user name.
+ *
+ * @param userName
+ * the new user name
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * Gets the password.
+ *
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Sets the password.
+ *
+ * @param password
+ * the new password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+
+
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/BuildHelper.java b/node_modules/cordova-android/framework/src/org/apache/cordova/BuildHelper.java
new file mode 100644
index 0000000..94fe961
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/BuildHelper.java
@@ -0,0 +1,73 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+/*
+ * This is a utility class that allows us to get the BuildConfig variable, which is required
+ * for the use of different providers. This is not guaranteed to work, and it's better for this
+ * to be set in the build step in config.xml
+ *
+ */
+
+import android.app.Activity;
+import android.content.Context;
+
+import java.lang.reflect.Field;
+
+
+public class BuildHelper {
+
+
+ private static String TAG="BuildHelper";
+
+ /*
+ * This needs to be implemented if you wish to use the Camera Plugin or other plugins
+ * that read the Build Configuration.
+ *
+ * Thanks to Phil@Medtronic and Graham Borland for finding the answer and posting it to
+ * StackOverflow. This is annoying as hell! However, this method does not work with
+ * ProGuard, and you should use the config.xml to define the application_id
+ *
+ */
+
+ public static Object getBuildConfigValue(Context ctx, String key)
+ {
+ try
+ {
+ Class> clazz = Class.forName(ctx.getClass().getPackage().getName() + ".BuildConfig");
+ Field field = clazz.getField(key);
+ return field.get(null);
+ } catch (ClassNotFoundException e) {
+ LOG.d(TAG, "Unable to get the BuildConfig, is this built with ANT?");
+ e.printStackTrace();
+ } catch (NoSuchFieldException e) {
+ LOG.d(TAG, key + " is not a valid field. Check your build.gradle");
+ } catch (IllegalAccessException e) {
+ LOG.d(TAG, "Illegal Access Exception: Let's print a stack trace.");
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ LOG.d(TAG, "Null Pointer Exception: Let's print a stack trace.");
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CallbackContext.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CallbackContext.java
new file mode 100644
index 0000000..4336386
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CallbackContext.java
@@ -0,0 +1,142 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import org.json.JSONArray;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.PluginResult;
+import org.json.JSONObject;
+
+public class CallbackContext {
+ private static final String LOG_TAG = "CordovaPlugin";
+
+ private String callbackId;
+ private CordovaWebView webView;
+ protected boolean finished;
+ private int changingThreads;
+
+ public CallbackContext(String callbackId, CordovaWebView webView) {
+ this.callbackId = callbackId;
+ this.webView = webView;
+ }
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public boolean isChangingThreads() {
+ return changingThreads > 0;
+ }
+
+ public String getCallbackId() {
+ return callbackId;
+ }
+
+ public void sendPluginResult(PluginResult pluginResult) {
+ synchronized (this) {
+ if (finished) {
+ LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
+ return;
+ } else {
+ finished = !pluginResult.getKeepCallback();
+ }
+ }
+ webView.sendPluginResult(pluginResult, callbackId);
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(JSONObject message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(String message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(JSONArray message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(byte[] message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ */
+ public void success(int message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ */
+ public void success() {
+ sendPluginResult(new PluginResult(PluginResult.Status.OK));
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ */
+ public void error(JSONObject message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message));
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ */
+ public void error(String message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message));
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ */
+ public void error(int message) {
+ sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message));
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CallbackMap.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CallbackMap.java
new file mode 100644
index 0000000..050daa0
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CallbackMap.java
@@ -0,0 +1,65 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.util.Pair;
+import android.util.SparseArray;
+
+/**
+ * Provides a collection that maps unique request codes to CordovaPlugins and Integers.
+ * Used to ensure that when plugins make requests for runtime permissions, those requests do not
+ * collide with requests from other plugins that use the same request code value.
+ */
+public class CallbackMap {
+ private int currentCallbackId = 0;
+ private SparseArray> callbacks;
+
+ public CallbackMap() {
+ this.callbacks = new SparseArray>();
+ }
+
+ /**
+ * Stores a CordovaPlugin and request code and returns a new unique request code to use
+ * in a permission request.
+ *
+ * @param receiver The plugin that is making the request
+ * @param requestCode The original request code used by the plugin
+ * @return A unique request code that can be used to retrieve this callback
+ * with getAndRemoveCallback()
+ */
+ public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
+ int mappedId = this.currentCallbackId++;
+ callbacks.put(mappedId, new Pair(receiver, requestCode));
+ return mappedId;
+ }
+
+ /**
+ * Retrieves and removes a callback stored in the map using the mapped request code
+ * obtained from registerCallback()
+ *
+ * @param mappedId The request code obtained from registerCallback()
+ * @return The CordovaPlugin and orignal request code that correspond to the
+ * given mappedCode
+ */
+ public synchronized Pair getAndRemoveCallback(int mappedId) {
+ Pair callback = callbacks.get(mappedId);
+ callbacks.remove(mappedId);
+ return callback;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/Config.java b/node_modules/cordova-android/framework/src/org/apache/cordova/Config.java
new file mode 100644
index 0000000..238cd5e
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/Config.java
@@ -0,0 +1,71 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import java.util.List;
+
+import android.app.Activity;
+
+@Deprecated // Use AllowList, CordovaPrefences, etc. directly.
+public class Config {
+ private static final String TAG = "Config";
+
+ static ConfigXmlParser parser;
+
+ private Config() {
+ }
+
+ public static void init(Activity action) {
+ parser = new ConfigXmlParser();
+ parser.parse(action);
+ //TODO: Add feature to bring this back. Some preferences should be overridden by intents, but not all
+ parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras());
+ }
+
+ // Intended to be used for testing only; creates an empty configuration.
+ public static void init() {
+ if (parser == null) {
+ parser = new ConfigXmlParser();
+ }
+ }
+
+ public static String getStartUrl() {
+ if (parser == null) {
+ return "file:///android_asset/www/index.html";
+ }
+ return parser.getLaunchUrl();
+ }
+
+ public static String getErrorUrl() {
+ return parser.getPreferences().getString("errorurl", null);
+ }
+
+ public static List getPluginEntries() {
+ return parser.getPluginEntries();
+ }
+
+ public static CordovaPreferences getPreferences() {
+ return parser.getPreferences();
+ }
+
+ public static boolean isInitialized() {
+ return parser != null;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/ConfigXmlParser.java b/node_modules/cordova-android/framework/src/org/apache/cordova/ConfigXmlParser.java
new file mode 100644
index 0000000..e936517
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/ConfigXmlParser.java
@@ -0,0 +1,188 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import android.content.Context;
+
+public class ConfigXmlParser {
+ private static String TAG = "ConfigXmlParser";
+
+ private static String SCHEME_HTTP = "http";
+ private static String SCHEME_HTTPS = "https";
+ private static String DEFAULT_HOSTNAME = "localhost";
+
+ private String launchUrl;
+ private String contentSrc;
+ private CordovaPreferences prefs = new CordovaPreferences();
+ private ArrayList pluginEntries = new ArrayList(20);
+
+ public CordovaPreferences getPreferences() {
+ return prefs;
+ }
+
+ public ArrayList getPluginEntries() {
+ return pluginEntries;
+ }
+
+ public String getLaunchUrl() {
+ if (launchUrl == null) {
+ setStartUrl(contentSrc);
+ }
+
+ return launchUrl;
+ }
+
+ public void parse(Context action) {
+ // First checking the class namespace for config.xml
+ int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName());
+ if (id == 0) {
+ // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
+ id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
+ if (id == 0) {
+ LOG.e(TAG, "res/xml/config.xml is missing!");
+ return;
+ }
+ }
+
+ pluginEntries.add(
+ new PluginEntry(
+ AllowListPlugin.PLUGIN_NAME,
+ "org.apache.cordova.AllowListPlugin",
+ true
+ )
+ );
+
+ parse(action.getResources().getXml(id));
+ }
+
+ boolean insideFeature = false;
+ String service = "", pluginClass = "", paramType = "";
+ boolean onload = false;
+
+ public void parse(XmlPullParser xml) {
+ int eventType = -1;
+
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ if (eventType == XmlPullParser.START_TAG) {
+ handleStartTag(xml);
+ }
+ else if (eventType == XmlPullParser.END_TAG)
+ {
+ handleEndTag(xml);
+ }
+ try {
+ eventType = xml.next();
+ } catch (XmlPullParserException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void handleStartTag(XmlPullParser xml) {
+ String strNode = xml.getName();
+ if (strNode.equals("feature")) {
+ //Check for supported feature sets aka. plugins (Accelerometer, Geolocation, etc)
+ //Set the bit for reading params
+ insideFeature = true;
+ service = xml.getAttributeValue(null, "name");
+ }
+ else if (insideFeature && strNode.equals("param")) {
+ paramType = xml.getAttributeValue(null, "name");
+ if (paramType.equals("service")) // check if it is using the older service param
+ service = xml.getAttributeValue(null, "value");
+ else if (paramType.equals("package") || paramType.equals("android-package"))
+ pluginClass = xml.getAttributeValue(null,"value");
+ else if (paramType.equals("onload"))
+ onload = "true".equals(xml.getAttributeValue(null, "value"));
+ }
+ else if (strNode.equals("preference")) {
+ String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH);
+ String value = xml.getAttributeValue(null, "value");
+ prefs.set(name, value);
+ }
+ else if (strNode.equals("content")) {
+ String src = xml.getAttributeValue(null, "src");
+ if (src != null) {
+ contentSrc = src;
+ } else {
+ // Default
+ contentSrc = "index.html";
+ }
+ }
+ }
+
+ public void handleEndTag(XmlPullParser xml) {
+ String strNode = xml.getName();
+ if (strNode.equals("feature")) {
+ pluginEntries.add(new PluginEntry(service, pluginClass, onload));
+
+ service = "";
+ pluginClass = "";
+ insideFeature = false;
+ onload = false;
+ }
+ }
+
+ private String getLaunchUrlPrefix() {
+ if (prefs.getBoolean("AndroidInsecureFileModeEnabled", false)) {
+ return "file:///android_asset/www/";
+ } else {
+ String scheme = prefs.getString("scheme", SCHEME_HTTPS).toLowerCase();
+ String hostname = prefs.getString("hostname", DEFAULT_HOSTNAME);
+
+ if (!scheme.contentEquals(SCHEME_HTTP) && !scheme.contentEquals(SCHEME_HTTPS)) {
+ LOG.d(TAG, "The provided scheme \"" + scheme + "\" is not valid. " +
+ "Defaulting to \"" + SCHEME_HTTPS + "\". " +
+ "(Valid Options=" + SCHEME_HTTP + "," + SCHEME_HTTPS + ")");
+
+ scheme = SCHEME_HTTPS;
+ }
+
+ return scheme + "://" + hostname + '/';
+ }
+ }
+
+ private void setStartUrl(String src) {
+ Pattern schemeRegex = Pattern.compile("^[a-z-]+://");
+ Matcher matcher = schemeRegex.matcher(src);
+
+ if (matcher.find()) {
+ launchUrl = src;
+ } else {
+ String launchUrlPrefix = getLaunchUrlPrefix();
+
+ // remove leading slash, "/", from content src if existing,
+ if (src.charAt(0) == '/') {
+ src = src.substring(1);
+ }
+
+ launchUrl = launchUrlPrefix + src;
+ }
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaActivity.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaActivity.java
new file mode 100644
index 0000000..5cdded6
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaActivity.java
@@ -0,0 +1,530 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.AlertDialog;
+import android.annotation.SuppressLint;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.graphics.Color;
+import android.media.AudioManager;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.webkit.WebViewClient;
+import android.widget.FrameLayout;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+/**
+ * This class is the main Android activity that represents the Cordova
+ * application. It should be extended by the user to load the specific
+ * html file that contains the application.
+ *
+ * As an example:
+ *
+ *
+ * package org.apache.cordova.examples;
+ *
+ * import android.os.Bundle;
+ * import org.apache.cordova.*;
+ *
+ * public class Example extends CordovaActivity {
+ * @Override
+ * public void onCreate(Bundle savedInstanceState) {
+ * super.onCreate(savedInstanceState);
+ * super.init();
+ * // Load your application
+ * loadUrl(launchUrl);
+ * }
+ * }
+ *
+ *
+ * Cordova xml configuration: Cordova uses a configuration file at
+ * res/xml/config.xml to specify its settings. See "The config.xml File"
+ * guide in cordova-docs at http://cordova.apache.org/docs for the documentation
+ * for the configuration. The use of the set*Property() methods is
+ * deprecated in favor of the config.xml file.
+ *
+ */
+public class CordovaActivity extends AppCompatActivity {
+ public static String TAG = "CordovaActivity";
+
+ // The webview for our app
+ protected CordovaWebView appView;
+
+ private static int ACTIVITY_STARTING = 0;
+ private static int ACTIVITY_RUNNING = 1;
+ private static int ACTIVITY_EXITING = 2;
+
+ // Keep app running when pause is received. (default = true)
+ // If true, then the JavaScript and native code continue to run in the background
+ // when another application (activity) is started.
+ protected boolean keepRunning = true;
+
+ // Flag to keep immersive mode if set to fullscreen
+ protected boolean immersiveMode;
+
+ // Read from config.xml:
+ protected CordovaPreferences preferences;
+ protected String launchUrl;
+ protected ArrayList pluginEntries;
+ protected CordovaInterfaceImpl cordovaInterface;
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ // need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
+ loadConfig();
+
+ String logLevel = preferences.getString("loglevel", "ERROR");
+ LOG.setLogLevel(logLevel);
+
+ LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
+ LOG.d(TAG, "CordovaActivity.onCreate()");
+
+ if (!preferences.getBoolean("ShowTitle", false)) {
+ getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ }
+
+ if (preferences.getBoolean("SetFullscreen", false)) {
+ LOG.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
+ preferences.set("Fullscreen", true);
+ }
+ if (preferences.getBoolean("Fullscreen", false)) {
+ // NOTE: use the FullscreenNotImmersive configuration key to set the activity in a REAL full screen
+ // (as was the case in previous cordova versions)
+ if (!preferences.getBoolean("FullscreenNotImmersive", false)) {
+ immersiveMode = true;
+ // The splashscreen plugin needs the flags set before we're focused to prevent
+ // the nav and title bars from flashing in.
+ setImmersiveUiVisibility();
+ } else {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ } else {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ }
+
+ super.onCreate(savedInstanceState);
+
+ cordovaInterface = makeCordovaInterface();
+ if (savedInstanceState != null) {
+ cordovaInterface.restoreInstanceState(savedInstanceState);
+ }
+ }
+
+ protected void init() {
+ appView = makeWebView();
+ createViews();
+ if (!appView.isInitialized()) {
+ appView.init(cordovaInterface, pluginEntries, preferences);
+ }
+ cordovaInterface.onCordovaInit(appView.getPluginManager());
+
+ // Wire the hardware volume controls to control media if desired.
+ String volumePref = preferences.getString("DefaultVolumeStream", "");
+ if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
+ setVolumeControlStream(AudioManager.STREAM_MUSIC);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void loadConfig() {
+ ConfigXmlParser parser = new ConfigXmlParser();
+ parser.parse(this);
+ preferences = parser.getPreferences();
+ preferences.setPreferencesBundle(getIntent().getExtras());
+ launchUrl = parser.getLaunchUrl();
+ pluginEntries = parser.getPluginEntries();
+ Config.parser = parser;
+ }
+
+ //Suppressing warnings in AndroidStudio
+ @SuppressWarnings({"deprecation", "ResourceType"})
+ protected void createViews() {
+ //Why are we setting a constant as the ID? This should be investigated
+ appView.getView().setId(100);
+ appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+
+ setContentView(appView.getView());
+
+ if (preferences.contains("BackgroundColor")) {
+ try {
+ int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
+ // Background of activity:
+ appView.getView().setBackgroundColor(backgroundColor);
+ }
+ catch (NumberFormatException e){
+ e.printStackTrace();
+ }
+ }
+
+ appView.getView().requestFocusFromTouch();
+ }
+
+ /**
+ * Construct the default web view object.
+ *
+ * Override this to customize the webview that is used.
+ */
+ protected CordovaWebView makeWebView() {
+ return new CordovaWebViewImpl(makeWebViewEngine());
+ }
+
+ protected CordovaWebViewEngine makeWebViewEngine() {
+ return CordovaWebViewImpl.createEngine(this, preferences);
+ }
+
+ protected CordovaInterfaceImpl makeCordovaInterface() {
+ return new CordovaInterfaceImpl(this) {
+ @Override
+ public Object onMessage(String id, Object data) {
+ // Plumb this to CordovaActivity.onMessage for backwards compatibility
+ return CordovaActivity.this.onMessage(id, data);
+ }
+ };
+ }
+
+ /**
+ * Load the url into the webview.
+ */
+ public void loadUrl(String url) {
+ if (appView == null) {
+ init();
+ }
+
+ // If keepRunning
+ this.keepRunning = preferences.getBoolean("KeepRunning", true);
+
+ appView.loadUrlIntoView(url, true);
+ }
+
+ /**
+ * Called when the system is about to start resuming a previous activity.
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ LOG.d(TAG, "Paused the activity.");
+
+ if (this.appView != null) {
+ // CB-9382 If there is an activity that started for result and main activity is waiting for callback
+ // result, we shoudn't stop WebView Javascript timers, as activity for result might be using them
+ boolean keepRunning = this.keepRunning || this.cordovaInterface.activityResultCallback != null;
+ this.appView.handlePause(keepRunning);
+ }
+ }
+
+ /**
+ * Called when the activity receives a new intent
+ */
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ //Forward to plugins
+ if (this.appView != null)
+ this.appView.onNewIntent(intent);
+ }
+
+ /**
+ * Called when the activity will start interacting with the user.
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ LOG.d(TAG, "Resumed the activity.");
+
+ if (this.appView == null) {
+ return;
+ }
+ if (! this.getWindow().getDecorView().hasFocus()) {
+ // Force window to have focus, so application always
+ // receive user input. Workaround for some devices (Samsung Galaxy Note 3 at least)
+ this.getWindow().getDecorView().requestFocus();
+ }
+
+ this.appView.handleResume(this.keepRunning);
+ }
+
+ /**
+ * Called when the activity is no longer visible to the user.
+ */
+ @Override
+ protected void onStop() {
+ super.onStop();
+ LOG.d(TAG, "Stopped the activity.");
+
+ if (this.appView == null) {
+ return;
+ }
+ this.appView.handleStop();
+ }
+
+ /**
+ * Called when the activity is becoming visible to the user.
+ */
+ @Override
+ protected void onStart() {
+ super.onStart();
+ LOG.d(TAG, "Started the activity.");
+
+ if (this.appView == null) {
+ return;
+ }
+ this.appView.handleStart();
+ }
+
+ /**
+ * The final call you receive before your activity is destroyed.
+ */
+ @Override
+ public void onDestroy() {
+ LOG.d(TAG, "CordovaActivity.onDestroy()");
+ super.onDestroy();
+
+ if (this.appView != null) {
+ appView.handleDestroy();
+ }
+ }
+
+ /**
+ * Called when view focus is changed
+ */
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ if (hasFocus && immersiveMode) {
+ setImmersiveUiVisibility();
+ }
+ }
+
+ @SuppressLint("InlinedApi")
+ protected void setImmersiveUiVisibility() {
+ final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+
+ getWindow().getDecorView().setSystemUiVisibility(uiOptions);
+ }
+
+ @SuppressLint("NewApi")
+ @Override
+ public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
+ // Capture requestCode here so that it is captured in the setActivityResultCallback() case.
+ cordovaInterface.setActivityResultRequestCode(requestCode);
+ super.startActivityForResult(intent, requestCode, options);
+ }
+
+ /**
+ * Called when an activity you launched exits, giving you the requestCode you started it with,
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ */
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ LOG.d(TAG, "Incoming Result. Request code = " + requestCode);
+ super.onActivityResult(requestCode, resultCode, intent);
+ cordovaInterface.onActivityResult(requestCode, resultCode, intent);
+ }
+
+ /**
+ * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
+ * The errorCode parameter corresponds to one of the ERROR_* constants.
+ *
+ * @param errorCode The error code corresponding to an ERROR_* value.
+ * @param description A String describing the error.
+ * @param failingUrl The url that failed to load.
+ */
+ public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
+ final CordovaActivity me = this;
+
+ // If errorUrl specified, then load it
+ final String errorUrl = preferences.getString("errorUrl", null);
+ if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
+ // Load URL on UI thread
+ me.runOnUiThread(new Runnable() {
+ public void run() {
+ me.appView.showWebPage(errorUrl, false, true, null);
+ }
+ });
+ }
+ // If not, then display error dialog
+ else {
+ final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP);
+ me.runOnUiThread(new Runnable() {
+ public void run() {
+ if (exit) {
+ me.appView.getView().setVisibility(View.GONE);
+ me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Display an error dialog and optionally exit application.
+ */
+ public void displayError(final String title, final String message, final String button, final boolean exit) {
+ final CordovaActivity me = this;
+ me.runOnUiThread(new Runnable() {
+ public void run() {
+ try {
+ AlertDialog.Builder dlg = new AlertDialog.Builder(me);
+ dlg.setMessage(message);
+ dlg.setTitle(title);
+ dlg.setCancelable(false);
+ dlg.setPositiveButton(button,
+ new AlertDialog.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ if (exit) {
+ finish();
+ }
+ }
+ });
+ dlg.create();
+ dlg.show();
+ } catch (Exception e) {
+ finish();
+ }
+ }
+ });
+ }
+
+ /*
+ * Hook in Cordova for menu plugins
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ if (appView != null) {
+ appView.getPluginManager().postMessage("onCreateOptionsMenu", menu);
+ }
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ if (appView != null) {
+ appView.getPluginManager().postMessage("onPrepareOptionsMenu", menu);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (appView != null) {
+ appView.getPluginManager().postMessage("onOptionsItemSelected", item);
+ }
+ return true;
+ }
+
+ /**
+ * Called when a message is sent to plugin.
+ *
+ * @param id The message id
+ * @param data The message data
+ * @return Object or null
+ */
+ public Object onMessage(String id, Object data) {
+ if ("onReceivedError".equals(id)) {
+ JSONObject d = (JSONObject) data;
+ try {
+ this.onReceivedError(d.getInt("errorCode"), d.getString("description"), d.getString("url"));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else if ("exit".equals(id)) {
+ finish();
+ }
+ return null;
+ }
+
+ protected void onSaveInstanceState(Bundle outState) {
+ cordovaInterface.onSaveInstanceState(outState);
+ super.onSaveInstanceState(outState);
+ }
+
+ /**
+ * Called by the system when the device configuration changes while your activity is running.
+ *
+ * @param newConfig The new device configuration
+ */
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ if (this.appView == null) {
+ return;
+ }
+ PluginManager pm = this.appView.getPluginManager();
+ if (pm != null) {
+ pm.onConfigurationChanged(newConfig);
+ }
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String permissions[],
+ int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+
+ try
+ {
+ cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
+ }
+ catch (JSONException e)
+ {
+ LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaArgs.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaArgs.java
new file mode 100644
index 0000000..d40d26e
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaArgs.java
@@ -0,0 +1,113 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.util.Base64;
+
+public class CordovaArgs {
+ private JSONArray baseArgs;
+
+ public CordovaArgs(JSONArray args) {
+ this.baseArgs = args;
+ }
+
+
+ // Pass through the basics to the base args.
+ public Object get(int index) throws JSONException {
+ return baseArgs.get(index);
+ }
+
+ public boolean getBoolean(int index) throws JSONException {
+ return baseArgs.getBoolean(index);
+ }
+
+ public double getDouble(int index) throws JSONException {
+ return baseArgs.getDouble(index);
+ }
+
+ public int getInt(int index) throws JSONException {
+ return baseArgs.getInt(index);
+ }
+
+ public JSONArray getJSONArray(int index) throws JSONException {
+ return baseArgs.getJSONArray(index);
+ }
+
+ public JSONObject getJSONObject(int index) throws JSONException {
+ return baseArgs.getJSONObject(index);
+ }
+
+ public long getLong(int index) throws JSONException {
+ return baseArgs.getLong(index);
+ }
+
+ public String getString(int index) throws JSONException {
+ return baseArgs.getString(index);
+ }
+
+
+ public Object opt(int index) {
+ return baseArgs.opt(index);
+ }
+
+ public boolean optBoolean(int index) {
+ return baseArgs.optBoolean(index);
+ }
+
+ public double optDouble(int index) {
+ return baseArgs.optDouble(index);
+ }
+
+ public int optInt(int index) {
+ return baseArgs.optInt(index);
+ }
+
+ public JSONArray optJSONArray(int index) {
+ return baseArgs.optJSONArray(index);
+ }
+
+ public JSONObject optJSONObject(int index) {
+ return baseArgs.optJSONObject(index);
+ }
+
+ public long optLong(int index) {
+ return baseArgs.optLong(index);
+ }
+
+ public String optString(int index) {
+ return baseArgs.optString(index);
+ }
+
+ public boolean isNull(int index) {
+ return baseArgs.isNull(index);
+ }
+
+
+ // The interesting custom helpers.
+ public byte[] getArrayBuffer(int index) throws JSONException {
+ String encoded = baseArgs.getString(index);
+ return Base64.decode(encoded, Base64.DEFAULT);
+ }
+}
+
+
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaBridge.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaBridge.java
new file mode 100644
index 0000000..a8e8369
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaBridge.java
@@ -0,0 +1,186 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.annotation.SuppressLint;
+
+import java.security.SecureRandom;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+
+/**
+ * Contains APIs that the JS can call. All functions in here should also have
+ * an equivalent entry in CordovaChromeClient.java, and be added to
+ * cordova-js/lib/android/plugin/android/promptbasednativeapi.js
+ */
+public class CordovaBridge {
+ private static final String LOG_TAG = "CordovaBridge";
+ private PluginManager pluginManager;
+ private NativeToJsMessageQueue jsMessageQueue;
+ private volatile int expectedBridgeSecret = -1; // written by UI thread, read by JS thread.
+
+ public CordovaBridge(PluginManager pluginManager, NativeToJsMessageQueue jsMessageQueue) {
+ this.pluginManager = pluginManager;
+ this.jsMessageQueue = jsMessageQueue;
+ }
+
+ public String jsExec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException {
+ if (!verifySecret("exec()", bridgeSecret)) {
+ return null;
+ }
+ // If the arguments weren't received, send a message back to JS. It will switch bridge modes and try again. See CB-2666.
+ // We send a message meant specifically for this case. It starts with "@" so no other message can be encoded into the same string.
+ if (arguments == null) {
+ return "@Null arguments.";
+ }
+
+ jsMessageQueue.setPaused(true);
+ try {
+ // Tell the resourceApi what thread the JS is running on.
+ CordovaResourceApi.jsThread = Thread.currentThread();
+
+ pluginManager.exec(service, action, callbackId, arguments);
+ String ret = null;
+ if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING) {
+ ret = jsMessageQueue.popAndEncode(false);
+ }
+ return ret;
+ } catch (Throwable e) {
+ e.printStackTrace();
+ return "";
+ } finally {
+ jsMessageQueue.setPaused(false);
+ }
+ }
+
+ public void jsSetNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException {
+ if (!verifySecret("setNativeToJsBridgeMode()", bridgeSecret)) {
+ return;
+ }
+ jsMessageQueue.setBridgeMode(value);
+ }
+
+ public String jsRetrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException {
+ if (!verifySecret("retrieveJsMessages()", bridgeSecret)) {
+ return null;
+ }
+ return jsMessageQueue.popAndEncode(fromOnlineEvent);
+ }
+
+ private boolean verifySecret(String action, int bridgeSecret) throws IllegalAccessException {
+ if (!jsMessageQueue.isBridgeEnabled()) {
+ if (bridgeSecret == -1) {
+ LOG.d(LOG_TAG, action + " call made before bridge was enabled.");
+ } else {
+ LOG.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
+ }
+ return false;
+ }
+ // Bridge secret wrong and bridge not due to it being from the previous page.
+ if (expectedBridgeSecret < 0 || bridgeSecret != expectedBridgeSecret) {
+ LOG.e(LOG_TAG, "Bridge access attempt with wrong secret token, possibly from malicious code. Disabling exec() bridge!");
+ clearBridgeSecret();
+ throw new IllegalAccessException();
+ }
+ return true;
+ }
+
+ /** Called on page transitions */
+ void clearBridgeSecret() {
+ expectedBridgeSecret = -1;
+ }
+
+ public boolean isSecretEstablished() {
+ return expectedBridgeSecret != -1;
+ }
+
+ /** Called by cordova.js to initialize the bridge. */
+ //On old Androids SecureRandom isn't really secure, this is the least of your problems if
+ //you're running Android 4.3 and below in 2017
+ int generateBridgeSecret() {
+ SecureRandom randGen = new SecureRandom();
+ expectedBridgeSecret = randGen.nextInt(Integer.MAX_VALUE);
+ return expectedBridgeSecret;
+ }
+
+ public void reset() {
+ jsMessageQueue.reset();
+ clearBridgeSecret();
+ }
+
+ public String promptOnJsPrompt(String origin, String message, String defaultValue) {
+ if (defaultValue != null && defaultValue.startsWith("gap:")) {
+ JSONArray array;
+ try {
+ array = new JSONArray(defaultValue.substring(4));
+ int bridgeSecret = array.getInt(0);
+ String service = array.getString(1);
+ String action = array.getString(2);
+ String callbackId = array.getString(3);
+ String r = jsExec(bridgeSecret, service, action, callbackId, message);
+ return r == null ? "" : r;
+ } catch (JSONException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+ // Sets the native->JS bridge mode.
+ else if (defaultValue != null && defaultValue.startsWith("gap_bridge_mode:")) {
+ try {
+ int bridgeSecret = Integer.parseInt(defaultValue.substring(16));
+ jsSetNativeToJsBridgeMode(bridgeSecret, Integer.parseInt(message));
+ } catch (NumberFormatException e){
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+ // Polling for JavaScript messages
+ else if (defaultValue != null && defaultValue.startsWith("gap_poll:")) {
+ int bridgeSecret = Integer.parseInt(defaultValue.substring(9));
+ try {
+ String r = jsRetrieveJsMessages(bridgeSecret, "1".equals(message));
+ return r == null ? "" : r;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+ else if (defaultValue != null && defaultValue.startsWith("gap_init:")) {
+ // Protect against random iframes being able to talk through the bridge.
+ // Trust only pages which the app would have been allowed to navigate to anyway.
+ if (pluginManager.shouldAllowBridgeAccess(origin)) {
+ // Enable the bridge
+ int bridgeMode = Integer.parseInt(defaultValue.substring(9));
+ jsMessageQueue.setBridgeMode(bridgeMode);
+ // Tell JS the bridge secret.
+ int secret = generateBridgeSecret();
+ return ""+secret;
+ } else {
+ LOG.e(LOG_TAG, "gap_init called from restricted origin: " + origin);
+ }
+ return "";
+ }
+ return null;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaClientCertRequest.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaClientCertRequest.java
new file mode 100644
index 0000000..ad7c588
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaClientCertRequest.java
@@ -0,0 +1,105 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+import android.annotation.SuppressLint;
+import android.webkit.ClientCertRequest;
+
+/**
+ * Implementation of the ICordovaClientCertRequest for Android WebView.
+ *
+ */
+public class CordovaClientCertRequest implements ICordovaClientCertRequest {
+
+ private final ClientCertRequest request;
+
+ public CordovaClientCertRequest(ClientCertRequest request) {
+ this.request = request;
+ }
+
+ /**
+ * Cancel this request
+ */
+ @SuppressLint("NewApi")
+ public void cancel()
+ {
+ request.cancel();
+ }
+
+ /*
+ * Returns the host name of the server requesting the certificate.
+ */
+ @SuppressLint("NewApi")
+ public String getHost()
+ {
+ return request.getHost();
+ }
+
+ /*
+ * Returns the acceptable types of asymmetric keys (can be null).
+ */
+ @SuppressLint("NewApi")
+ public String[] getKeyTypes()
+ {
+ return request.getKeyTypes();
+ }
+
+ /*
+ * Returns the port number of the server requesting the certificate.
+ */
+ @SuppressLint("NewApi")
+ public int getPort()
+ {
+ return request.getPort();
+ }
+
+ /*
+ * Returns the acceptable certificate issuers for the certificate matching the private key (can be null).
+ */
+ @SuppressLint("NewApi")
+ public Principal[] getPrincipals()
+ {
+ return request.getPrincipals();
+ }
+
+ /*
+ * Ignore the request for now. Do not remember user's choice.
+ */
+ @SuppressLint("NewApi")
+ public void ignore()
+ {
+ request.ignore();
+ }
+
+ /*
+ * Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests.
+ *
+ * @param privateKey The privateKey
+ * @param chain The certificate chain
+ */
+ @SuppressLint("NewApi")
+ public void proceed(PrivateKey privateKey, X509Certificate[] chain)
+ {
+ request.proceed(privateKey, chain);
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaDialogsHelper.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaDialogsHelper.java
new file mode 100644
index 0000000..a219c99
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaDialogsHelper.java
@@ -0,0 +1,152 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.view.KeyEvent;
+import android.widget.EditText;
+
+/**
+ * Helper class for WebViews to implement prompt(), alert(), confirm() dialogs.
+ */
+public class CordovaDialogsHelper {
+ private final Context context;
+ private AlertDialog lastHandledDialog;
+
+ public CordovaDialogsHelper(Context context) {
+ this.context = context;
+ }
+
+ public void showAlert(String message, final Result result) {
+ AlertDialog.Builder dlg = new AlertDialog.Builder(context);
+ dlg.setMessage(message);
+ dlg.setTitle("Alert");
+ //Don't let alerts break the back button
+ dlg.setCancelable(true);
+ dlg.setPositiveButton(android.R.string.ok,
+ new AlertDialog.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ result.gotResult(true, null);
+ }
+ });
+ dlg.setOnCancelListener(
+ new DialogInterface.OnCancelListener() {
+ public void onCancel(DialogInterface dialog) {
+ result.gotResult(false, null);
+ }
+ });
+ dlg.setOnKeyListener(new DialogInterface.OnKeyListener() {
+ //DO NOTHING
+ public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK)
+ {
+ result.gotResult(true, null);
+ return false;
+ }
+ else
+ return true;
+ }
+ });
+ lastHandledDialog = dlg.show();
+ }
+
+ public void showConfirm(String message, final Result result) {
+ AlertDialog.Builder dlg = new AlertDialog.Builder(context);
+ dlg.setMessage(message);
+ dlg.setTitle("Confirm");
+ dlg.setCancelable(true);
+ dlg.setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ result.gotResult(true, null);
+ }
+ });
+ dlg.setNegativeButton(android.R.string.cancel,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ result.gotResult(false, null);
+ }
+ });
+ dlg.setOnCancelListener(
+ new DialogInterface.OnCancelListener() {
+ public void onCancel(DialogInterface dialog) {
+ result.gotResult(false, null);
+ }
+ });
+ dlg.setOnKeyListener(new DialogInterface.OnKeyListener() {
+ //DO NOTHING
+ public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK)
+ {
+ result.gotResult(false, null);
+ return false;
+ }
+ else
+ return true;
+ }
+ });
+ lastHandledDialog = dlg.show();
+ }
+
+ /**
+ * Tell the client to display a prompt dialog to the user.
+ * If the client returns true, WebView will assume that the client will
+ * handle the prompt dialog and call the appropriate JsPromptResult method.
+ *
+ * Since we are hacking prompts for our own purposes, we should not be using them for
+ * this purpose, perhaps we should hack console.log to do this instead!
+ */
+ public void showPrompt(String message, String defaultValue, final Result result) {
+ // Returning false would also show a dialog, but the default one shows the origin (ugly).
+ AlertDialog.Builder dlg = new AlertDialog.Builder(context);
+ dlg.setMessage(message);
+ final EditText input = new EditText(context);
+ if (defaultValue != null) {
+ input.setText(defaultValue);
+ }
+ dlg.setView(input);
+ dlg.setCancelable(false);
+ dlg.setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ String userText = input.getText().toString();
+ result.gotResult(true, userText);
+ }
+ });
+ dlg.setNegativeButton(android.R.string.cancel,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ result.gotResult(false, null);
+ }
+ });
+ lastHandledDialog = dlg.show();
+ }
+
+ public void destroyLastDialog(){
+ if (lastHandledDialog != null){
+ lastHandledDialog.cancel();
+ }
+ }
+
+ public interface Result {
+ public void gotResult(boolean success, String value);
+ }
+}
\ No newline at end of file
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java
new file mode 100644
index 0000000..a2692f8
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java
@@ -0,0 +1,51 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.webkit.HttpAuthHandler;
+
+/**
+ * Specifies interface for HTTP auth handler object which is used to handle auth requests and
+ * specifying user credentials.
+ */
+public class CordovaHttpAuthHandler implements ICordovaHttpAuthHandler {
+
+ private final HttpAuthHandler handler;
+
+ public CordovaHttpAuthHandler(HttpAuthHandler handler) {
+ this.handler = handler;
+ }
+
+ /**
+ * Instructs the WebView to cancel the authentication request.
+ */
+ public void cancel () {
+ this.handler.cancel();
+ }
+
+ /**
+ * Instructs the WebView to proceed with the authentication with the given credentials.
+ *
+ * @param username
+ * @param password
+ */
+ public void proceed (String username, String password) {
+ this.handler.proceed(username, password);
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaInterface.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaInterface.java
new file mode 100644
index 0000000..53d03a5
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaInterface.java
@@ -0,0 +1,96 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * The Activity interface that is implemented by CordovaActivity.
+ * It is used to isolate plugin development, and remove dependency on entire Cordova library.
+ */
+public interface CordovaInterface {
+
+ /**
+ * Launch an activity for which you would like a result when it finished. When this activity exits,
+ * your onActivityResult() method will be called.
+ *
+ * @param command The command object
+ * @param intent The intent to start
+ * @param requestCode The request code that is passed to callback to identify the activity
+ */
+ abstract public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode);
+
+ /**
+ * Set the plugin to be called when a sub-activity exits.
+ *
+ * @param plugin The plugin on which onActivityResult is to be called
+ */
+ abstract public void setActivityResultCallback(CordovaPlugin plugin);
+
+ /**
+ * Get the Android activity.
+ *
+ * If a custom engine lives outside of the Activity's lifecycle the return value may be null.
+ *
+ * @return the Activity
+ */
+ public abstract AppCompatActivity getActivity();
+
+ /**
+ * Get the Android context.
+ *
+ * @return the Context
+ */
+ public Context getContext();
+
+ /**
+ * Called when a message is sent to plugin.
+ *
+ * @param id The message id
+ * @param data The message data
+ * @return Object or null
+ */
+ public Object onMessage(String id, Object data);
+
+ /**
+ * Returns a shared thread pool that can be used for background tasks.
+ */
+ public ExecutorService getThreadPool();
+
+ /**
+ * Sends a permission request to the activity for one permission.
+ */
+ public void requestPermission(CordovaPlugin plugin, int requestCode, String permission);
+
+ /**
+ * Sends a permission request to the activity for a group of permissions
+ */
+ public void requestPermissions(CordovaPlugin plugin, int requestCode, String [] permissions);
+
+ /**
+ * Check for a permission. Returns true if the permission is granted, false otherwise.
+ */
+ public boolean hasPermission(String permission);
+
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
new file mode 100644
index 0000000..84e2c0a
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -0,0 +1,250 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Pair;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * Default implementation of CordovaInterface.
+ */
+public class CordovaInterfaceImpl implements CordovaInterface {
+ private static final String TAG = "CordovaInterfaceImpl";
+ protected AppCompatActivity activity;
+ protected ExecutorService threadPool;
+ protected PluginManager pluginManager;
+
+ protected ActivityResultHolder savedResult;
+ protected CallbackMap permissionResultCallbacks;
+ protected CordovaPlugin activityResultCallback;
+ protected String initCallbackService;
+ protected int activityResultRequestCode;
+ protected boolean activityWasDestroyed = false;
+ protected Bundle savedPluginState;
+
+ public CordovaInterfaceImpl(AppCompatActivity activity) {
+ this(activity, Executors.newCachedThreadPool());
+ }
+
+ public CordovaInterfaceImpl(AppCompatActivity activity, ExecutorService threadPool) {
+ this.activity = activity;
+ this.threadPool = threadPool;
+ this.permissionResultCallbacks = new CallbackMap();
+ }
+
+ @Override
+ public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
+ setActivityResultCallback(command);
+ try {
+ activity.startActivityForResult(intent, requestCode);
+ } catch (RuntimeException e) { // E.g.: ActivityNotFoundException
+ activityResultCallback = null;
+ throw e;
+ }
+ }
+
+ @Override
+ public void setActivityResultCallback(CordovaPlugin plugin) {
+ // Cancel any previously pending activity.
+ if (activityResultCallback != null) {
+ activityResultCallback.onActivityResult(activityResultRequestCode, AppCompatActivity.RESULT_CANCELED, null);
+ }
+ activityResultCallback = plugin;
+ }
+
+ @Override
+ public AppCompatActivity getActivity() {
+ return activity;
+ }
+
+ @Override
+ public Context getContext() {
+ return activity;
+ }
+
+ @Override
+ public Object onMessage(String id, Object data) {
+ if ("exit".equals(id)) {
+ activity.finish();
+ }
+ return null;
+ }
+
+ @Override
+ public ExecutorService getThreadPool() {
+ return threadPool;
+ }
+
+ /**
+ * Dispatches any pending onActivityResult callbacks and sends the resume event if the
+ * Activity was destroyed by the OS.
+ */
+ public void onCordovaInit(PluginManager pluginManager) {
+ this.pluginManager = pluginManager;
+ if (savedResult != null) {
+ onActivityResult(savedResult.requestCode, savedResult.resultCode, savedResult.intent);
+ } else if(activityWasDestroyed) {
+ // If there was no Activity result, we still need to send out the resume event if the
+ // Activity was destroyed by the OS
+ activityWasDestroyed = false;
+ if(pluginManager != null)
+ {
+ CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
+ if(appPlugin != null) {
+ JSONObject obj = new JSONObject();
+ try {
+ obj.put("action", "resume");
+ } catch (JSONException e) {
+ LOG.e(TAG, "Failed to create event message", e);
+ }
+ appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, obj));
+ }
+ }
+
+ }
+ }
+
+ /**
+ * Routes the result to the awaiting plugin. Returns false if no plugin was waiting.
+ */
+ public boolean onActivityResult(int requestCode, int resultCode, Intent intent) {
+ CordovaPlugin callback = activityResultCallback;
+ if(callback == null && initCallbackService != null) {
+ // The application was restarted, but had defined an initial callback
+ // before being shut down.
+ savedResult = new ActivityResultHolder(requestCode, resultCode, intent);
+ if (pluginManager != null) {
+ callback = pluginManager.getPlugin(initCallbackService);
+ if(callback != null) {
+ callback.onRestoreStateForActivityResult(savedPluginState.getBundle(callback.getServiceName()),
+ new ResumeCallback(callback.getServiceName(), pluginManager));
+ }
+ }
+ }
+ activityResultCallback = null;
+
+ if (callback != null) {
+ LOG.d(TAG, "Sending activity result to plugin");
+ initCallbackService = null;
+ savedResult = null;
+ callback.onActivityResult(requestCode, resultCode, intent);
+ return true;
+ }
+ LOG.w(TAG, "Got an activity result, but no plugin was registered to receive it" + (savedResult != null ? " yet!" : "."));
+ return false;
+ }
+
+ /**
+ * Call this from your startActivityForResult() overload. This is required to catch the case
+ * where plugins use Activity.startActivityForResult() + CordovaInterface.setActivityResultCallback()
+ * rather than CordovaInterface.startActivityForResult().
+ */
+ public void setActivityResultRequestCode(int requestCode) {
+ activityResultRequestCode = requestCode;
+ }
+
+ /**
+ * Saves parameters for startActivityForResult().
+ */
+ public void onSaveInstanceState(Bundle outState) {
+ if (activityResultCallback != null) {
+ String serviceName = activityResultCallback.getServiceName();
+ outState.putString("callbackService", serviceName);
+ }
+ if(pluginManager != null){
+ outState.putBundle("plugin", pluginManager.onSaveInstanceState());
+ }
+
+ }
+
+ /**
+ * Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
+ */
+ public void restoreInstanceState(Bundle savedInstanceState) {
+ initCallbackService = savedInstanceState.getString("callbackService");
+ savedPluginState = savedInstanceState.getBundle("plugin");
+ activityWasDestroyed = true;
+ }
+
+ private static class ActivityResultHolder {
+ private int requestCode;
+ private int resultCode;
+ private Intent intent;
+
+ public ActivityResultHolder(int requestCode, int resultCode, Intent intent) {
+ this.requestCode = requestCode;
+ this.resultCode = resultCode;
+ this.intent = intent;
+ }
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) throws JSONException {
+ Pair callback = permissionResultCallbacks.getAndRemoveCallback(requestCode);
+ if(callback != null) {
+ callback.first.onRequestPermissionResult(callback.second, permissions, grantResults);
+ }
+ }
+
+ public void requestPermission(CordovaPlugin plugin, int requestCode, String permission) {
+ String[] permissions = new String [1];
+ permissions[0] = permission;
+ requestPermissions(plugin, requestCode, permissions);
+ }
+
+ @SuppressLint("NewApi")
+ public void requestPermissions(CordovaPlugin plugin, int requestCode, String [] permissions) {
+ int mappedRequestCode = permissionResultCallbacks.registerCallback(plugin, requestCode);
+ getActivity().requestPermissions(permissions, mappedRequestCode);
+ }
+
+ public boolean hasPermission(String permission)
+ {
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
+ {
+ int result = activity.checkSelfPermission(permission);
+ return PackageManager.PERMISSION_GRANTED == result;
+ }
+ else
+ {
+ return true;
+ }
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPlugin.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPlugin.java
new file mode 100644
index 0000000..38e2e4a
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -0,0 +1,445 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import org.apache.cordova.CordovaArgs;
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.CallbackContext;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+/**
+ * Plugins must extend this class and override one of the execute methods.
+ */
+public class CordovaPlugin {
+ public CordovaWebView webView;
+ public CordovaInterface cordova;
+ protected CordovaPreferences preferences;
+ private String serviceName;
+
+ /**
+ * Call this after constructing to initialize the plugin.
+ * Final because we want to be able to change args without breaking plugins.
+ */
+ public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) {
+ assert this.cordova == null;
+ this.serviceName = serviceName;
+ this.cordova = cordova;
+ this.webView = webView;
+ this.preferences = preferences;
+ initialize(cordova, webView);
+ pluginInitialize();
+ }
+
+ /**
+ * Called after plugin construction and fields have been initialized.
+ * Prefer to use pluginInitialize instead since there is no value in
+ * having parameters on the initialize() function.
+ */
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ }
+
+ /**
+ * Called after plugin construction and fields have been initialized.
+ */
+ protected void pluginInitialize() {
+ }
+
+ /**
+ * Returns the plugin's service name (what you'd use when calling pluginManger.getPlugin())
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * Executes the request.
+ *
+ * This method is called from the WebView thread. To do a non-trivial amount of work, use:
+ * cordova.getThreadPool().execute(runnable);
+ *
+ * To run on the UI thread, use:
+ * cordova.getActivity().runOnUiThread(runnable);
+ *
+ * @param action The action to execute.
+ * @param rawArgs The exec() arguments in JSON form.
+ * @param callbackContext The callback context used when calling back into JavaScript.
+ * @return Whether the action was valid.
+ */
+ public boolean execute(String action, String rawArgs, CallbackContext callbackContext) throws JSONException {
+ JSONArray args = new JSONArray(rawArgs);
+ return execute(action, args, callbackContext);
+ }
+
+ /**
+ * Executes the request.
+ *
+ * This method is called from the WebView thread. To do a non-trivial amount of work, use:
+ * cordova.getThreadPool().execute(runnable);
+ *
+ * To run on the UI thread, use:
+ * cordova.getActivity().runOnUiThread(runnable);
+ *
+ * @param action The action to execute.
+ * @param args The exec() arguments.
+ * @param callbackContext The callback context used when calling back into JavaScript.
+ * @return Whether the action was valid.
+ */
+ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+ CordovaArgs cordovaArgs = new CordovaArgs(args);
+ return execute(action, cordovaArgs, callbackContext);
+ }
+
+ /**
+ * Executes the request.
+ *
+ * This method is called from the WebView thread. To do a non-trivial amount of work, use:
+ * cordova.getThreadPool().execute(runnable);
+ *
+ * To run on the UI thread, use:
+ * cordova.getActivity().runOnUiThread(runnable);
+ *
+ * @param action The action to execute.
+ * @param args The exec() arguments, wrapped with some Cordova helpers.
+ * @param callbackContext The callback context used when calling back into JavaScript.
+ * @return Whether the action was valid.
+ */
+ public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
+ return false;
+ }
+
+ /**
+ * Called when the system is about to start resuming a previous activity.
+ *
+ * @param multitasking Flag indicating if multitasking is turned on for app
+ */
+ public void onPause(boolean multitasking) {
+ }
+
+ /**
+ * Called when the activity will start interacting with the user.
+ *
+ * @param multitasking Flag indicating if multitasking is turned on for app
+ */
+ public void onResume(boolean multitasking) {
+ }
+
+ /**
+ * Called when the activity is becoming visible to the user.
+ */
+ public void onStart() {
+ }
+
+ /**
+ * Called when the activity is no longer visible to the user.
+ */
+ public void onStop() {
+ }
+
+ /**
+ * Called when the activity receives a new intent.
+ */
+ public void onNewIntent(Intent intent) {
+ }
+
+ /**
+ * The final call you receive before your activity is destroyed.
+ */
+ public void onDestroy() {
+ }
+
+ /**
+ * Called when the Activity is being destroyed (e.g. if a plugin calls out to an external
+ * Activity and the OS kills the CordovaActivity in the background). The plugin should save its
+ * state in this method only if it is awaiting the result of an external Activity and needs
+ * to preserve some information so as to handle that result; onRestoreStateForActivityResult()
+ * will only be called if the plugin is the recipient of an Activity result
+ *
+ * @return Bundle containing the state of the plugin or null if state does not need to be saved
+ */
+ public Bundle onSaveInstanceState() {
+ return null;
+ }
+
+ /**
+ * Called when a plugin is the recipient of an Activity result after the CordovaActivity has
+ * been destroyed. The Bundle will be the same as the one the plugin returned in
+ * onSaveInstanceState()
+ *
+ * @param state Bundle containing the state of the plugin
+ * @param callbackContext Replacement Context to return the plugin result to
+ */
+ public void onRestoreStateForActivityResult(Bundle state, CallbackContext callbackContext) {}
+
+ /**
+ * Called when a message is sent to plugin.
+ *
+ * @param id The message id
+ * @param data The message data
+ * @return Object to stop propagation or null
+ */
+ public Object onMessage(String id, Object data) {
+ return null;
+ }
+
+ /**
+ * Called when an activity you launched exits, giving you the requestCode you started it with,
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param intent An Intent, which can return result data to the caller (various data can be
+ * attached to Intent "extras").
+ */
+ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ }
+
+ /**
+ * Hook for blocking the loading of external resources.
+ *
+ * This will be called when the WebView's shouldInterceptRequest wants to
+ * know whether to open a connection to an external resource. Return false
+ * to block the request: if any plugin returns false, Cordova will block
+ * the request. If all plugins return null, the default policy will be
+ * enforced. If at least one plugin returns true, and no plugins return
+ * false, then the request will proceed.
+ *
+ * Note that this only affects resource requests which are routed through
+ * WebViewClient.shouldInterceptRequest, such as XMLHttpRequest requests and
+ * img tag loads. WebSockets and media requests (such as and
+ * tags) are not affected by this method. Use CSP headers to control access
+ * to such resources.
+ */
+ public Boolean shouldAllowRequest(String url) {
+ return null;
+ }
+
+ /**
+ * Hook for blocking navigation by the Cordova WebView. This applies both to top-level and
+ * iframe navigations.
+ *
+ * This will be called when the WebView's needs to know whether to navigate
+ * to a new page. Return false to block the navigation: if any plugin
+ * returns false, Cordova will block the navigation. If all plugins return
+ * null, the default policy will be enforced. It at least one plugin returns
+ * true, and no plugins return false, then the navigation will proceed.
+ */
+ public Boolean shouldAllowNavigation(String url) {
+ return null;
+ }
+
+ /**
+ * Hook for allowing page to call exec(). By default, this returns the result of
+ * shouldAllowNavigation(). It's generally unsafe to allow untrusted content to be loaded
+ * into a CordovaWebView, even within an iframe, so it's best not to touch this.
+ */
+ public Boolean shouldAllowBridgeAccess(String url) {
+ return shouldAllowNavigation(url);
+ }
+
+ /**
+ * Hook for blocking the launching of Intents by the Cordova application.
+ *
+ * This will be called when the WebView will not navigate to a page, but
+ * could launch an intent to handle the URL. Return false to block this: if
+ * any plugin returns false, Cordova will block the navigation. If all
+ * plugins return null, the default policy will be enforced. If at least one
+ * plugin returns true, and no plugins return false, then the URL will be
+ * opened.
+ */
+ public Boolean shouldOpenExternalUrl(String url) {
+ return null;
+ }
+
+ /**
+ * Allows plugins to handle a link being clicked. Return true here to cancel the navigation.
+ *
+ * @param url The URL that is trying to be loaded in the Cordova webview.
+ * @return Return true to prevent the URL from loading. Default is false.
+ */
+ public boolean onOverrideUrlLoading(String url) {
+ return false;
+ }
+
+ /**
+ * Hook for redirecting requests. Applies to WebView requests as well as requests made by plugins.
+ * To handle the request directly, return a URI in the form:
+ *
+ * cdvplugin://pluginId/...
+ *
+ * And implement handleOpenForRead().
+ * To make this easier, use the toPluginUri() and fromPluginUri() helpers:
+ *
+ * public Uri remapUri(Uri uri) { return toPluginUri(uri); }
+ *
+ * public CordovaResourceApi.OpenForReadResult handleOpenForRead(Uri uri) throws IOException {
+ * Uri origUri = fromPluginUri(uri);
+ * ...
+ * }
+ */
+ public Uri remapUri(Uri uri) {
+ return null;
+ }
+
+ /**
+ * Called to handle CordovaResourceApi.openForRead() calls for a cdvplugin://pluginId/ URL.
+ * Should never return null.
+ * Added in cordova-android@4.0.0
+ */
+ public CordovaResourceApi.OpenForReadResult handleOpenForRead(Uri uri) throws IOException {
+ throw new FileNotFoundException("Plugin can't handle uri: " + uri);
+ }
+
+ /**
+ * Refer to remapUri()
+ * Added in cordova-android@4.0.0
+ */
+ protected Uri toPluginUri(Uri origUri) {
+ return new Uri.Builder()
+ .scheme(CordovaResourceApi.PLUGIN_URI_SCHEME)
+ .authority(serviceName)
+ .appendQueryParameter("origUri", origUri.toString())
+ .build();
+ }
+
+ /**
+ * Refer to remapUri()
+ * Added in cordova-android@4.0.0
+ */
+ protected Uri fromPluginUri(Uri pluginUri) {
+ return Uri.parse(pluginUri.getQueryParameter("origUri"));
+ }
+
+ /**
+ * Called when the WebView does a top-level navigation or refreshes.
+ *
+ * Plugins should stop any long-running processes and clean up internal state.
+ *
+ * Does nothing by default.
+ */
+ public void onReset() {
+ }
+
+ /**
+ * Called when the system received an HTTP authentication request. Plugin can use
+ * the supplied HttpAuthHandler to process this auth challenge.
+ *
+ * @param view The WebView that is initiating the callback
+ * @param handler The HttpAuthHandler used to set the WebView's response
+ * @param host The host requiring authentication
+ * @param realm The realm for which authentication is required
+ *
+ * @return Returns True if plugin will resolve this auth challenge, otherwise False
+ *
+ */
+ public boolean onReceivedHttpAuthRequest(CordovaWebView view, ICordovaHttpAuthHandler handler, String host, String realm) {
+ return false;
+ }
+
+ /**
+ * Called when he system received an SSL client certificate request. Plugin can use
+ * the supplied ClientCertRequest to process this certificate challenge.
+ *
+ * @param view The WebView that is initiating the callback
+ * @param request The client certificate request
+ *
+ * @return Returns True if plugin will resolve this auth challenge, otherwise False
+ *
+ */
+ public boolean onReceivedClientCertRequest(CordovaWebView view, ICordovaClientCertRequest request) {
+ return false;
+ }
+
+ /**
+ * Called by the system when the device configuration changes while your activity is running.
+ *
+ * @param newConfig The new device configuration
+ */
+ public void onConfigurationChanged(Configuration newConfig) {
+ }
+
+ /**
+ * Called by the Plugin Manager when we need to actually request permissions
+ *
+ * @param requestCode Passed to the activity to track the request
+ *
+ * @return Returns the permission that was stored in the plugin
+ */
+
+ public void requestPermissions(int requestCode) {
+ }
+
+ /*
+ * Called by the WebView implementation to check for geolocation permissions, can be used
+ * by other Java methods in the event that a plugin is using this as a dependency.
+ *
+ * @return Returns true if the plugin has all the permissions it needs to operate.
+ */
+
+ public boolean hasPermisssion() {
+ return true;
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ *
+ * @deprecated Use {@link #onRequestPermissionsResult} instead.
+ */
+ @Deprecated
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) throws JSONException {
+
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionsResult(int requestCode, String[] permissions,
+ int[] grantResults) throws JSONException {
+
+ }
+
+ /**
+ * Allow plugins to supply a PathHandler for the WebViewAssetHandler
+ * @return a CordovaPluginPathHandler which listen for paths and returns a response
+ */
+ public CordovaPluginPathHandler getPathHandler() {
+ return null;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPluginPathHandler.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPluginPathHandler.java
new file mode 100644
index 0000000..0acaacb
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPluginPathHandler.java
@@ -0,0 +1,38 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import androidx.webkit.WebViewAssetLoader;
+
+/**
+ * Wrapper class for path and handler
+ */
+public class CordovaPluginPathHandler {
+
+ private final WebViewAssetLoader.PathHandler handler;
+
+ public CordovaPluginPathHandler(WebViewAssetLoader.PathHandler handler) {
+ this.handler = handler;
+ }
+
+ public WebViewAssetLoader.PathHandler getPathHandler() {
+ return handler;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPreferences.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPreferences.java
new file mode 100644
index 0000000..96c219c
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaPreferences.java
@@ -0,0 +1,101 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.cordova.LOG;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class CordovaPreferences {
+ private HashMap prefs = new HashMap(20);
+ private Bundle preferencesBundleExtras;
+
+ public void setPreferencesBundle(Bundle extras) {
+ preferencesBundleExtras = extras;
+ }
+
+ public void set(String name, String value) {
+ prefs.put(name.toLowerCase(Locale.ENGLISH), value);
+ }
+
+ public void set(String name, boolean value) {
+ set(name, "" + value);
+ }
+
+ public void set(String name, int value) {
+ set(name, "" + value);
+ }
+
+ public void set(String name, double value) {
+ set(name, "" + value);
+ }
+
+ public Map getAll() {
+ return prefs;
+ }
+
+ public boolean getBoolean(String name, boolean defaultValue) {
+ name = name.toLowerCase(Locale.ENGLISH);
+ String value = prefs.get(name);
+ if (value != null) {
+ return Boolean.parseBoolean(value);
+ }
+ return defaultValue;
+ }
+
+ // Added in 4.0.0
+ public boolean contains(String name) {
+ return getString(name, null) != null;
+ }
+
+ public int getInteger(String name, int defaultValue) {
+ name = name.toLowerCase(Locale.ENGLISH);
+ String value = prefs.get(name);
+ if (value != null) {
+ // Use Integer.decode() can't handle it if the highest bit is set.
+ return (int)(long)Long.decode(value);
+ }
+ return defaultValue;
+ }
+
+ public double getDouble(String name, double defaultValue) {
+ name = name.toLowerCase(Locale.ENGLISH);
+ String value = prefs.get(name);
+ if (value != null) {
+ return Double.valueOf(value);
+ }
+ return defaultValue;
+ }
+
+ public String getString(String name, String defaultValue) {
+ name = name.toLowerCase(Locale.ENGLISH);
+ String value = prefs.get(name);
+ if (value != null) {
+ return value;
+ }
+ return defaultValue;
+ }
+
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaResourceApi.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaResourceApi.java
new file mode 100644
index 0000000..a9f3453
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -0,0 +1,479 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.cordova;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.AssetFileDescriptor;
+import android.content.res.AssetManager;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Looper;
+import android.util.Base64;
+import android.webkit.MimeTypeMap;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.channels.FileChannel;
+import java.util.Locale;
+import java.util.zip.GZIPInputStream;
+
+/**
+ * What this class provides:
+ * 1. Helpers for reading & writing to URLs.
+ * - E.g. handles assets, resources, content providers, files, data URIs, http[s]
+ * - E.g. Can be used to query for mime-type & content length.
+ *
+ * 2. To allow plugins to redirect URLs (via remapUrl).
+ * - All plugins should call remapUrl() on URLs they receive from JS *before*
+ * passing the URL onto other utility functions in this class.
+ * - For an example usage of this, refer to the org.apache.cordova.file plugin.
+ *
+ * Future Work:
+ * - Consider using a Cursor to query content URLs for their size (like the file plugin does).
+ * - Allow plugins to remapUri to "cdv-plugin://plugin-name/foo", which CordovaResourceApi
+ * would then delegate to pluginManager.getPlugin(plugin-name).openForRead(url)
+ * - Currently, plugins *can* do this by remapping to a data: URL, but it's inefficient
+ * for large payloads.
+ */
+public class CordovaResourceApi {
+ @SuppressWarnings("unused")
+ private static final String LOG_TAG = "CordovaResourceApi";
+
+ public static final int URI_TYPE_FILE = 0;
+ public static final int URI_TYPE_ASSET = 1;
+ public static final int URI_TYPE_CONTENT = 2;
+ public static final int URI_TYPE_RESOURCE = 3;
+ public static final int URI_TYPE_DATA = 4;
+ public static final int URI_TYPE_HTTP = 5;
+ public static final int URI_TYPE_HTTPS = 6;
+ public static final int URI_TYPE_PLUGIN = 7;
+ public static final int URI_TYPE_UNKNOWN = -1;
+
+ public static final String PLUGIN_URI_SCHEME = "cdvplugin";
+
+ private static final String[] LOCAL_FILE_PROJECTION = { "_data" };
+
+ public static Thread jsThread;
+
+ private final AssetManager assetManager;
+ private final ContentResolver contentResolver;
+ private final PluginManager pluginManager;
+ private boolean threadCheckingEnabled = true;
+
+
+ public CordovaResourceApi(Context context, PluginManager pluginManager) {
+ this.contentResolver = context.getContentResolver();
+ this.assetManager = context.getAssets();
+ this.pluginManager = pluginManager;
+ }
+
+ public void setThreadCheckingEnabled(boolean value) {
+ threadCheckingEnabled = value;
+ }
+
+ public boolean isThreadCheckingEnabled() {
+ return threadCheckingEnabled;
+ }
+
+
+ public static int getUriType(Uri uri) {
+ assertNonRelative(uri);
+ String scheme = uri.getScheme();
+ if (ContentResolver.SCHEME_CONTENT.equalsIgnoreCase(scheme)) {
+ return URI_TYPE_CONTENT;
+ }
+ if (ContentResolver.SCHEME_ANDROID_RESOURCE.equalsIgnoreCase(scheme)) {
+ return URI_TYPE_RESOURCE;
+ }
+ if (ContentResolver.SCHEME_FILE.equalsIgnoreCase(scheme)) {
+ if (uri.getPath().startsWith("/android_asset/")) {
+ return URI_TYPE_ASSET;
+ }
+ return URI_TYPE_FILE;
+ }
+ if ("data".equalsIgnoreCase(scheme)) {
+ return URI_TYPE_DATA;
+ }
+ if ("http".equalsIgnoreCase(scheme)) {
+ return URI_TYPE_HTTP;
+ }
+ if ("https".equalsIgnoreCase(scheme)) {
+ return URI_TYPE_HTTPS;
+ }
+ if (PLUGIN_URI_SCHEME.equalsIgnoreCase(scheme)) {
+ return URI_TYPE_PLUGIN;
+ }
+ return URI_TYPE_UNKNOWN;
+ }
+
+ public Uri remapUri(Uri uri) {
+ assertNonRelative(uri);
+ Uri pluginUri = pluginManager.remapUri(uri);
+ return pluginUri != null ? pluginUri : uri;
+ }
+
+ public String remapPath(String path) {
+ return remapUri(Uri.fromFile(new File(path))).getPath();
+ }
+
+ /**
+ * Returns a File that points to the resource, or null if the resource
+ * is not on the local filesystem.
+ */
+ public File mapUriToFile(Uri uri) {
+ assertBackgroundThread();
+ switch (getUriType(uri)) {
+ case URI_TYPE_FILE:
+ return new File(uri.getPath());
+ case URI_TYPE_CONTENT: {
+ Cursor cursor = contentResolver.query(uri, LOCAL_FILE_PROJECTION, null, null, null);
+ if (cursor != null) {
+ try {
+ int columnIndex = cursor.getColumnIndex(LOCAL_FILE_PROJECTION[0]);
+ if (columnIndex != -1 && cursor.getCount() > 0) {
+ cursor.moveToFirst();
+ String realPath = cursor.getString(columnIndex);
+ if (realPath != null) {
+ return new File(realPath);
+ }
+ }
+ } finally {
+ cursor.close();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getMimeType(Uri uri) {
+ switch (getUriType(uri)) {
+ case URI_TYPE_FILE:
+ case URI_TYPE_ASSET:
+ return getMimeTypeFromPath(uri.getPath());
+ case URI_TYPE_CONTENT:
+ case URI_TYPE_RESOURCE:
+ return contentResolver.getType(uri);
+ case URI_TYPE_DATA: {
+ return getDataUriMimeType(uri);
+ }
+ case URI_TYPE_HTTP:
+ case URI_TYPE_HTTPS: {
+ try {
+ HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();
+ conn.setDoInput(false);
+ conn.setRequestMethod("HEAD");
+ String mimeType = conn.getHeaderField("Content-Type");
+ if (mimeType != null) {
+ mimeType = mimeType.split(";")[0];
+ }
+ return mimeType;
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ return null;
+ }
+
+
+ //This already exists
+ private String getMimeTypeFromPath(String path) {
+ String extension = path;
+ int lastDot = extension.lastIndexOf('.');
+ if (lastDot != -1) {
+ extension = extension.substring(lastDot + 1);
+ }
+ // Convert the URI string to lower case to ensure compatibility with MimeTypeMap (see CB-2185).
+ extension = extension.toLowerCase(Locale.getDefault());
+ if (extension.equals("3ga")) {
+ return "audio/3gpp";
+ } else if (extension.equals("js")) {
+ // Missing from the map :(.
+ return "text/javascript";
+ }
+ return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
+ }
+
+ /**
+ * Opens a stream to the given URI, also providing the MIME type & length.
+ * @return Never returns null.
+ * @throws Throws an InvalidArgumentException for relative URIs. Relative URIs should be
+ * resolved before being passed into this function.
+ * @throws Throws an IOException if the URI cannot be opened.
+ * @throws Throws an IllegalStateException if called on a foreground thread.
+ */
+ public OpenForReadResult openForRead(Uri uri) throws IOException {
+ return openForRead(uri, false);
+ }
+
+ /**
+ * Opens a stream to the given URI, also providing the MIME type & length.
+ * @return Never returns null.
+ * @throws Throws an InvalidArgumentException for relative URIs. Relative URIs should be
+ * resolved before being passed into this function.
+ * @throws Throws an IOException if the URI cannot be opened.
+ * @throws Throws an IllegalStateException if called on a foreground thread and skipThreadCheck is false.
+ */
+ public OpenForReadResult openForRead(Uri uri, boolean skipThreadCheck) throws IOException {
+ if (!skipThreadCheck) {
+ assertBackgroundThread();
+ }
+ switch (getUriType(uri)) {
+ case URI_TYPE_FILE: {
+ FileInputStream inputStream = new FileInputStream(uri.getPath());
+ String mimeType = getMimeTypeFromPath(uri.getPath());
+ long length = inputStream.getChannel().size();
+ return new OpenForReadResult(uri, inputStream, mimeType, length, null);
+ }
+ case URI_TYPE_ASSET: {
+ String assetPath = uri.getPath().substring(15);
+ AssetFileDescriptor assetFd = null;
+ InputStream inputStream;
+ long length = -1;
+ try {
+ assetFd = assetManager.openFd(assetPath);
+ inputStream = assetFd.createInputStream();
+ length = assetFd.getLength();
+ } catch (FileNotFoundException e) {
+ // Will occur if the file is compressed.
+ inputStream = assetManager.open(assetPath);
+ length = inputStream.available();
+ }
+ String mimeType = getMimeTypeFromPath(assetPath);
+ return new OpenForReadResult(uri, inputStream, mimeType, length, assetFd);
+ }
+ case URI_TYPE_CONTENT:
+ case URI_TYPE_RESOURCE: {
+ String mimeType = contentResolver.getType(uri);
+ AssetFileDescriptor assetFd = contentResolver.openAssetFileDescriptor(uri, "r");
+ InputStream inputStream = assetFd.createInputStream();
+ long length = assetFd.getLength();
+ return new OpenForReadResult(uri, inputStream, mimeType, length, assetFd);
+ }
+ case URI_TYPE_DATA: {
+ OpenForReadResult ret = readDataUri(uri);
+ if (ret == null) {
+ break;
+ }
+ return ret;
+ }
+ case URI_TYPE_HTTP:
+ case URI_TYPE_HTTPS: {
+ HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();
+ conn.setRequestProperty("Accept-Encoding", "gzip");
+ conn.setDoInput(true);
+ String mimeType = conn.getHeaderField("Content-Type");
+ if (mimeType != null) {
+ mimeType = mimeType.split(";")[0];
+ }
+ int length = conn.getContentLength();
+ InputStream inputStream;
+ if ("gzip".equals(conn.getContentEncoding())) {
+ inputStream = new GZIPInputStream(conn.getInputStream());
+ } else {
+ inputStream = conn.getInputStream();
+ }
+ return new OpenForReadResult(uri, inputStream, mimeType, length, null);
+ }
+ case URI_TYPE_PLUGIN: {
+ String pluginId = uri.getHost();
+ CordovaPlugin plugin = pluginManager.getPlugin(pluginId);
+ if (plugin == null) {
+ throw new FileNotFoundException("Invalid plugin ID in URI: " + uri);
+ }
+ return plugin.handleOpenForRead(uri);
+ }
+ }
+ throw new FileNotFoundException("URI not supported by CordovaResourceApi: " + uri);
+ }
+
+ public OutputStream openOutputStream(Uri uri) throws IOException {
+ return openOutputStream(uri, false);
+ }
+
+ /**
+ * Opens a stream to the given URI.
+ * @return Never returns null.
+ * @throws Throws an InvalidArgumentException for relative URIs. Relative URIs should be
+ * resolved before being passed into this function.
+ * @throws Throws an IOException if the URI cannot be opened.
+ */
+ public OutputStream openOutputStream(Uri uri, boolean append) throws IOException {
+ assertBackgroundThread();
+ switch (getUriType(uri)) {
+ case URI_TYPE_FILE: {
+ File localFile = new File(uri.getPath());
+ File parent = localFile.getParentFile();
+ if (parent != null) {
+ parent.mkdirs();
+ }
+ return new FileOutputStream(localFile, append);
+ }
+ case URI_TYPE_CONTENT:
+ case URI_TYPE_RESOURCE: {
+ AssetFileDescriptor assetFd = contentResolver.openAssetFileDescriptor(uri, append ? "wa" : "w");
+ return assetFd.createOutputStream();
+ }
+ }
+ throw new FileNotFoundException("URI not supported by CordovaResourceApi: " + uri);
+ }
+
+ public HttpURLConnection createHttpConnection(Uri uri) throws IOException {
+ assertBackgroundThread();
+ return (HttpURLConnection)new URL(uri.toString()).openConnection();
+ }
+
+ // Copies the input to the output in the most efficient manner possible.
+ // Closes both streams.
+ public void copyResource(OpenForReadResult input, OutputStream outputStream) throws IOException {
+ assertBackgroundThread();
+ try {
+ InputStream inputStream = input.inputStream;
+ if (inputStream instanceof FileInputStream && outputStream instanceof FileOutputStream) {
+ FileChannel inChannel = ((FileInputStream)input.inputStream).getChannel();
+ FileChannel outChannel = ((FileOutputStream)outputStream).getChannel();
+ long offset = 0;
+ long length = input.length;
+ if (input.assetFd != null) {
+ offset = input.assetFd.getStartOffset();
+ }
+ // transferFrom()'s 2nd arg is a relative position. Need to set the absolute
+ // position first.
+ inChannel.position(offset);
+ outChannel.transferFrom(inChannel, 0, length);
+ } else {
+ final int BUFFER_SIZE = 8192;
+ byte[] buffer = new byte[BUFFER_SIZE];
+
+ for (;;) {
+ int bytesRead = inputStream.read(buffer, 0, BUFFER_SIZE);
+
+ if (bytesRead <= 0) {
+ break;
+ }
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ }
+ } finally {
+ input.inputStream.close();
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+ }
+
+ public void copyResource(Uri sourceUri, OutputStream outputStream) throws IOException {
+ copyResource(openForRead(sourceUri), outputStream);
+ }
+
+ // Added in 3.5.0.
+ public void copyResource(Uri sourceUri, Uri dstUri) throws IOException {
+ copyResource(openForRead(sourceUri), openOutputStream(dstUri));
+ }
+
+ private void assertBackgroundThread() {
+ if (threadCheckingEnabled) {
+ Thread curThread = Thread.currentThread();
+ if (curThread == Looper.getMainLooper().getThread()) {
+ throw new IllegalStateException("Do not perform IO operations on the UI thread. Use CordovaInterface.getThreadPool() instead.");
+ }
+ if (curThread == jsThread) {
+ throw new IllegalStateException("Tried to perform an IO operation on the WebCore thread. Use CordovaInterface.getThreadPool() instead.");
+ }
+ }
+ }
+
+ private String getDataUriMimeType(Uri uri) {
+ String uriAsString = uri.getSchemeSpecificPart();
+ int commaPos = uriAsString.indexOf(',');
+ if (commaPos == -1) {
+ return null;
+ }
+ String[] mimeParts = uriAsString.substring(0, commaPos).split(";");
+ if (mimeParts.length > 0) {
+ return mimeParts[0];
+ }
+ return null;
+ }
+
+ private OpenForReadResult readDataUri(Uri uri) {
+ String uriAsString = uri.getSchemeSpecificPart();
+ int commaPos = uriAsString.indexOf(',');
+ if (commaPos == -1) {
+ return null;
+ }
+ String[] mimeParts = uriAsString.substring(0, commaPos).split(";");
+ String contentType = null;
+ boolean base64 = false;
+ if (mimeParts.length > 0) {
+ contentType = mimeParts[0];
+ }
+ for (int i = 1; i < mimeParts.length; ++i) {
+ if ("base64".equalsIgnoreCase(mimeParts[i])) {
+ base64 = true;
+ }
+ }
+ String dataPartAsString = uriAsString.substring(commaPos + 1);
+ byte[] data;
+ if (base64) {
+ data = Base64.decode(dataPartAsString, Base64.DEFAULT);
+ } else {
+ try {
+ data = dataPartAsString.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ data = dataPartAsString.getBytes();
+ }
+ }
+ InputStream inputStream = new ByteArrayInputStream(data);
+ return new OpenForReadResult(uri, inputStream, contentType, data.length, null);
+ }
+
+ private static void assertNonRelative(Uri uri) {
+ if (!uri.isAbsolute()) {
+ throw new IllegalArgumentException("Relative URIs are not supported.");
+ }
+ }
+
+ public static final class OpenForReadResult {
+ public final Uri uri;
+ public final InputStream inputStream;
+ public final String mimeType;
+ public final long length;
+ public final AssetFileDescriptor assetFd;
+
+ public OpenForReadResult(Uri uri, InputStream inputStream, String mimeType, long length, AssetFileDescriptor assetFd) {
+ this.uri = uri;
+ this.inputStream = inputStream;
+ this.mimeType = mimeType;
+ this.length = length;
+ this.assetFd = assetFd;
+ }
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebView.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebView.java
new file mode 100644
index 0000000..a8a8ca4
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebView.java
@@ -0,0 +1,142 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.util.List;
+import java.util.Map;
+
+import android.content.Context;
+import android.content.Intent;
+import android.view.View;
+import android.webkit.WebChromeClient.CustomViewCallback;
+
+/**
+ * Main interface for interacting with a Cordova webview - implemented by CordovaWebViewImpl.
+ * This is an interface so that it can be easily mocked in tests.
+ * Methods may be added to this interface without a major version bump, as plugins & embedders
+ * are not expected to implement it.
+ */
+public interface CordovaWebView {
+ public static final String CORDOVA_VERSION = "10.1.2";
+
+ void init(CordovaInterface cordova, List pluginEntries, CordovaPreferences preferences);
+
+ boolean isInitialized();
+
+ View getView();
+
+ void loadUrlIntoView(String url, boolean recreatePlugins);
+
+ void stopLoading();
+
+ boolean canGoBack();
+
+ void clearCache();
+
+ /** Use parameter-less overload */
+ @Deprecated
+ void clearCache(boolean b);
+
+ void clearHistory();
+
+ boolean backHistory();
+
+ void handlePause(boolean keepRunning);
+
+ void onNewIntent(Intent intent);
+
+ void handleResume(boolean keepRunning);
+
+ void handleStart();
+
+ void handleStop();
+
+ void handleDestroy();
+
+ /**
+ * Send JavaScript statement back to JavaScript.
+ *
+ * Deprecated (https://issues.apache.org/jira/browse/CB-6851)
+ * Instead of executing snippets of JS, you should use the exec bridge
+ * to create a Java->JS communication channel.
+ * To do this:
+ * 1. Within plugin.xml (to have your JS run before deviceready):
+ *
+ * 2. Within your .js (call exec on start-up):
+ * require('cordova/channel').onCordovaReady.subscribe(function() {
+ * require('cordova/exec')(win, null, 'Plugin', 'method', []);
+ * function win(message) {
+ * ... process message from java here ...
+ * }
+ * });
+ * 3. Within your .java:
+ * PluginResult dataResult = new PluginResult(PluginResult.Status.OK, CODE);
+ * dataResult.setKeepCallback(true);
+ * savedCallbackContext.sendPluginResult(dataResult);
+ */
+ @Deprecated
+ void sendJavascript(String statememt);
+
+ /**
+ * Load the specified URL in the Cordova webview or a new browser instance.
+ *
+ * NOTE: If openExternal is false, only allow listed URLs can be loaded.
+ *
+ * @param url The url to load.
+ * @param openExternal Load url in browser instead of Cordova webview.
+ * @param clearHistory Clear the history stack, so new page becomes top of history
+ * @param params Parameters for new app
+ */
+ void showWebPage(String url, boolean openExternal, boolean clearHistory, Map params);
+
+ /**
+ * Deprecated in 4.0.0. Use your own View-toggling logic.
+ */
+ @Deprecated
+ boolean isCustomViewShowing();
+
+ /**
+ * Deprecated in 4.0.0. Use your own View-toggling logic.
+ */
+ @Deprecated
+ void showCustomView(View view, CustomViewCallback callback);
+
+ /**
+ * Deprecated in 4.0.0. Use your own View-toggling logic.
+ */
+ @Deprecated
+ void hideCustomView();
+
+ CordovaResourceApi getResourceApi();
+
+ void setButtonPlumbedToJs(int keyCode, boolean override);
+ boolean isButtonPlumbedToJs(int keyCode);
+
+ void sendPluginResult(PluginResult cr, String callbackId);
+
+ PluginManager getPluginManager();
+ CordovaWebViewEngine getEngine();
+ CordovaPreferences getPreferences();
+ ICordovaCookieManager getCookieManager();
+
+ String getUrl();
+
+ // TODO: Work on deleting these by removing refs from plugins.
+ Context getContext();
+ void loadUrl(String url);
+ Object postMessage(String id, Object data);
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebViewEngine.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebViewEngine.java
new file mode 100644
index 0000000..c8e5a55
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebViewEngine.java
@@ -0,0 +1,85 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.view.KeyEvent;
+import android.view.View;
+import android.webkit.ValueCallback;
+
+/**
+ * Interface for all Cordova engines.
+ * No methods will be added to this class (in order to be compatible with existing engines).
+ * Instead, we will create a new interface: e.g. CordovaWebViewEngineV2
+ */
+public interface CordovaWebViewEngine {
+ void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client,
+ CordovaResourceApi resourceApi, PluginManager pluginManager,
+ NativeToJsMessageQueue nativeToJsMessageQueue);
+
+ CordovaWebView getCordovaWebView();
+ ICordovaCookieManager getCookieManager();
+ View getView();
+
+ void loadUrl(String url, boolean clearNavigationStack);
+
+ void stopLoading();
+
+ /** Return the currently loaded URL */
+ String getUrl();
+
+ void clearCache();
+
+ /** After calling clearHistory(), canGoBack() should be false. */
+ void clearHistory();
+
+ boolean canGoBack();
+
+ /** Returns whether a navigation occurred */
+ boolean goBack();
+
+ /** Pauses / resumes the WebView's event loop. */
+ void setPaused(boolean value);
+
+ /** Clean up all resources associated with the WebView. */
+ void destroy();
+
+ /** Add the evaulate Javascript method **/
+ void evaluateJavascript(String js, ValueCallback callback);
+
+ /**
+ * Used to retrieve the associated CordovaWebView given a View without knowing the type of Engine.
+ * E.g. ((CordovaWebView.EngineView)activity.findViewById(android.R.id.webView)).getCordovaWebView();
+ */
+ public interface EngineView {
+ CordovaWebView getCordovaWebView();
+ }
+
+ /**
+ * Contains methods that an engine uses to communicate with the parent CordovaWebView.
+ * Methods may be added in future cordova versions, but never removed.
+ */
+ public interface Client {
+ Boolean onDispatchKeyEvent(KeyEvent event);
+ void clearLoadTimeoutTimer();
+ void onPageStarted(String newUrl);
+ void onReceivedError(int errorCode, String description, String failingUrl);
+ void onPageFinishedLoading(String url);
+ boolean onNavigationAttempt(String url);
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebViewImpl.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebViewImpl.java
new file mode 100644
index 0000000..2b8a8f8
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CordovaWebViewImpl.java
@@ -0,0 +1,668 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.annotation.SuppressLint;
+import android.content.ActivityNotFoundException;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebChromeClient;
+import android.widget.FrameLayout;
+
+import org.apache.cordova.engine.SystemWebViewEngine;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.lang.reflect.Constructor;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Main class for interacting with a Cordova webview. Manages plugins, events, and a CordovaWebViewEngine.
+ * Class uses two-phase initialization. You must call init() before calling any other methods.
+ */
+public class CordovaWebViewImpl implements CordovaWebView {
+
+ public static final String TAG = "CordovaWebViewImpl";
+
+ private PluginManager pluginManager;
+
+ protected final CordovaWebViewEngine engine;
+ private CordovaInterface cordova;
+
+ // Flag to track that a loadUrl timeout occurred
+ private int loadUrlTimeout = 0;
+
+ private CordovaResourceApi resourceApi;
+ private CordovaPreferences preferences;
+ private CoreAndroid appPlugin;
+ private NativeToJsMessageQueue nativeToJsMessageQueue;
+ private EngineClient engineClient = new EngineClient();
+ private boolean hasPausedEver;
+
+ // The URL passed to loadUrl(), not necessarily the URL of the current page.
+ String loadedUrl;
+
+ /** custom view created by the browser (a video player for example) */
+ private View mCustomView;
+ private WebChromeClient.CustomViewCallback mCustomViewCallback;
+
+ private Set boundKeyCodes = new HashSet();
+
+ public static CordovaWebViewEngine createEngine(Context context, CordovaPreferences preferences) {
+ String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
+ try {
+ Class> webViewClass = Class.forName(className);
+ Constructor> constructor = webViewClass.getConstructor(Context.class, CordovaPreferences.class);
+ return (CordovaWebViewEngine) constructor.newInstance(context, preferences);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to create webview. ", e);
+ }
+ }
+
+ public CordovaWebViewImpl(CordovaWebViewEngine cordovaWebViewEngine) {
+ this.engine = cordovaWebViewEngine;
+ }
+
+ // Convenience method for when creating programmatically (not from Config.xml).
+ public void init(CordovaInterface cordova) {
+ init(cordova, new ArrayList(), new CordovaPreferences());
+ }
+
+ @SuppressLint("Assert")
+ @Override
+ public void init(CordovaInterface cordova, List pluginEntries, CordovaPreferences preferences) {
+ if (this.cordova != null) {
+ throw new IllegalStateException();
+ }
+ this.cordova = cordova;
+ this.preferences = preferences;
+ pluginManager = new PluginManager(this, this.cordova, pluginEntries);
+ resourceApi = new CordovaResourceApi(engine.getView().getContext(), pluginManager);
+ nativeToJsMessageQueue = new NativeToJsMessageQueue();
+ nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
+ nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(engine, cordova));
+
+ if (preferences.getBoolean("DisallowOverscroll", false)) {
+ engine.getView().setOverScrollMode(View.OVER_SCROLL_NEVER);
+ }
+ engine.init(this, cordova, engineClient, resourceApi, pluginManager, nativeToJsMessageQueue);
+ // This isn't enforced by the compiler, so assert here.
+ assert engine.getView() instanceof CordovaWebViewEngine.EngineView;
+
+ pluginManager.addService(CoreAndroid.PLUGIN_NAME, "org.apache.cordova.CoreAndroid");
+ pluginManager.init();
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return cordova != null;
+ }
+
+ @Override
+ public void loadUrlIntoView(final String url, boolean recreatePlugins) {
+ LOG.d(TAG, ">>> loadUrl(" + url + ")");
+ if (url.equals("about:blank") || url.startsWith("javascript:")) {
+ engine.loadUrl(url, false);
+ return;
+ }
+
+ recreatePlugins = recreatePlugins || (loadedUrl == null);
+
+ if (recreatePlugins) {
+ // Don't re-initialize on first load.
+ if (loadedUrl != null) {
+ appPlugin = null;
+ pluginManager.init();
+ }
+ loadedUrl = url;
+ }
+
+ // Create a timeout timer for loadUrl
+ final int currentLoadUrlTimeout = loadUrlTimeout;
+ final int loadUrlTimeoutValue = preferences.getInteger("LoadUrlTimeoutValue", 20000);
+
+ // Timeout error method
+ final Runnable loadError = new Runnable() {
+ public void run() {
+ stopLoading();
+ LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!");
+
+ // Handle other errors by passing them to the webview in JS
+ JSONObject data = new JSONObject();
+ try {
+ data.put("errorCode", -6);
+ data.put("description", "The connection to the server was unsuccessful.");
+ data.put("url", url);
+ } catch (JSONException e) {
+ // Will never happen.
+ }
+ pluginManager.postMessage("onReceivedError", data);
+ }
+ };
+
+ // Timeout timer method
+ final Runnable timeoutCheck = new Runnable() {
+ public void run() {
+ try {
+ synchronized (this) {
+ wait(loadUrlTimeoutValue);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ // If timeout, then stop loading and handle error (if activity still exists)
+ if (loadUrlTimeout == currentLoadUrlTimeout && cordova.getActivity() != null) {
+ cordova.getActivity().runOnUiThread(loadError);
+ } else if (cordova.getActivity() == null) {
+ LOG.d(TAG, "Cordova activity does not exist.");
+ }
+ }
+ };
+
+ if (cordova.getActivity() != null) {
+ final boolean _recreatePlugins = recreatePlugins;
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ if (loadUrlTimeoutValue > 0) {
+ cordova.getThreadPool().execute(timeoutCheck);
+ }
+ engine.loadUrl(url, _recreatePlugins);
+ }
+ });
+ } else {
+ LOG.d(TAG, "Cordova activity does not exist.");
+ }
+ }
+
+
+ @Override
+ public void loadUrl(String url) {
+ loadUrlIntoView(url, true);
+ }
+
+ @Override
+ public void showWebPage(String url, boolean openExternal, boolean clearHistory, Map params) {
+ LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap)", url, openExternal, clearHistory);
+
+ // If clearing history
+ if (clearHistory) {
+ engine.clearHistory();
+ }
+
+ // If loading into our webview
+ if (!openExternal) {
+ // Make sure url is in allow list
+ if (pluginManager.shouldAllowNavigation(url)) {
+ // TODO: What about params?
+ // Load new URL
+ loadUrlIntoView(url, true);
+ return;
+ } else {
+ LOG.w(TAG, "showWebPage: Refusing to load URL into webview since it is not in the allow list. URL=" + url);
+ return;
+ }
+ }
+ if (!pluginManager.shouldOpenExternalUrl(url)) {
+ LOG.w(TAG, "showWebPage: Refusing to send intent for URL since it is not in the allow list. URL=" + url);
+ return;
+ }
+
+ Intent intent = null;
+ try {
+ if (url.startsWith("intent://")) {
+ intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
+ } else {
+ intent = new Intent(Intent.ACTION_VIEW);
+ // To send an intent without CATEGORY_BROWSER, a custom plugin should be used.
+ intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ Uri uri = Uri.parse(url);
+ // Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".
+ // Adding the MIME type to http: URLs causes them to not be handled by the downloader.
+ if ("file".equals(uri.getScheme())) {
+ intent.setDataAndType(uri, resourceApi.getMimeType(uri));
+ } else {
+ intent.setData(uri);
+ }
+ }
+ if (cordova.getActivity() != null) {
+ cordova.getActivity().startActivity(intent);
+ } else {
+ LOG.d(TAG, "Cordova activity does not exist.");
+ }
+ } catch (URISyntaxException e) {
+ LOG.e(TAG, "Error parsing url " + url, e);
+ } catch (ActivityNotFoundException e) {
+ if (url.startsWith("intent://") && intent != null && intent.getStringExtra("browser_fallback_url") != null) {
+ showWebPage(intent.getStringExtra("browser_fallback_url"), openExternal, clearHistory, params);
+ } else {
+ LOG.e(TAG, "Error loading url " + url, e);
+ }
+ }
+ }
+
+ private static class WrapperView extends FrameLayout {
+
+ private final CordovaWebViewEngine engine;
+
+ public WrapperView(Context context, CordovaWebViewEngine engine) {
+ super(context);
+ this.engine = engine;
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ boolean ret = engine.getView().dispatchKeyEvent(event);
+ if (!ret) {
+ // If the engine didn't handle the event, handle it normally.
+ ret = super.dispatchKeyEvent(event);
+ }
+ return ret;
+ }
+ }
+
+ @Override
+ @Deprecated
+ public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
+ // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
+ LOG.d(TAG, "showing Custom View");
+ // if a view already exists then immediately terminate the new one
+ if (mCustomView != null) {
+ callback.onCustomViewHidden();
+ return;
+ }
+
+ WrapperView wrapperView = new WrapperView(getContext(), engine);
+ wrapperView.addView(view);
+
+ // Store the view and its callback for later (to kill it properly)
+ mCustomView = wrapperView;
+ mCustomViewCallback = callback;
+
+ // Add the custom view to its container.
+ ViewGroup parent = (ViewGroup) engine.getView().getParent();
+ parent.addView(wrapperView, new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ Gravity.CENTER));
+
+ // Hide the content view.
+ engine.getView().setVisibility(View.GONE);
+
+ // Finally show the custom view container.
+ parent.setVisibility(View.VISIBLE);
+ parent.bringToFront();
+ }
+
+ @Override
+ @Deprecated
+ public void hideCustomView() {
+ // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
+ if (mCustomView == null) return;
+ LOG.d(TAG, "Hiding Custom View");
+
+ // Hide the custom view.
+ mCustomView.setVisibility(View.GONE);
+
+ // Remove the custom view from its container.
+ ViewGroup parent = (ViewGroup) engine.getView().getParent();
+ parent.removeView(mCustomView);
+ mCustomView = null;
+ mCustomViewCallback.onCustomViewHidden();
+
+ // Show the content view.
+ engine.getView().setVisibility(View.VISIBLE);
+ engine.getView().requestFocus();
+ }
+
+ @Override
+ @Deprecated
+ public boolean isCustomViewShowing() {
+ return mCustomView != null;
+ }
+
+ @Override
+ @Deprecated
+ public void sendJavascript(String statement) {
+ nativeToJsMessageQueue.addJavaScript(statement);
+ }
+
+ @Override
+ public void sendPluginResult(PluginResult cr, String callbackId) {
+ nativeToJsMessageQueue.addPluginResult(cr, callbackId);
+ }
+
+ @Override
+ public PluginManager getPluginManager() {
+ return pluginManager;
+ }
+ @Override
+ public CordovaPreferences getPreferences() {
+ return preferences;
+ }
+ @Override
+ public ICordovaCookieManager getCookieManager() {
+ return engine.getCookieManager();
+ }
+ @Override
+ public CordovaResourceApi getResourceApi() {
+ return resourceApi;
+ }
+ @Override
+ public CordovaWebViewEngine getEngine() {
+ return engine;
+ }
+ @Override
+ public View getView() {
+ return engine.getView();
+ }
+ @Override
+ public Context getContext() {
+ return engine.getView().getContext();
+ }
+
+ private void sendJavascriptEvent(String event) {
+ if (appPlugin == null) {
+ appPlugin = (CoreAndroid)pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
+ }
+
+ if (appPlugin == null) {
+ LOG.w(TAG, "Unable to fire event without existing plugin");
+ return;
+ }
+ appPlugin.fireJavascriptEvent(event);
+ }
+
+ @Override
+ public void setButtonPlumbedToJs(int keyCode, boolean override) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ case KeyEvent.KEYCODE_BACK:
+ case KeyEvent.KEYCODE_MENU:
+ // TODO: Why are search and menu buttons handled separately?
+ if (override) {
+ boundKeyCodes.add(keyCode);
+ } else {
+ boundKeyCodes.remove(keyCode);
+ }
+ return;
+ default:
+ throw new IllegalArgumentException("Unsupported keycode: " + keyCode);
+ }
+ }
+
+ @Override
+ public boolean isButtonPlumbedToJs(int keyCode) {
+ return boundKeyCodes.contains(keyCode);
+ }
+
+ @Override
+ public Object postMessage(String id, Object data) {
+ return pluginManager.postMessage(id, data);
+ }
+
+ // Engine method proxies:
+ @Override
+ public String getUrl() {
+ return engine.getUrl();
+ }
+
+ @Override
+ public void stopLoading() {
+ // Clear timeout flag
+ loadUrlTimeout++;
+ }
+
+ @Override
+ public boolean canGoBack() {
+ return engine.canGoBack();
+ }
+
+ @Override
+ public void clearCache() {
+ engine.clearCache();
+ }
+
+ @Override
+ @Deprecated
+ public void clearCache(boolean b) {
+ engine.clearCache();
+ }
+
+ @Override
+ public void clearHistory() {
+ engine.clearHistory();
+ }
+
+ @Override
+ public boolean backHistory() {
+ return engine.goBack();
+ }
+
+ /////// LifeCycle methods ///////
+ @Override
+ public void onNewIntent(Intent intent) {
+ if (this.pluginManager != null) {
+ this.pluginManager.onNewIntent(intent);
+ }
+ }
+ @Override
+ public void handlePause(boolean keepRunning) {
+ if (!isInitialized()) {
+ return;
+ }
+ hasPausedEver = true;
+ pluginManager.onPause(keepRunning);
+ sendJavascriptEvent("pause");
+
+ // If app doesn't want to run in background
+ if (!keepRunning) {
+ // Pause JavaScript timers. This affects all webviews within the app!
+ engine.setPaused(true);
+ }
+ }
+ @Override
+ public void handleResume(boolean keepRunning) {
+ if (!isInitialized()) {
+ return;
+ }
+
+ // Resume JavaScript timers. This affects all webviews within the app!
+ engine.setPaused(false);
+ this.pluginManager.onResume(keepRunning);
+
+ // In order to match the behavior of the other platforms, we only send onResume after an
+ // onPause has occurred. The resume event might still be sent if the Activity was killed
+ // while waiting for the result of an external Activity once the result is obtained
+ if (hasPausedEver) {
+ sendJavascriptEvent("resume");
+ }
+ }
+ @Override
+ public void handleStart() {
+ if (!isInitialized()) {
+ return;
+ }
+ pluginManager.onStart();
+ }
+ @Override
+ public void handleStop() {
+ if (!isInitialized()) {
+ return;
+ }
+ pluginManager.onStop();
+ }
+ @Override
+ public void handleDestroy() {
+ if (!isInitialized()) {
+ return;
+ }
+ // Cancel pending timeout timer.
+ loadUrlTimeout++;
+
+ // Forward to plugins
+ this.pluginManager.onDestroy();
+
+ // TODO: about:blank is a bit special (and the default URL for new frames)
+ // We should use a blank data: url instead so it's more obvious
+ this.loadUrl("about:blank");
+
+ // TODO: Should not destroy webview until after about:blank is done loading.
+ engine.destroy();
+ hideCustomView();
+ }
+
+ protected class EngineClient implements CordovaWebViewEngine.Client {
+ @Override
+ public void clearLoadTimeoutTimer() {
+ loadUrlTimeout++;
+ }
+
+ @Override
+ public void onPageStarted(String newUrl) {
+ LOG.d(TAG, "onPageDidNavigate(" + newUrl + ")");
+ boundKeyCodes.clear();
+ pluginManager.onReset();
+ pluginManager.postMessage("onPageStarted", newUrl);
+ }
+
+ @Override
+ public void onReceivedError(int errorCode, String description, String failingUrl) {
+ clearLoadTimeoutTimer();
+ JSONObject data = new JSONObject();
+ try {
+ data.put("errorCode", errorCode);
+ data.put("description", description);
+ data.put("url", failingUrl);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ pluginManager.postMessage("onReceivedError", data);
+ }
+
+ @Override
+ public void onPageFinishedLoading(String url) {
+ LOG.d(TAG, "onPageFinished(" + url + ")");
+
+ clearLoadTimeoutTimer();
+
+ // Broadcast message that page has loaded
+ pluginManager.postMessage("onPageFinished", url);
+
+ // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly
+ if (engine.getView().getVisibility() != View.VISIBLE) {
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(2000);
+ if (cordova.getActivity() != null) {
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ pluginManager.postMessage("spinner", "stop");
+ }
+ });
+ } else {
+ LOG.d(TAG, "Cordova activity does not exist.");
+ }
+ } catch (InterruptedException e) {
+ }
+ }
+ });
+ t.start();
+ }
+
+ // Shutdown if blank loaded
+ if (url.equals("about:blank")) {
+ pluginManager.postMessage("exit", null);
+ }
+ }
+
+ @Override
+ public Boolean onDispatchKeyEvent(KeyEvent event) {
+ int keyCode = event.getKeyCode();
+ boolean isBackButton = keyCode == KeyEvent.KEYCODE_BACK;
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ if (isBackButton && mCustomView != null) {
+ return true;
+ } else if (boundKeyCodes.contains(keyCode)) {
+ return true;
+ } else if (isBackButton) {
+ return engine.canGoBack();
+ }
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ if (isBackButton && mCustomView != null) {
+ hideCustomView();
+ return true;
+ } else if (boundKeyCodes.contains(keyCode)) {
+ String eventName = null;
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ eventName = "volumedownbutton";
+ break;
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ eventName = "volumeupbutton";
+ break;
+ case KeyEvent.KEYCODE_SEARCH:
+ eventName = "searchbutton";
+ break;
+ case KeyEvent.KEYCODE_MENU:
+ eventName = "menubutton";
+ break;
+ case KeyEvent.KEYCODE_BACK:
+ eventName = "backbutton";
+ break;
+ }
+ if (eventName != null) {
+ sendJavascriptEvent(eventName);
+ return true;
+ }
+ } else if (isBackButton) {
+ return engine.goBack();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean onNavigationAttempt(String url) {
+ // Give plugins the chance to handle the url
+ if (pluginManager.onOverrideUrlLoading(url)) {
+ return true;
+ } else if (pluginManager.shouldAllowNavigation(url)) {
+ return false;
+ } else if (pluginManager.shouldOpenExternalUrl(url)) {
+ showWebPage(url, true, false, null);
+ return true;
+ }
+ LOG.w(TAG, "Blocked (possibly sub-frame) navigation to non-allowed URL: " + url);
+ return true;
+ }
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/CoreAndroid.java b/node_modules/cordova-android/framework/src/org/apache/cordova/CoreAndroid.java
new file mode 100644
index 0000000..6ebdecb
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/CoreAndroid.java
@@ -0,0 +1,410 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.telephony.TelephonyManager;
+import android.view.KeyEvent;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+
+/**
+ * This class exposes methods in Cordova that can be called from JavaScript.
+ */
+public class CoreAndroid extends CordovaPlugin {
+
+ public static final String PLUGIN_NAME = "CoreAndroid";
+ protected static final String TAG = "CordovaApp";
+ private BroadcastReceiver telephonyReceiver;
+ private CallbackContext messageChannel;
+ private PluginResult pendingResume;
+ private PluginResult pendingPause;
+ private final Object messageChannelLock = new Object();
+
+ /**
+ * Send an event to be fired on the Javascript side.
+ *
+ * @param action The name of the event to be fired
+ */
+ public void fireJavascriptEvent(String action) {
+ sendEventMessage(action);
+ }
+
+ /**
+ * Sets the context of the Command. This can then be used to do things like
+ * get file paths associated with the Activity.
+ */
+ @Override
+ public void pluginInitialize() {
+ this.initTelephonyReceiver();
+ }
+
+ /**
+ * Executes the request and returns PluginResult.
+ *
+ * @param action The action to execute.
+ * @param args JSONArry of arguments for the plugin.
+ * @param callbackContext The callback context from which we were invoked.
+ * @return A PluginResult object with a status and message.
+ */
+ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+ PluginResult.Status status = PluginResult.Status.OK;
+ String result = "";
+
+ try {
+ if (action.equals("clearCache")) {
+ this.clearCache();
+ }
+ else if (action.equals("show")) {
+ // This gets called from JavaScript onCordovaReady to show the webview.
+ // I recommend we change the name of the Message as spinner/stop is not
+ // indicative of what this actually does (shows the webview).
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ webView.getPluginManager().postMessage("spinner", "stop");
+ }
+ });
+ }
+ else if (action.equals("loadUrl")) {
+ this.loadUrl(args.getString(0), args.optJSONObject(1));
+ }
+ else if (action.equals("cancelLoadUrl")) {
+ //this.cancelLoadUrl();
+ }
+ else if (action.equals("clearHistory")) {
+ this.clearHistory();
+ }
+ else if (action.equals("backHistory")) {
+ this.backHistory();
+ }
+ else if (action.equals("overrideButton")) {
+ this.overrideButton(args.getString(0), args.getBoolean(1));
+ }
+ else if (action.equals("overrideBackbutton")) {
+ this.overrideBackbutton(args.getBoolean(0));
+ }
+ else if (action.equals("exitApp")) {
+ this.exitApp();
+ }
+ else if (action.equals("messageChannel")) {
+ synchronized(messageChannelLock) {
+ messageChannel = callbackContext;
+ if (pendingPause != null) {
+ sendEventMessage(pendingPause);
+ pendingPause = null;
+ }
+ if (pendingResume != null) {
+ sendEventMessage(pendingResume);
+ pendingResume = null;
+ }
+ }
+ return true;
+ }
+
+ callbackContext.sendPluginResult(new PluginResult(status, result));
+ return true;
+ } catch (JSONException e) {
+ callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return false;
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ // LOCAL METHODS
+ //--------------------------------------------------------------------------
+
+ /**
+ * Clear the resource cache.
+ */
+ public void clearCache() {
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ webView.clearCache();
+ }
+ });
+ }
+
+ /**
+ * Load the url into the webview.
+ *
+ * @param url
+ * @param props Properties that can be passed in to the Cordova activity (i.e. loadingDialog, wait, ...)
+ * @throws JSONException
+ */
+ public void loadUrl(String url, JSONObject props) throws JSONException {
+ LOG.d("App", "App.loadUrl("+url+","+props+")");
+ int wait = 0;
+ boolean openExternal = false;
+ boolean clearHistory = false;
+
+ // If there are properties, then set them on the Activity
+ HashMap params = new HashMap();
+ if (props != null) {
+ JSONArray keys = props.names();
+ for (int i = 0; i < keys.length(); i++) {
+ String key = keys.getString(i);
+ if (key.equals("wait")) {
+ wait = props.getInt(key);
+ }
+ else if (key.equalsIgnoreCase("openexternal")) {
+ openExternal = props.getBoolean(key);
+ }
+ else if (key.equalsIgnoreCase("clearhistory")) {
+ clearHistory = props.getBoolean(key);
+ }
+ else {
+ Object value = props.get(key);
+ if (value == null) {
+
+ }
+ else if (value.getClass().equals(String.class)) {
+ params.put(key, (String)value);
+ }
+ else if (value.getClass().equals(Boolean.class)) {
+ params.put(key, (Boolean)value);
+ }
+ else if (value.getClass().equals(Integer.class)) {
+ params.put(key, (Integer)value);
+ }
+ }
+ }
+ }
+
+ // If wait property, then delay loading
+
+ if (wait > 0) {
+ try {
+ synchronized(this) {
+ this.wait(wait);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ this.webView.showWebPage(url, openExternal, clearHistory, params);
+ }
+
+ /**
+ * Clear page history for the app.
+ */
+ public void clearHistory() {
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ webView.clearHistory();
+ }
+ });
+ }
+
+ /**
+ * Go to previous page displayed.
+ * This is the same as pressing the backbutton on Android device.
+ */
+ public void backHistory() {
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ webView.backHistory();
+ }
+ });
+ }
+
+ /**
+ * Override the default behavior of the Android back button.
+ * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
+ *
+ * @param override T=override, F=cancel override
+ */
+ public void overrideBackbutton(boolean override) {
+ LOG.i("App", "WARNING: Back Button Default Behavior will be overridden. The backbutton event will be fired!");
+ webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_BACK, override);
+ }
+
+ /**
+ * Override the default behavior of the Android volume buttons.
+ * If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired.
+ *
+ * @param button volumeup, volumedown
+ * @param override T=override, F=cancel override
+ */
+ public void overrideButton(String button, boolean override) {
+ LOG.i("App", "WARNING: Volume Button Default Behavior will be overridden. The volume event will be fired!");
+ if (button.equals("volumeup")) {
+ webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_UP, override);
+ }
+ else if (button.equals("volumedown")) {
+ webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN, override);
+ }
+ else if (button.equals("menubutton")) {
+ webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_MENU, override);
+ }
+ }
+
+ /**
+ * Return whether the Android back button is overridden by the user.
+ *
+ * @return boolean
+ */
+ public boolean isBackbuttonOverridden() {
+ return webView.isButtonPlumbedToJs(KeyEvent.KEYCODE_BACK);
+ }
+
+ /**
+ * Exit the Android application.
+ */
+ public void exitApp() {
+ this.webView.getPluginManager().postMessage("exit", null);
+ }
+
+
+ /**
+ * Listen for telephony events: RINGING, OFFHOOK and IDLE
+ * Send these events to all plugins using
+ * CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
+ */
+ private void initTelephonyReceiver() {
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
+ //final CordovaInterface mycordova = this.cordova;
+ this.telephonyReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ // If state has changed
+ if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
+ if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) {
+ String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
+ if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
+ LOG.i(TAG, "Telephone RINGING");
+ webView.getPluginManager().postMessage("telephone", "ringing");
+ }
+ else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
+ LOG.i(TAG, "Telephone OFFHOOK");
+ webView.getPluginManager().postMessage("telephone", "offhook");
+ }
+ else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
+ LOG.i(TAG, "Telephone IDLE");
+ webView.getPluginManager().postMessage("telephone", "idle");
+ }
+ }
+ }
+ }
+ };
+
+ // Register the receiver
+ webView.getContext().registerReceiver(this.telephonyReceiver, intentFilter);
+ }
+
+ private void sendEventMessage(String action) {
+ JSONObject obj = new JSONObject();
+ try {
+ obj.put("action", action);
+ } catch (JSONException e) {
+ LOG.e(TAG, "Failed to create event message", e);
+ }
+ PluginResult result = new PluginResult(PluginResult.Status.OK, obj);
+
+ if (messageChannel == null) {
+ LOG.i(TAG, "Request to send event before messageChannel initialised: " + action);
+ if ("pause".equals(action)) {
+ pendingPause = result;
+ } else if ("resume".equals(action)) {
+ // When starting normally onPause then onResume is called
+ pendingPause = null;
+ }
+ } else {
+ sendEventMessage(result);
+ }
+ }
+
+ private void sendEventMessage(PluginResult payload) {
+ payload.setKeepCallback(true);
+ if (messageChannel != null) {
+ messageChannel.sendPluginResult(payload);
+ }
+ }
+
+ /*
+ * Unregister the receiver
+ *
+ */
+ public void onDestroy()
+ {
+ webView.getContext().unregisterReceiver(this.telephonyReceiver);
+ }
+
+ /**
+ * Used to send the resume event in the case that the Activity is destroyed by the OS
+ *
+ * @param resumeEvent PluginResult containing the payload for the resume event to be fired
+ */
+ public void sendResumeEvent(PluginResult resumeEvent) {
+ // This operation must be synchronized because plugin results that trigger resume
+ // events can be processed asynchronously
+ synchronized(messageChannelLock) {
+ if (messageChannel != null) {
+ sendEventMessage(resumeEvent);
+ } else {
+ // Might get called before the page loads, so we need to store it until the
+ // messageChannel gets created
+ this.pendingResume = resumeEvent;
+ }
+ }
+ }
+
+ /*
+ * This needs to be implemented if you wish to use the Camera Plugin or other plugins
+ * that read the Build Configuration.
+ *
+ * Thanks to Phil@Medtronic and Graham Borland for finding the answer and posting it to
+ * StackOverflow. This is annoying as hell!
+ *
+ */
+
+ public static Object getBuildConfigValue(Context ctx, String key)
+ {
+ try
+ {
+ Class> clazz = Class.forName(ctx.getClass().getPackage().getName() + ".BuildConfig");
+ Field field = clazz.getField(key);
+ return field.get(null);
+ } catch (ClassNotFoundException e) {
+ LOG.d(TAG, "Unable to get the BuildConfig, is this built with ANT?");
+ e.printStackTrace();
+ } catch (NoSuchFieldException e) {
+ LOG.d(TAG, key + " is not a valid field. Check your build.gradle");
+ } catch (IllegalAccessException e) {
+ LOG.d(TAG, "Illegal Access Exception: Let's print a stack trace.");
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ LOG.d(TAG, "Null Pointer Exception: Let's print a stack trace.");
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/ExposedJsApi.java b/node_modules/cordova-android/framework/src/org/apache/cordova/ExposedJsApi.java
new file mode 100644
index 0000000..acc65c6
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -0,0 +1,31 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+import org.json.JSONException;
+
+/*
+ * Any exposed Javascript API MUST implement these three things!
+ */
+public interface ExposedJsApi {
+ public String exec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException;
+ public void setNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException;
+ public String retrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException;
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaClientCertRequest.java b/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaClientCertRequest.java
new file mode 100644
index 0000000..1417a15
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaClientCertRequest.java
@@ -0,0 +1,66 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+/**
+ * Specifies interface for handling certificate requests.
+ */
+public interface ICordovaClientCertRequest {
+ /**
+ * Cancel this request
+ */
+ public void cancel();
+
+ /*
+ * Returns the host name of the server requesting the certificate.
+ */
+ public String getHost();
+
+ /*
+ * Returns the acceptable types of asymmetric keys (can be null).
+ */
+ public String[] getKeyTypes();
+
+ /*
+ * Returns the port number of the server requesting the certificate.
+ */
+ public int getPort();
+
+ /*
+ * Returns the acceptable certificate issuers for the certificate matching the private key (can be null).
+ */
+ public Principal[] getPrincipals();
+
+ /*
+ * Ignore the request for now. Do not remember user's choice.
+ */
+ public void ignore();
+
+ /*
+ * Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests.
+ *
+ * @param privateKey The privateKey
+ * @param chain The certificate chain
+ */
+ public void proceed(PrivateKey privateKey, X509Certificate[] chain);
+}
\ No newline at end of file
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaCookieManager.java b/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaCookieManager.java
new file mode 100644
index 0000000..e776194
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaCookieManager.java
@@ -0,0 +1,33 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova;
+
+public interface ICordovaCookieManager {
+
+ public void setCookiesEnabled(boolean accept);
+
+ public void setCookie(final String url, final String value);
+
+ public String getCookie(final String url);
+
+ public void clearCookies();
+
+ public void flush();
+};
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaHttpAuthHandler.java b/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaHttpAuthHandler.java
new file mode 100644
index 0000000..c89e5b9
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/ICordovaHttpAuthHandler.java
@@ -0,0 +1,38 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+/**
+ * Specifies interface for HTTP auth handler object which is used to handle auth requests and
+ * specifying user credentials.
+ */
+ public interface ICordovaHttpAuthHandler {
+ /**
+ * Instructs the WebView to cancel the authentication request.
+ */
+ public void cancel ();
+
+ /**
+ * Instructs the WebView to proceed with the authentication with the given credentials.
+ *
+ * @param username The user name
+ * @param password The password
+ */
+ public void proceed (String username, String password);
+}
\ No newline at end of file
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/LOG.java b/node_modules/cordova-android/framework/src/org/apache/cordova/LOG.java
new file mode 100644
index 0000000..9fe7a7d
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/LOG.java
@@ -0,0 +1,244 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import android.util.Log;
+
+/**
+ * Log to Android logging system.
+ *
+ * Log message can be a string or a printf formatted string with arguments.
+ * See http://developer.android.com/reference/java/util/Formatter.html
+ */
+public class LOG {
+
+ public static final int VERBOSE = Log.VERBOSE;
+ public static final int DEBUG = Log.DEBUG;
+ public static final int INFO = Log.INFO;
+ public static final int WARN = Log.WARN;
+ public static final int ERROR = Log.ERROR;
+
+ // Current log level
+ public static int LOGLEVEL = Log.ERROR;
+
+ /**
+ * Set the current log level.
+ *
+ * @param logLevel
+ */
+ public static void setLogLevel(int logLevel) {
+ LOGLEVEL = logLevel;
+ Log.i("CordovaLog", "Changing log level to " + logLevel);
+ }
+
+ /**
+ * Set the current log level.
+ *
+ * @param logLevel
+ */
+ public static void setLogLevel(String logLevel) {
+ if ("VERBOSE".equals(logLevel)) LOGLEVEL = VERBOSE;
+ else if ("DEBUG".equals(logLevel)) LOGLEVEL = DEBUG;
+ else if ("INFO".equals(logLevel)) LOGLEVEL = INFO;
+ else if ("WARN".equals(logLevel)) LOGLEVEL = WARN;
+ else if ("ERROR".equals(logLevel)) LOGLEVEL = ERROR;
+ Log.i("CordovaLog", "Changing log level to " + logLevel + "(" + LOGLEVEL + ")");
+ }
+
+ /**
+ * Determine if log level will be logged
+ *
+ * @param logLevel
+ * @return true if the parameter passed in is greater than or equal to the current log level
+ */
+ public static boolean isLoggable(int logLevel) {
+ return (logLevel >= LOGLEVEL);
+ }
+
+ /**
+ * Verbose log message.
+ *
+ * @param tag
+ * @param s
+ */
+ public static void v(String tag, String s) {
+ if (LOG.VERBOSE >= LOGLEVEL) Log.v(tag, s);
+ }
+
+ /**
+ * Debug log message.
+ *
+ * @param tag
+ * @param s
+ */
+ public static void d(String tag, String s) {
+ if (LOG.DEBUG >= LOGLEVEL) Log.d(tag, s);
+ }
+
+ /**
+ * Info log message.
+ *
+ * @param tag
+ * @param s
+ */
+ public static void i(String tag, String s) {
+ if (LOG.INFO >= LOGLEVEL) Log.i(tag, s);
+ }
+
+ /**
+ * Warning log message.
+ *
+ * @param tag
+ * @param s
+ */
+ public static void w(String tag, String s) {
+ if (LOG.WARN >= LOGLEVEL) Log.w(tag, s);
+ }
+
+ /**
+ * Error log message.
+ *
+ * @param tag
+ * @param s
+ */
+ public static void e(String tag, String s) {
+ if (LOG.ERROR >= LOGLEVEL) Log.e(tag, s);
+ }
+
+ /**
+ * Verbose log message.
+ *
+ * @param tag
+ * @param s
+ * @param e
+ */
+ public static void v(String tag, String s, Throwable e) {
+ if (LOG.VERBOSE >= LOGLEVEL) Log.v(tag, s, e);
+ }
+
+ /**
+ * Debug log message.
+ *
+ * @param tag
+ * @param s
+ * @param e
+ */
+ public static void d(String tag, String s, Throwable e) {
+ if (LOG.DEBUG >= LOGLEVEL) Log.d(tag, s, e);
+ }
+
+ /**
+ * Info log message.
+ *
+ * @param tag
+ * @param s
+ * @param e
+ */
+ public static void i(String tag, String s, Throwable e) {
+ if (LOG.INFO >= LOGLEVEL) Log.i(tag, s, e);
+ }
+
+ /**
+ * Warning log message.
+ *
+ * @param tag
+ * @param e
+ */
+ public static void w(String tag, Throwable e) {
+ if (LOG.WARN >= LOGLEVEL) Log.w(tag, e);
+ }
+
+ /**
+ * Warning log message.
+ *
+ * @param tag
+ * @param s
+ * @param e
+ */
+ public static void w(String tag, String s, Throwable e) {
+ if (LOG.WARN >= LOGLEVEL) Log.w(tag, s, e);
+ }
+
+ /**
+ * Error log message.
+ *
+ * @param tag
+ * @param s
+ * @param e
+ */
+ public static void e(String tag, String s, Throwable e) {
+ if (LOG.ERROR >= LOGLEVEL) Log.e(tag, s, e);
+ }
+
+ /**
+ * Verbose log message with printf formatting.
+ *
+ * @param tag
+ * @param s
+ * @param args
+ */
+ public static void v(String tag, String s, Object... args) {
+ if (LOG.VERBOSE >= LOGLEVEL) Log.v(tag, String.format(s, args));
+ }
+
+ /**
+ * Debug log message with printf formatting.
+ *
+ * @param tag
+ * @param s
+ * @param args
+ */
+ public static void d(String tag, String s, Object... args) {
+ if (LOG.DEBUG >= LOGLEVEL) Log.d(tag, String.format(s, args));
+ }
+
+ /**
+ * Info log message with printf formatting.
+ *
+ * @param tag
+ * @param s
+ * @param args
+ */
+ public static void i(String tag, String s, Object... args) {
+ if (LOG.INFO >= LOGLEVEL) Log.i(tag, String.format(s, args));
+ }
+
+ /**
+ * Warning log message with printf formatting.
+ *
+ * @param tag
+ * @param s
+ * @param args
+ */
+ public static void w(String tag, String s, Object... args) {
+ if (LOG.WARN >= LOGLEVEL) Log.w(tag, String.format(s, args));
+ }
+
+ /**
+ * Error log message with printf formatting.
+ *
+ * @param tag
+ * @param s
+ * @param args
+ */
+ public static void e(String tag, String s, Object... args) {
+ if (LOG.ERROR >= LOGLEVEL) Log.e(tag, String.format(s, args));
+ }
+
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/NativeToJsMessageQueue.java b/node_modules/cordova-android/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
new file mode 100644
index 0000000..311ba44
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
@@ -0,0 +1,552 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+
+/**
+ * Holds the list of messages to be sent to the WebView.
+ */
+public class NativeToJsMessageQueue {
+ private static final String LOG_TAG = "JsMessageQueue";
+
+ // Set this to true to force plugin results to be encoding as
+ // JS instead of the custom format (useful for benchmarking).
+ // Doesn't work for multipart messages.
+ private static final boolean FORCE_ENCODE_USING_EVAL = false;
+
+ // Disable sending back native->JS messages during an exec() when the active
+ // exec() is asynchronous. Set this to true when running bridge benchmarks.
+ static final boolean DISABLE_EXEC_CHAINING = false;
+
+ // A hopefully reasonable upper limit of how much combined payload data
+ // to send to the JavaScript in one shot.
+ // This currently only chops up on message boundaries.
+ // It may be useful to split and reassemble response messages someday.
+ private static int COMBINED_RESPONSE_CUTOFF = 16 * 1024 * 1024;
+
+ /**
+ * When true, the active listener is not fired upon enqueue. When set to false,
+ * the active listener will be fired if the queue is non-empty.
+ */
+ private boolean paused;
+
+ /**
+ * The list of JavaScript statements to be sent to JavaScript.
+ */
+ private final LinkedList queue = new LinkedList();
+
+ /**
+ * The array of listeners that can be used to send messages to JS.
+ */
+ private ArrayList bridgeModes = new ArrayList();
+
+ /**
+ * When null, the bridge is disabled. This occurs during page transitions.
+ * When disabled, all callbacks are dropped since they are assumed to be
+ * relevant to the previous page.
+ */
+ private BridgeMode activeBridgeMode;
+
+ public void addBridgeMode(BridgeMode bridgeMode) {
+ bridgeModes.add(bridgeMode);
+ }
+
+ public boolean isBridgeEnabled() {
+ return activeBridgeMode != null;
+ }
+
+ public boolean isEmpty() {
+ return queue.isEmpty();
+ }
+
+ /**
+ * Changes the bridge mode.
+ */
+ public void setBridgeMode(int value) {
+ if (value < -1 || value >= bridgeModes.size()) {
+ LOG.d(LOG_TAG, "Invalid NativeToJsBridgeMode: " + value);
+ } else {
+ BridgeMode newMode = value < 0 ? null : bridgeModes.get(value);
+ if (newMode != activeBridgeMode) {
+ LOG.d(LOG_TAG, "Set native->JS mode to " + (newMode == null ? "null" : newMode.getClass().getSimpleName()));
+ synchronized (this) {
+ activeBridgeMode = newMode;
+ if (newMode != null) {
+ newMode.reset();
+ if (!paused && !queue.isEmpty()) {
+ newMode.onNativeToJsMessageAvailable(this);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Clears all messages and resets to the default bridge mode.
+ */
+ public void reset() {
+ synchronized (this) {
+ queue.clear();
+ setBridgeMode(-1);
+ }
+ }
+
+ private int calculatePackedMessageLength(JsMessage message) {
+ int messageLen = message.calculateEncodedLength();
+ String messageLenStr = String.valueOf(messageLen);
+ return messageLenStr.length() + messageLen + 1;
+ }
+
+ private void packMessage(JsMessage message, StringBuilder sb) {
+ int len = message.calculateEncodedLength();
+ sb.append(len)
+ .append(' ');
+ message.encodeAsMessage(sb);
+ }
+
+ /**
+ * Combines and returns queued messages combined into a single string.
+ *
+ * Combines as many messages as possible, without exceeding
+ * COMBINED_RESPONSE_CUTOFF in case of multiple response messages.
+ *
+ * Returns null if the queue is empty.
+ */
+ public String popAndEncode(boolean fromOnlineEvent) {
+ synchronized (this) {
+ if (activeBridgeMode == null) {
+ return null;
+ }
+ activeBridgeMode.notifyOfFlush(this, fromOnlineEvent);
+ if (queue.isEmpty()) {
+ return null;
+ }
+ int totalPayloadLen = 0;
+ int numMessagesToSend = 0;
+ for (JsMessage message : queue) {
+ int messageSize = calculatePackedMessageLength(message);
+ if (numMessagesToSend > 0 &&
+ COMBINED_RESPONSE_CUTOFF > 0 &&
+ totalPayloadLen + messageSize > COMBINED_RESPONSE_CUTOFF
+ ) {
+ break;
+ }
+ totalPayloadLen += messageSize;
+ numMessagesToSend += 1;
+ }
+
+ StringBuilder sb = new StringBuilder(totalPayloadLen);
+ for (int i = 0; i < numMessagesToSend; ++i) {
+ JsMessage message = queue.removeFirst();
+ packMessage(message, sb);
+ }
+
+ if (!queue.isEmpty()) {
+ // Attach a char to indicate that there are more messages pending.
+ sb.append('*');
+ }
+ String ret = sb.toString();
+ return ret;
+ }
+ }
+
+ /**
+ * Same as popAndEncode(), except encodes in a form that can be executed as JS.
+ */
+ public String popAndEncodeAsJs() {
+ synchronized (this) {
+ int length = queue.size();
+ if (length == 0) {
+ return null;
+ }
+ int totalPayloadLen = 0;
+ int numMessagesToSend = 0;
+ for (JsMessage message : queue) {
+ int messageSize = message.calculateEncodedLength() + 50; // overestimate.
+ if (numMessagesToSend > 0 &&
+ COMBINED_RESPONSE_CUTOFF > 0 &&
+ totalPayloadLen + messageSize > COMBINED_RESPONSE_CUTOFF
+ ) {
+ break;
+ }
+ totalPayloadLen += messageSize;
+ numMessagesToSend += 1;
+ }
+ boolean willSendAllMessages = numMessagesToSend == queue.size();
+ StringBuilder sb = new StringBuilder(totalPayloadLen + (willSendAllMessages ? 0 : 100));
+ // Wrap each statement in a try/finally so that if one throws it does
+ // not affect the next.
+ for (int i = 0; i < numMessagesToSend; ++i) {
+ JsMessage message = queue.removeFirst();
+ if (willSendAllMessages && (i + 1 == numMessagesToSend)) {
+ message.encodeAsJsMessage(sb);
+ } else {
+ sb.append("try{");
+ message.encodeAsJsMessage(sb);
+ sb.append("}finally{");
+ }
+ }
+ if (!willSendAllMessages) {
+ sb.append("window.setTimeout(function(){cordova.require('cordova/plugin/android/polling').pollOnce();},0);");
+ }
+ for (int i = willSendAllMessages ? 1 : 0; i < numMessagesToSend; ++i) {
+ sb.append('}');
+ }
+ String ret = sb.toString();
+ return ret;
+ }
+ }
+
+ /**
+ * Add a JavaScript statement to the list.
+ */
+ public void addJavaScript(String statement) {
+ enqueueMessage(new JsMessage(statement));
+ }
+
+ /**
+ * Add a JavaScript statement to the list.
+ */
+ public void addPluginResult(PluginResult result, String callbackId) {
+ if (callbackId == null) {
+ LOG.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
+ return;
+ }
+ // Don't send anything if there is no result and there is no need to
+ // clear the callbacks.
+ boolean noResult = result.getStatus() == PluginResult.Status.NO_RESULT.ordinal();
+ boolean keepCallback = result.getKeepCallback();
+ if (noResult && keepCallback) {
+ return;
+ }
+ JsMessage message = new JsMessage(result, callbackId);
+ if (FORCE_ENCODE_USING_EVAL) {
+ StringBuilder sb = new StringBuilder(message.calculateEncodedLength() + 50);
+ message.encodeAsJsMessage(sb);
+ message = new JsMessage(sb.toString());
+ }
+
+ enqueueMessage(message);
+ }
+
+ private void enqueueMessage(JsMessage message) {
+ synchronized (this) {
+ if (activeBridgeMode == null) {
+ LOG.d(LOG_TAG, "Dropping Native->JS message due to disabled bridge");
+ return;
+ }
+ queue.add(message);
+ if (!paused) {
+ activeBridgeMode.onNativeToJsMessageAvailable(this);
+ }
+ }
+ }
+
+ public void setPaused(boolean value) {
+ if (paused && value) {
+ // This should never happen. If a use-case for it comes up, we should
+ // change pause to be a counter.
+ LOG.e(LOG_TAG, "nested call to setPaused detected.", new Throwable());
+ }
+ paused = value;
+ if (!value) {
+ synchronized (this) {
+ if (!queue.isEmpty() && activeBridgeMode != null) {
+ activeBridgeMode.onNativeToJsMessageAvailable(this);
+ }
+ }
+ }
+ }
+
+ public static abstract class BridgeMode {
+ public abstract void onNativeToJsMessageAvailable(NativeToJsMessageQueue queue);
+ public void notifyOfFlush(NativeToJsMessageQueue queue, boolean fromOnlineEvent) {}
+ public void reset() {}
+ }
+
+ /** Uses JS polls for messages on a timer.. */
+ public static class NoOpBridgeMode extends BridgeMode {
+ @Override public void onNativeToJsMessageAvailable(NativeToJsMessageQueue queue) {
+ }
+ }
+
+ /** Uses webView.loadUrl("javascript:") to execute messages. */
+ public static class LoadUrlBridgeMode extends BridgeMode {
+ private final CordovaWebViewEngine engine;
+ private final CordovaInterface cordova;
+
+ public LoadUrlBridgeMode(CordovaWebViewEngine engine, CordovaInterface cordova) {
+ this.engine = engine;
+ this.cordova = cordova;
+ }
+
+ @Override
+ public void onNativeToJsMessageAvailable(final NativeToJsMessageQueue queue) {
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ String js = queue.popAndEncodeAsJs();
+ if (js != null) {
+ engine.loadUrl("javascript:" + js, false);
+ }
+ }
+ });
+ }
+ }
+
+ /** Uses online/offline events to tell the JS when to poll for messages. */
+ public static class OnlineEventsBridgeMode extends BridgeMode {
+ private final OnlineEventsBridgeModeDelegate delegate;
+ private boolean online;
+ private boolean ignoreNextFlush;
+
+ public interface OnlineEventsBridgeModeDelegate {
+ void setNetworkAvailable(boolean value);
+ void runOnUiThread(Runnable r);
+ }
+
+ public OnlineEventsBridgeMode(OnlineEventsBridgeModeDelegate delegate) {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void reset() {
+ delegate.runOnUiThread(new Runnable() {
+ public void run() {
+ online = false;
+ // If the following call triggers a notifyOfFlush, then ignore it.
+ ignoreNextFlush = true;
+ delegate.setNetworkAvailable(true);
+ }
+ });
+ }
+
+ @Override
+ public void onNativeToJsMessageAvailable(final NativeToJsMessageQueue queue) {
+ delegate.runOnUiThread(new Runnable() {
+ public void run() {
+ if (!queue.isEmpty()) {
+ ignoreNextFlush = false;
+ delegate.setNetworkAvailable(online);
+ }
+ }
+ });
+ }
+ // Track when online/offline events are fired so that we don't fire excess events.
+ @Override
+ public void notifyOfFlush(final NativeToJsMessageQueue queue, boolean fromOnlineEvent) {
+ if (fromOnlineEvent && !ignoreNextFlush) {
+ online = !online;
+ }
+ }
+ }
+
+ /** Uses webView.evaluateJavascript to execute messages. */
+ public static class EvalBridgeMode extends BridgeMode {
+ private final CordovaWebViewEngine engine;
+ private final CordovaInterface cordova;
+
+ public EvalBridgeMode(CordovaWebViewEngine engine, CordovaInterface cordova) {
+ this.engine = engine;
+ this.cordova = cordova;
+ }
+
+ @Override
+ public void onNativeToJsMessageAvailable(final NativeToJsMessageQueue queue) {
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ String js = queue.popAndEncodeAsJs();
+ if (js != null) {
+ engine.evaluateJavascript(js, null);
+ }
+ }
+ });
+ }
+ }
+
+
+
+ private static class JsMessage {
+ final String jsPayloadOrCallbackId;
+ final PluginResult pluginResult;
+ JsMessage(String js) {
+ if (js == null) {
+ throw new NullPointerException();
+ }
+ jsPayloadOrCallbackId = js;
+ pluginResult = null;
+ }
+ JsMessage(PluginResult pluginResult, String callbackId) {
+ if (callbackId == null || pluginResult == null) {
+ throw new NullPointerException();
+ }
+ jsPayloadOrCallbackId = callbackId;
+ this.pluginResult = pluginResult;
+ }
+
+ static int calculateEncodedLengthHelper(PluginResult pluginResult) {
+ switch (pluginResult.getMessageType()) {
+ case PluginResult.MESSAGE_TYPE_BOOLEAN: // f or t
+ case PluginResult.MESSAGE_TYPE_NULL: // N
+ return 1;
+ case PluginResult.MESSAGE_TYPE_NUMBER: // n
+ return 1 + pluginResult.getMessage().length();
+ case PluginResult.MESSAGE_TYPE_STRING: // s
+ return 1 + pluginResult.getStrMessage().length();
+ case PluginResult.MESSAGE_TYPE_BINARYSTRING:
+ return 1 + pluginResult.getMessage().length();
+ case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
+ return 1 + pluginResult.getMessage().length();
+ case PluginResult.MESSAGE_TYPE_MULTIPART:
+ int ret = 1;
+ for (int i = 0; i < pluginResult.getMultipartMessagesSize(); i++) {
+ int length = calculateEncodedLengthHelper(pluginResult.getMultipartMessage(i));
+ int argLength = String.valueOf(length).length();
+ ret += argLength + 1 + length;
+ }
+ return ret;
+ case PluginResult.MESSAGE_TYPE_JSON:
+ default:
+ return pluginResult.getMessage().length();
+ }
+ }
+
+ int calculateEncodedLength() {
+ if (pluginResult == null) {
+ return jsPayloadOrCallbackId.length() + 1;
+ }
+ int statusLen = String.valueOf(pluginResult.getStatus()).length();
+ int ret = 2 + statusLen + 1 + jsPayloadOrCallbackId.length() + 1;
+ return ret + calculateEncodedLengthHelper(pluginResult);
+ }
+
+ static void encodeAsMessageHelper(StringBuilder sb, PluginResult pluginResult) {
+ switch (pluginResult.getMessageType()) {
+ case PluginResult.MESSAGE_TYPE_BOOLEAN:
+ sb.append(pluginResult.getMessage().charAt(0)); // t or f.
+ break;
+ case PluginResult.MESSAGE_TYPE_NULL: // N
+ sb.append('N');
+ break;
+ case PluginResult.MESSAGE_TYPE_NUMBER: // n
+ sb.append('n')
+ .append(pluginResult.getMessage());
+ break;
+ case PluginResult.MESSAGE_TYPE_STRING: // s
+ sb.append('s');
+ sb.append(pluginResult.getStrMessage());
+ break;
+ case PluginResult.MESSAGE_TYPE_BINARYSTRING: // S
+ sb.append('S');
+ sb.append(pluginResult.getMessage());
+ break;
+ case PluginResult.MESSAGE_TYPE_ARRAYBUFFER: // A
+ sb.append('A');
+ sb.append(pluginResult.getMessage());
+ break;
+ case PluginResult.MESSAGE_TYPE_MULTIPART:
+ sb.append('M');
+ for (int i = 0; i < pluginResult.getMultipartMessagesSize(); i++) {
+ PluginResult multipartMessage = pluginResult.getMultipartMessage(i);
+ sb.append(String.valueOf(calculateEncodedLengthHelper(multipartMessage)));
+ sb.append(' ');
+ encodeAsMessageHelper(sb, multipartMessage);
+ }
+ break;
+ case PluginResult.MESSAGE_TYPE_JSON:
+ default:
+ sb.append(pluginResult.getMessage()); // [ or {
+ }
+ }
+
+ void encodeAsMessage(StringBuilder sb) {
+ if (pluginResult == null) {
+ sb.append('J')
+ .append(jsPayloadOrCallbackId);
+ return;
+ }
+ int status = pluginResult.getStatus();
+ boolean noResult = status == PluginResult.Status.NO_RESULT.ordinal();
+ boolean resultOk = status == PluginResult.Status.OK.ordinal();
+ boolean keepCallback = pluginResult.getKeepCallback();
+
+ sb.append((noResult || resultOk) ? 'S' : 'F')
+ .append(keepCallback ? '1' : '0')
+ .append(status)
+ .append(' ')
+ .append(jsPayloadOrCallbackId)
+ .append(' ');
+
+ encodeAsMessageHelper(sb, pluginResult);
+ }
+
+ void buildJsMessage(StringBuilder sb) {
+ switch (pluginResult.getMessageType()) {
+ case PluginResult.MESSAGE_TYPE_MULTIPART:
+ int size = pluginResult.getMultipartMessagesSize();
+ for (int i=0; i pluginMap = Collections.synchronizedMap(new LinkedHashMap());
+ private final Map entryMap = Collections.synchronizedMap(new LinkedHashMap());
+
+ private final CordovaInterface ctx;
+ private final CordovaWebView app;
+ private boolean isInitialized;
+
+ private CordovaPlugin permissionRequester;
+
+ public PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, Collection pluginEntries) {
+ this.ctx = cordova;
+ this.app = cordovaWebView;
+ setPluginEntries(pluginEntries);
+ }
+
+ public Collection getPluginEntries() {
+ return entryMap.values();
+ }
+
+ public void setPluginEntries(Collection pluginEntries) {
+ if (isInitialized) {
+ this.onPause(false);
+ this.onDestroy();
+ pluginMap.clear();
+ entryMap.clear();
+ }
+ for (PluginEntry entry : pluginEntries) {
+ addService(entry);
+ }
+ if (isInitialized) {
+ startupPlugins();
+ }
+ }
+
+ /**
+ * Init when loading a new HTML page into webview.
+ */
+ public void init() {
+ LOG.d(TAG, "init()");
+ isInitialized = true;
+ this.onPause(false);
+ this.onDestroy();
+ pluginMap.clear();
+ this.startupPlugins();
+ }
+
+ /**
+ * Create plugins objects that have onload set.
+ */
+ private void startupPlugins() {
+ synchronized (entryMap) {
+ for (PluginEntry entry : entryMap.values()) {
+ // Add a null entry to for each non-startup plugin to avoid ConcurrentModificationException
+ // When iterating plugins.
+ if (entry.onload) {
+ getPlugin(entry.service);
+ }
+ else {
+ LOG.d(TAG, "startupPlugins: put - " + entry.service);
+ pluginMap.put(entry.service, null);
+ }
+ }
+ }
+ }
+
+ /**
+ * Receives a request for execution and fulfills it by finding the appropriate
+ * Java class and calling it's execute method.
+ *
+ * PluginManager.exec can be used either synchronously or async. In either case, a JSON encoded
+ * string is returned that will indicate if any errors have occurred when trying to find
+ * or execute the class denoted by the clazz argument.
+ *
+ * @param service String containing the service to run
+ * @param action String containing the action that the class is supposed to perform. This is
+ * passed to the plugin execute method and it is up to the plugin developer
+ * how to deal with it.
+ * @param callbackId String containing the id of the callback that is execute in JavaScript if
+ * this is an async plugin call.
+ * @param rawArgs An Array literal string containing any arguments needed in the
+ * plugin execute method.
+ */
+ public void exec(final String service, final String action, final String callbackId, final String rawArgs) {
+ CordovaPlugin plugin = getPlugin(service);
+ if (plugin == null) {
+ LOG.d(TAG, "exec() call to unknown plugin: " + service);
+ PluginResult cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
+ app.sendPluginResult(cr, callbackId);
+ return;
+ }
+ CallbackContext callbackContext = new CallbackContext(callbackId, app);
+ try {
+ long pluginStartTime = System.currentTimeMillis();
+ boolean wasValidAction = plugin.execute(action, rawArgs, callbackContext);
+ long duration = System.currentTimeMillis() - pluginStartTime;
+
+ if (duration > SLOW_EXEC_WARNING_THRESHOLD) {
+ LOG.w(TAG, "THREAD WARNING: exec() call to " + service + "." + action + " blocked the main thread for " + duration + "ms. Plugin should use CordovaInterface.getThreadPool().");
+ }
+ if (!wasValidAction) {
+ PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION);
+ callbackContext.sendPluginResult(cr);
+ }
+ } catch (JSONException e) {
+ PluginResult cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
+ callbackContext.sendPluginResult(cr);
+ } catch (Exception e) {
+ LOG.e(TAG, "Uncaught exception from plugin", e);
+ callbackContext.error(e.getMessage());
+ }
+ }
+
+ /**
+ * Get the plugin object that implements the service.
+ * If the plugin object does not already exist, then create it.
+ * If the service doesn't exist, then return null.
+ *
+ * @param service The name of the service.
+ * @return CordovaPlugin or null
+ */
+ public CordovaPlugin getPlugin(String service) {
+ CordovaPlugin ret = pluginMap.get(service);
+ if (ret == null) {
+ PluginEntry pe = entryMap.get(service);
+ if (pe == null) {
+ return null;
+ }
+ if (pe.plugin != null) {
+ ret = pe.plugin;
+ } else {
+ ret = instantiatePlugin(pe.pluginClass);
+ }
+ ret.privateInitialize(service, ctx, app, app.getPreferences());
+ LOG.d(TAG, "getPlugin - put: " + service);
+ pluginMap.put(service, ret);
+ }
+ return ret;
+ }
+
+ /**
+ * Add a plugin class that implements a service to the service entry table.
+ * This does not create the plugin object instance.
+ *
+ * @param service The service name
+ * @param className The plugin class name
+ */
+ public void addService(String service, String className) {
+ PluginEntry entry = new PluginEntry(service, className, false);
+ this.addService(entry);
+ }
+
+ /**
+ * Add a plugin class that implements a service to the service entry table.
+ * This does not create the plugin object instance.
+ *
+ * @param entry The plugin entry
+ */
+ public void addService(PluginEntry entry) {
+ this.entryMap.put(entry.service, entry);
+ if (entry.plugin != null) {
+ entry.plugin.privateInitialize(entry.service, ctx, app, app.getPreferences());
+ LOG.d(TAG, "addService: put - " + entry.service);
+ pluginMap.put(entry.service, entry.plugin);
+ }
+ }
+
+ /**
+ * Called when the system is about to start resuming a previous activity.
+ *
+ * @param multitasking Flag indicating if multitasking is turned on for app
+ */
+ public void onPause(boolean multitasking) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onPause(multitasking);
+ }
+ }
+ }
+ }
+
+ /**
+ * Called when the system received an HTTP authentication request. Plugins can use
+ * the supplied HttpAuthHandler to process this auth challenge.
+ *
+ * @param view The WebView that is initiating the callback
+ * @param handler The HttpAuthHandler used to set the WebView's response
+ * @param host The host requiring authentication
+ * @param realm The realm for which authentication is required
+ *
+ * @return Returns True if there is a plugin which will resolve this auth challenge, otherwise False
+ *
+ */
+ public boolean onReceivedHttpAuthRequest(CordovaWebView view, ICordovaHttpAuthHandler handler, String host, String realm) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null && plugin.onReceivedHttpAuthRequest(app, handler, host, realm)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Called when he system received an SSL client certificate request. Plugin can use
+ * the supplied ClientCertRequest to process this certificate challenge.
+ *
+ * @param view The WebView that is initiating the callback
+ * @param request The client certificate request
+ *
+ * @return Returns True if plugin will resolve this auth challenge, otherwise False
+ *
+ */
+ public boolean onReceivedClientCertRequest(CordovaWebView view, ICordovaClientCertRequest request) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null && plugin.onReceivedClientCertRequest(app, request)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Called when the activity will start interacting with the user.
+ *
+ * @param multitasking Flag indicating if multitasking is turned on for app
+ */
+ public void onResume(boolean multitasking) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onResume(multitasking);
+ }
+ }
+ }
+ }
+
+ /**
+ * Called when the activity is becoming visible to the user.
+ */
+ public void onStart() {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onStart();
+ }
+ }
+ }
+ }
+
+ /**
+ * Called when the activity is no longer visible to the user.
+ */
+ public void onStop() {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onStop();
+ }
+ }
+ }
+ }
+
+ /**
+ * The final call you receive before your activity is destroyed.
+ */
+ public void onDestroy() {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onDestroy();
+ }
+ }
+ }
+ }
+
+ /**
+ * Send a message to all plugins.
+ *
+ * @param id The message id
+ * @param data The message data
+ * @return Object to stop propagation or null
+ */
+ public Object postMessage(String id, Object data) {
+ LOG.d(TAG, "postMessage: " + id);
+ synchronized (this.pluginMap) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ this.pluginMap.forEach((s, plugin) -> {
+ if (plugin != null) {
+ plugin.onMessage(id, data);
+ }
+ });
+ } else {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ Object obj = plugin.onMessage(id, data);
+ if (obj != null) {
+ return obj;
+ }
+ }
+ }
+ }
+ }
+ return ctx.onMessage(id, data);
+ }
+
+ /**
+ * Called when the activity receives a new intent.
+ */
+ public void onNewIntent(Intent intent) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onNewIntent(intent);
+ }
+ }
+ }
+ }
+
+ /**
+ * @todo should we move this somewhere public and accessible by all plugins?
+ * For now, it is placed where it is used and kept private so we can decide later and move without causing a breaking change.
+ * An ideal location might be in the "ConfigXmlParser" at the time it generates the "launchUrl".
+ *
+ * @todo should we be restrictive on the "file://" return? e.g. "file:///android_asset/www/"
+ * Would be considered as a breaking change if we apply a more granular check.
+ */
+ private String getLaunchUrlPrefix() {
+ if (!app.getPreferences().getBoolean("AndroidInsecureFileModeEnabled", false)) {
+ String scheme = app.getPreferences().getString("scheme", SCHEME_HTTPS).toLowerCase();
+ String hostname = app.getPreferences().getString("hostname", DEFAULT_HOSTNAME);
+ return scheme + "://" + hostname + '/';
+ }
+
+ return "file://";
+ }
+
+ /**
+ * Called when the webview is going to request an external resource.
+ *
+ * This delegates to the installed plugins, and returns true/false for the
+ * first plugin to provide a non-null result. If no plugins respond, then
+ * the default policy is applied.
+ *
+ * @param url The URL that is being requested.
+ * @return Returns true to allow the resource to load,
+ * false to block the resource.
+ */
+ public boolean shouldAllowRequest(String url) {
+ synchronized (this.entryMap) {
+ for (PluginEntry entry : this.entryMap.values()) {
+ CordovaPlugin plugin = pluginMap.get(entry.service);
+ if (plugin != null) {
+ Boolean result = plugin.shouldAllowRequest(url);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ }
+
+ // Default policy:
+ if (url.startsWith("blob:") || url.startsWith("data:") || url.startsWith("about:blank")) {
+ return true;
+ }
+ // TalkBack requires this, so allow it by default.
+ if (url.startsWith("https://ssl.gstatic.com/accessibility/javascript/android/")) {
+ return true;
+ }
+ if (url.startsWith("file://")) {
+ //This directory on WebKit/Blink based webviews contains SQLite databases!
+ //DON'T CHANGE THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
+ return !url.contains("/app_webview/");
+ }
+ return false;
+ }
+
+ /**
+ * Called when the webview is going to change the URL of the loaded content.
+ *
+ * This delegates to the installed plugins, and returns true/false for the
+ * first plugin to provide a non-null result. If no plugins respond, then
+ * the default policy is applied.
+ *
+ * @param url The URL that is being requested.
+ * @return Returns true to allow the navigation,
+ * false to block the navigation.
+ */
+ public boolean shouldAllowNavigation(String url) {
+ synchronized (this.entryMap) {
+ for (PluginEntry entry : this.entryMap.values()) {
+ CordovaPlugin plugin = pluginMap.get(entry.service);
+ if (plugin != null) {
+ Boolean result = plugin.shouldAllowNavigation(url);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ }
+
+ // Default policy:
+ return url.startsWith(getLaunchUrlPrefix()) || url.startsWith("about:blank");
+ }
+
+
+ /**
+ * Called when the webview is requesting the exec() bridge be enabled.
+ */
+ public boolean shouldAllowBridgeAccess(String url) {
+ synchronized (this.entryMap) {
+ for (PluginEntry entry : this.entryMap.values()) {
+ CordovaPlugin plugin = pluginMap.get(entry.service);
+ if (plugin != null) {
+ Boolean result = plugin.shouldAllowBridgeAccess(url);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ }
+
+ // Default policy:
+ return url.startsWith(getLaunchUrlPrefix());
+ }
+
+ /**
+ * Called when the webview is going not going to navigate, but may launch
+ * an Intent for an URL.
+ *
+ * This delegates to the installed plugins, and returns true/false for the
+ * first plugin to provide a non-null result. If no plugins respond, then
+ * the default policy is applied.
+ *
+ * @param url The URL that is being requested.
+ * @return Returns true to allow the URL to launch an intent,
+ * false to block the intent.
+ */
+ public Boolean shouldOpenExternalUrl(String url) {
+ synchronized (this.entryMap) {
+ for (PluginEntry entry : this.entryMap.values()) {
+ CordovaPlugin plugin = pluginMap.get(entry.service);
+ if (plugin != null) {
+ Boolean result = plugin.shouldOpenExternalUrl(url);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ }
+ // Default policy:
+ // External URLs are not allowed
+ return false;
+ }
+
+ /**
+ * Called when the URL of the webview changes.
+ *
+ * @param url The URL that is being changed to.
+ * @return Return false to allow the URL to load, return true to prevent the URL from loading.
+ */
+ public boolean onOverrideUrlLoading(String url) {
+ synchronized (this.entryMap) {
+ for (PluginEntry entry : this.entryMap.values()) {
+ CordovaPlugin plugin = pluginMap.get(entry.service);
+ if (plugin != null && plugin.onOverrideUrlLoading(url)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Called when the app navigates or refreshes.
+ */
+ public void onReset() {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onReset();
+ }
+ }
+ }
+ }
+
+ Uri remapUri(Uri uri) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ Uri ret = plugin.remapUri(uri);
+ if (ret != null) {
+ return ret;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a plugin based on class name.
+ */
+ private CordovaPlugin instantiatePlugin(String className) {
+ CordovaPlugin ret = null;
+ try {
+ Class> c = null;
+ if ((className != null) && !("".equals(className))) {
+ c = Class.forName(className);
+ }
+ if (c != null & CordovaPlugin.class.isAssignableFrom(c)) {
+ ret = (CordovaPlugin) c.newInstance();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("Error adding plugin " + className + ".");
+ }
+ return ret;
+ }
+
+ /**
+ * Called by the system when the device configuration changes while your activity is running.
+ *
+ * @param newConfig The new device configuration
+ */
+ public void onConfigurationChanged(Configuration newConfig) {
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ plugin.onConfigurationChanged(newConfig);
+ }
+ }
+ }
+ }
+
+ public Bundle onSaveInstanceState() {
+ Bundle state = new Bundle();
+ synchronized (this.pluginMap) {
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null) {
+ Bundle pluginState = plugin.onSaveInstanceState();
+ if (pluginState != null) {
+ state.putBundle(plugin.getServiceName(), pluginState);
+ }
+ }
+ }
+ }
+ return state;
+ }
+
+ /**
+ * Collect all plugins PathHandlers
+ *
+ * @return list of PathHandlers in no particular order
+ */
+ public ArrayList getPluginPathHandlers() {
+ ArrayList handlers = new ArrayList();
+ for (CordovaPlugin plugin : this.pluginMap.values()) {
+ if (plugin != null && plugin.getPathHandler() != null) {
+ handlers.add(plugin.getPathHandler());
+ }
+ }
+ return handlers;
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/PluginResult.java b/node_modules/cordova-android/framework/src/org/apache/cordova/PluginResult.java
new file mode 100644
index 0000000..5db60b3
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/PluginResult.java
@@ -0,0 +1,198 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+import java.util.List;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import android.util.Base64;
+
+public class PluginResult {
+ private final int status;
+ private final int messageType;
+ private boolean keepCallback = false;
+ private String strMessage;
+ private String encodedMessage;
+ private List multipartMessages;
+
+ public PluginResult(Status status) {
+ this(status, PluginResult.StatusMessages[status.ordinal()]);
+ }
+
+ public PluginResult(Status status, String message) {
+ this.status = status.ordinal();
+ this.messageType = message == null ? MESSAGE_TYPE_NULL : MESSAGE_TYPE_STRING;
+ this.strMessage = message;
+ }
+
+ public PluginResult(Status status, JSONArray message) {
+ this.status = status.ordinal();
+ this.messageType = MESSAGE_TYPE_JSON;
+ encodedMessage = message.toString();
+ }
+
+ public PluginResult(Status status, JSONObject message) {
+ this.status = status.ordinal();
+ this.messageType = MESSAGE_TYPE_JSON;
+ encodedMessage = message.toString();
+ }
+
+ public PluginResult(Status status, int i) {
+ this.status = status.ordinal();
+ this.messageType = MESSAGE_TYPE_NUMBER;
+ this.encodedMessage = ""+i;
+ }
+
+ public PluginResult(Status status, float f) {
+ this.status = status.ordinal();
+ this.messageType = MESSAGE_TYPE_NUMBER;
+ this.encodedMessage = ""+f;
+ }
+
+ public PluginResult(Status status, boolean b) {
+ this.status = status.ordinal();
+ this.messageType = MESSAGE_TYPE_BOOLEAN;
+ this.encodedMessage = Boolean.toString(b);
+ }
+
+ public PluginResult(Status status, byte[] data) {
+ this(status, data, false);
+ }
+
+ public PluginResult(Status status, byte[] data, boolean binaryString) {
+ this.status = status.ordinal();
+ this.messageType = binaryString ? MESSAGE_TYPE_BINARYSTRING : MESSAGE_TYPE_ARRAYBUFFER;
+ this.encodedMessage = Base64.encodeToString(data, Base64.NO_WRAP);
+ }
+
+ // The keepCallback and status of multipartMessages are ignored.
+ public PluginResult(Status status, List multipartMessages) {
+ this.status = status.ordinal();
+ this.messageType = MESSAGE_TYPE_MULTIPART;
+ this.multipartMessages = multipartMessages;
+ }
+
+ public void setKeepCallback(boolean b) {
+ this.keepCallback = b;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public int getMessageType() {
+ return messageType;
+ }
+
+ public String getMessage() {
+ if (encodedMessage == null) {
+ encodedMessage = JSONObject.quote(strMessage);
+ }
+ return encodedMessage;
+ }
+
+ public int getMultipartMessagesSize() {
+ return multipartMessages.size();
+ }
+
+ public PluginResult getMultipartMessage(int index) {
+ return multipartMessages.get(index);
+ }
+
+ /**
+ * If messageType == MESSAGE_TYPE_STRING, then returns the message string.
+ * Otherwise, returns null.
+ */
+ public String getStrMessage() {
+ return strMessage;
+ }
+
+ public boolean getKeepCallback() {
+ return this.keepCallback;
+ }
+
+ @Deprecated // Use sendPluginResult instead of sendJavascript.
+ public String getJSONString() {
+ return "{\"status\":" + this.status + ",\"message\":" + this.getMessage() + ",\"keepCallback\":" + this.keepCallback + "}";
+ }
+
+ @Deprecated // Use sendPluginResult instead of sendJavascript.
+ public String toCallbackString(String callbackId) {
+ // If no result to be sent and keeping callback, then no need to sent back to JavaScript
+ if ((status == PluginResult.Status.NO_RESULT.ordinal()) && keepCallback) {
+ return null;
+ }
+
+ // Check the success (OK, NO_RESULT & !KEEP_CALLBACK)
+ if ((status == PluginResult.Status.OK.ordinal()) || (status == PluginResult.Status.NO_RESULT.ordinal())) {
+ return toSuccessCallbackString(callbackId);
+ }
+
+ return toErrorCallbackString(callbackId);
+ }
+
+ @Deprecated // Use sendPluginResult instead of sendJavascript.
+ public String toSuccessCallbackString(String callbackId) {
+ return "cordova.callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
+ }
+
+ @Deprecated // Use sendPluginResult instead of sendJavascript.
+ public String toErrorCallbackString(String callbackId) {
+ return "cordova.callbackError('"+callbackId+"', " + this.getJSONString()+ ");";
+ }
+
+ public static final int MESSAGE_TYPE_STRING = 1;
+ public static final int MESSAGE_TYPE_JSON = 2;
+ public static final int MESSAGE_TYPE_NUMBER = 3;
+ public static final int MESSAGE_TYPE_BOOLEAN = 4;
+ public static final int MESSAGE_TYPE_NULL = 5;
+ public static final int MESSAGE_TYPE_ARRAYBUFFER = 6;
+ // Use BINARYSTRING when your string may contain null characters.
+ // This is required to work around a bug in the platform :(.
+ public static final int MESSAGE_TYPE_BINARYSTRING = 7;
+ public static final int MESSAGE_TYPE_MULTIPART = 8;
+
+ public static String[] StatusMessages = new String[] {
+ "No result",
+ "OK",
+ "Class not found",
+ "Illegal access",
+ "Instantiation error",
+ "Malformed url",
+ "IO error",
+ "Invalid action",
+ "JSON error",
+ "Error"
+ };
+
+ public enum Status {
+ NO_RESULT,
+ OK,
+ CLASS_NOT_FOUND_EXCEPTION,
+ ILLEGAL_ACCESS_EXCEPTION,
+ INSTANTIATION_EXCEPTION,
+ MALFORMED_URL_EXCEPTION,
+ IO_EXCEPTION,
+ INVALID_ACTION,
+ JSON_EXCEPTION,
+ ERROR
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/ResumeCallback.java b/node_modules/cordova-android/framework/src/org/apache/cordova/ResumeCallback.java
new file mode 100644
index 0000000..49a43b5
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/ResumeCallback.java
@@ -0,0 +1,76 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova;
+
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ResumeCallback extends CallbackContext {
+ private final String TAG = "CordovaResumeCallback";
+ private String serviceName;
+ private PluginManager pluginManager;
+
+ public ResumeCallback(String serviceName, PluginManager pluginManager) {
+ super("resumecallback", null);
+ this.serviceName = serviceName;
+ this.pluginManager = pluginManager;
+ }
+
+ @Override
+ public void sendPluginResult(PluginResult pluginResult) {
+ synchronized (this) {
+ if (finished) {
+ LOG.w(TAG, serviceName + " attempted to send a second callback to ResumeCallback\nResult was: " + pluginResult.getMessage());
+ return;
+ } else {
+ finished = true;
+ }
+ }
+
+ JSONObject event = new JSONObject();
+ JSONObject pluginResultObject = new JSONObject();
+
+ try {
+ pluginResultObject.put("pluginServiceName", this.serviceName);
+ pluginResultObject.put("pluginStatus", PluginResult.StatusMessages[pluginResult.getStatus()]);
+
+ event.put("action", "resume");
+ event.put("pendingResult", pluginResultObject);
+ } catch (JSONException e) {
+ LOG.e(TAG, "Unable to create resume object for Activity Result");
+ }
+
+ PluginResult eventResult = new PluginResult(PluginResult.Status.OK, event);
+
+ // We send a list of results to the js so that we don't have to decode
+ // the PluginResult passed to this CallbackContext into JSON twice.
+ // The results are combined into an event payload before the event is
+ // fired on the js side of things (see platform.js)
+ List result = new ArrayList();
+ result.add(eventResult);
+ result.add(pluginResult);
+
+ CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
+ appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result));
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/allowlist/index.html b/node_modules/cordova-android/framework/src/org/apache/cordova/allowlist/index.html
new file mode 100644
index 0000000..24cac6e
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/allowlist/index.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ Cordova Tests
+
+
+
+
+
+ Allow List Page 1
+
+
Cordova:
+ Deviceready:
+
+
+ Loading Page 2 should be successful.
+ Loading Page 3 should be in web browser.
+ Loading Page 2 with target=_blank should be in web browser?
+ (THIS DOESN'T HAPPEN.) https://issues.apache.org/jira/browse/CB-362
+
+ Page 2
+ Page 3
+ Page 2 with target=_blank
+
+
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/allowlist/index2.html b/node_modules/cordova-android/framework/src/org/apache/cordova/allowlist/index2.html
new file mode 100644
index 0000000..bb475a8
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/allowlist/index2.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ Cordova Tests
+
+
+
+
+
+ Allow List Page 2
+
+
Cordova:
+ Deviceready:
+
+
+ Press "backbutton"
+
+
+
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemCookieManager.java b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemCookieManager.java
new file mode 100644
index 0000000..f8128bc
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemCookieManager.java
@@ -0,0 +1,62 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova.engine;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.webkit.CookieManager;
+import android.webkit.WebView;
+
+import org.apache.cordova.ICordovaCookieManager;
+
+class SystemCookieManager implements ICordovaCookieManager {
+
+ protected final WebView webView;
+ private final CookieManager cookieManager;
+
+ public SystemCookieManager(WebView webview) {
+ webView = webview;
+ cookieManager = CookieManager.getInstance();
+
+ cookieManager.setAcceptFileSchemeCookies(true);
+ cookieManager.setAcceptThirdPartyCookies(webView, true);
+ }
+
+ public void setCookiesEnabled(boolean accept) {
+ cookieManager.setAcceptCookie(accept);
+ }
+
+ public void setCookie(final String url, final String value) {
+ cookieManager.setCookie(url, value);
+ }
+
+ public String getCookie(final String url) {
+ return cookieManager.getCookie(url);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void clearCookies() {
+ cookieManager.removeAllCookies(null);
+ }
+
+ public void flush() {
+ cookieManager.flush();
+ }
+};
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemExposedJsApi.java b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemExposedJsApi.java
new file mode 100644
index 0000000..94c3d93
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemExposedJsApi.java
@@ -0,0 +1,53 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.engine;
+
+import android.webkit.JavascriptInterface;
+
+import org.apache.cordova.CordovaBridge;
+import org.apache.cordova.ExposedJsApi;
+import org.json.JSONException;
+
+/**
+ * Contains APIs that the JS can call. All functions in here should also have
+ * an equivalent entry in CordovaChromeClient.java, and be added to
+ * cordova-js/lib/android/plugin/android/promptbasednativeapi.js
+ */
+class SystemExposedJsApi implements ExposedJsApi {
+ private final CordovaBridge bridge;
+
+ SystemExposedJsApi(CordovaBridge bridge) {
+ this.bridge = bridge;
+ }
+
+ @JavascriptInterface
+ public String exec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException {
+ return bridge.jsExec(bridgeSecret, service, action, callbackId, arguments);
+ }
+
+ @JavascriptInterface
+ public void setNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException {
+ bridge.jsSetNativeToJsBridgeMode(bridgeSecret, value);
+ }
+
+ @JavascriptInterface
+ public String retrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException {
+ return bridge.jsRetrieveJsMessages(bridgeSecret, fromOnlineEvent);
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
new file mode 100644
index 0000000..cad098e
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -0,0 +1,270 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.engine;
+
+import java.util.Arrays;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Context;
+import android.content.ActivityNotFoundException;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.webkit.ConsoleMessage;
+import android.webkit.GeolocationPermissions.Callback;
+import android.webkit.JsPromptResult;
+import android.webkit.JsResult;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
+import android.webkit.WebStorage;
+import android.webkit.WebView;
+import android.webkit.PermissionRequest;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.RelativeLayout;
+
+import org.apache.cordova.CordovaDialogsHelper;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.LOG;
+
+/**
+ * This class is the WebChromeClient that implements callbacks for our web view.
+ * The kind of callbacks that happen here are on the chrome outside the document,
+ * such as onCreateWindow(), onConsoleMessage(), onProgressChanged(), etc. Related
+ * to but different than CordovaWebViewClient.
+ */
+public class SystemWebChromeClient extends WebChromeClient {
+
+ private static final int FILECHOOSER_RESULTCODE = 5173;
+ private static final String LOG_TAG = "SystemWebChromeClient";
+ private long MAX_QUOTA = 100 * 1024 * 1024;
+ protected final SystemWebViewEngine parentEngine;
+
+ // the video progress view
+ private View mVideoProgressView;
+
+ private CordovaDialogsHelper dialogsHelper;
+ private Context appContext;
+
+ private WebChromeClient.CustomViewCallback mCustomViewCallback;
+ private View mCustomView;
+
+ public SystemWebChromeClient(SystemWebViewEngine parentEngine) {
+ this.parentEngine = parentEngine;
+ appContext = parentEngine.webView.getContext();
+ dialogsHelper = new CordovaDialogsHelper(appContext);
+ }
+
+ /**
+ * Tell the client to display a javascript alert dialog.
+ */
+ @Override
+ public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
+ dialogsHelper.showAlert(message, new CordovaDialogsHelper.Result() {
+ @Override public void gotResult(boolean success, String value) {
+ if (success) {
+ result.confirm();
+ } else {
+ result.cancel();
+ }
+ }
+ });
+ return true;
+ }
+
+ /**
+ * Tell the client to display a confirm dialog to the user.
+ */
+ @Override
+ public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
+ dialogsHelper.showConfirm(message, new CordovaDialogsHelper.Result() {
+ @Override
+ public void gotResult(boolean success, String value) {
+ if (success) {
+ result.confirm();
+ } else {
+ result.cancel();
+ }
+ }
+ });
+ return true;
+ }
+
+ /**
+ * Tell the client to display a prompt dialog to the user.
+ * If the client returns true, WebView will assume that the client will
+ * handle the prompt dialog and call the appropriate JsPromptResult method.
+ *
+ * Since we are hacking prompts for our own purposes, we should not be using them for
+ * this purpose, perhaps we should hack console.log to do this instead!
+ */
+ @Override
+ public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
+ // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
+ String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
+ if (handledRet != null) {
+ result.confirm(handledRet);
+ } else {
+ dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
+ @Override
+ public void gotResult(boolean success, String value) {
+ if (success) {
+ result.confirm(value);
+ } else {
+ result.cancel();
+ }
+ }
+ });
+ }
+ return true;
+ }
+
+ /**
+ * Handle database quota exceeded notification.
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
+ long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
+ {
+ LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
+ quotaUpdater.updateQuota(MAX_QUOTA);
+ }
+
+ @Override
+ /**
+ * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
+ *
+ * This also checks for the Geolocation Plugin and requests permission from the application to use Geolocation.
+ *
+ * @param origin
+ * @param callback
+ */
+ public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
+ super.onGeolocationPermissionsShowPrompt(origin, callback);
+ callback.invoke(origin, true, false);
+ //Get the plugin, it should be loaded
+ CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
+ if(geolocation != null && !geolocation.hasPermisssion())
+ {
+ geolocation.requestPermissions(0);
+ }
+ }
+
+ // API level 7 is required for this, see if we could lower this using something else
+ @Override
+ @SuppressWarnings("deprecation")
+ public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
+ parentEngine.getCordovaWebView().showCustomView(view, callback);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void onHideCustomView() {
+ parentEngine.getCordovaWebView().hideCustomView();
+ }
+
+ @Override
+ /**
+ * Ask the host application for a custom progress view to show while
+ * a is loading.
+ * @return View The progress view.
+ */
+ public View getVideoLoadingProgressView() {
+ if (mVideoProgressView == null) {
+ // Create a new Loading view programmatically.
+
+ // create the linear layout
+ LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
+ layout.setOrientation(LinearLayout.VERTICAL);
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
+ layout.setLayoutParams(layoutParams);
+ // the proress bar
+ ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
+ LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ barLayoutParams.gravity = Gravity.CENTER;
+ bar.setLayoutParams(barLayoutParams);
+ layout.addView(bar);
+
+ mVideoProgressView = layout;
+ }
+ return mVideoProgressView;
+ }
+
+ @Override
+ public boolean onShowFileChooser(WebView webView, final ValueCallback filePathsCallback, final WebChromeClient.FileChooserParams fileChooserParams) {
+ // Check if multiple-select is specified
+ Boolean selectMultiple = false;
+ if (fileChooserParams.getMode() == WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE) {
+ selectMultiple = true;
+ }
+ Intent intent = fileChooserParams.createIntent();
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, selectMultiple);
+
+ // Uses Intent.EXTRA_MIME_TYPES to pass multiple mime types.
+ String[] acceptTypes = fileChooserParams.getAcceptTypes();
+ if (acceptTypes.length > 1) {
+ intent.setType("*/*"); // Accept all, filter mime types by Intent.EXTRA_MIME_TYPES.
+ intent.putExtra(Intent.EXTRA_MIME_TYPES, acceptTypes);
+ }
+ try {
+ parentEngine.cordova.startActivityForResult(new CordovaPlugin() {
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ Uri[] result = null;
+ if (resultCode == Activity.RESULT_OK && intent != null) {
+ if (intent.getClipData() != null) {
+ // handle multiple-selected files
+ final int numSelectedFiles = intent.getClipData().getItemCount();
+ result = new Uri[numSelectedFiles];
+ for (int i = 0; i < numSelectedFiles; i++) {
+ result[i] = intent.getClipData().getItemAt(i).getUri();
+ LOG.d(LOG_TAG, "Receive file chooser URL: " + result[i]);
+ }
+ }
+ else if (intent.getData() != null) {
+ // handle single-selected file
+ result = WebChromeClient.FileChooserParams.parseResult(resultCode, intent);
+ LOG.d(LOG_TAG, "Receive file chooser URL: " + result);
+ }
+ }
+ filePathsCallback.onReceiveValue(result);
+ }
+ }, intent, FILECHOOSER_RESULTCODE);
+ } catch (ActivityNotFoundException e) {
+ LOG.w("No activity found to handle file chooser intent.", e);
+ filePathsCallback.onReceiveValue(null);
+ }
+ return true;
+ }
+
+ @Override
+ public void onPermissionRequest(final PermissionRequest request) {
+ LOG.d(LOG_TAG, "onPermissionRequest: " + Arrays.toString(request.getResources()));
+ request.grant(request.getResources());
+ }
+
+ public void destroyLastDialog(){
+ dialogsHelper.destroyLastDialog();
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebView.java b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebView.java
new file mode 100644
index 0000000..01c2f00
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebView.java
@@ -0,0 +1,88 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova.engine;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.webkit.WebChromeClient;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaWebViewEngine;
+
+/**
+ * Custom WebView subclass that enables us to capture events needed for Cordova.
+ */
+public class SystemWebView extends WebView implements CordovaWebViewEngine.EngineView {
+ private SystemWebViewClient viewClient;
+ SystemWebChromeClient chromeClient;
+ private SystemWebViewEngine parentEngine;
+ private CordovaInterface cordova;
+
+ public SystemWebView(Context context) {
+ this(context, null);
+ }
+
+ public SystemWebView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ // Package visibility to enforce that only SystemWebViewEngine should call this method.
+ void init(SystemWebViewEngine parentEngine, CordovaInterface cordova) {
+ this.cordova = cordova;
+ this.parentEngine = parentEngine;
+ if (this.viewClient == null) {
+ setWebViewClient(new SystemWebViewClient(parentEngine));
+ }
+
+ if (this.chromeClient == null) {
+ setWebChromeClient(new SystemWebChromeClient(parentEngine));
+ }
+ }
+
+ @Override
+ public CordovaWebView getCordovaWebView() {
+ return parentEngine != null ? parentEngine.getCordovaWebView() : null;
+ }
+
+ @Override
+ public void setWebViewClient(WebViewClient client) {
+ viewClient = (SystemWebViewClient)client;
+ super.setWebViewClient(client);
+ }
+
+ @Override
+ public void setWebChromeClient(WebChromeClient client) {
+ chromeClient = (SystemWebChromeClient)client;
+ super.setWebChromeClient(client);
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ Boolean ret = parentEngine.client.onDispatchKeyEvent(event);
+ if (ret != null) {
+ return ret.booleanValue();
+ }
+ return super.dispatchKeyEvent(event);
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebViewClient.java b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebViewClient.java
new file mode 100644
index 0000000..2fea4fe
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebViewClient.java
@@ -0,0 +1,425 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.engine;
+
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.AssetManager;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.net.http.SslError;
+import android.webkit.ClientCertRequest;
+import android.webkit.HttpAuthHandler;
+import android.webkit.MimeTypeMap;
+import android.webkit.SslErrorHandler;
+import android.webkit.WebResourceRequest;
+import android.webkit.WebResourceResponse;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import org.apache.cordova.AuthenticationToken;
+import org.apache.cordova.CordovaClientCertRequest;
+import org.apache.cordova.CordovaHttpAuthHandler;
+import org.apache.cordova.CordovaPluginPathHandler;
+import org.apache.cordova.CordovaResourceApi;
+import org.apache.cordova.LOG;
+import org.apache.cordova.PluginManager;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Hashtable;
+
+import androidx.webkit.WebViewAssetLoader;
+
+/**
+ * This class is the WebViewClient that implements callbacks for our web view.
+ * The kind of callbacks that happen here are regarding the rendering of the
+ * document instead of the chrome surrounding it, such as onPageStarted(),
+ * shouldOverrideUrlLoading(), etc. Related to but different than
+ * CordovaChromeClient.
+ */
+public class SystemWebViewClient extends WebViewClient {
+
+ private static final String TAG = "SystemWebViewClient";
+ protected final SystemWebViewEngine parentEngine;
+ private final WebViewAssetLoader assetLoader;
+ private boolean doClearHistory = false;
+ boolean isCurrentlyLoading;
+
+ /** The authorization tokens. */
+ private Hashtable authenticationTokens = new Hashtable();
+
+ public SystemWebViewClient(SystemWebViewEngine parentEngine) {
+ this.parentEngine = parentEngine;
+
+ WebViewAssetLoader.Builder assetLoaderBuilder = new WebViewAssetLoader.Builder()
+ .setDomain(parentEngine.preferences.getString("hostname", "localhost"))
+ .setHttpAllowed(true);
+
+ assetLoaderBuilder.addPathHandler("/", path -> {
+ try {
+ // Check if there a plugins with pathHandlers
+ PluginManager pluginManager = this.parentEngine.pluginManager;
+ if (pluginManager != null) {
+ for (CordovaPluginPathHandler handler : pluginManager.getPluginPathHandlers()) {
+ if (handler.getPathHandler() != null) {
+ WebResourceResponse response = handler.getPathHandler().handle(path);
+ if (response != null) {
+ return response;
+ }
+ };
+ }
+ }
+
+ if (path.isEmpty()) {
+ path = "index.html";
+ }
+ InputStream is = parentEngine.webView.getContext().getAssets().open("www/" + path, AssetManager.ACCESS_STREAMING);
+ String mimeType = "text/html";
+ String extension = MimeTypeMap.getFileExtensionFromUrl(path);
+ if (extension != null) {
+ if (path.endsWith(".js") || path.endsWith(".mjs")) {
+ // Make sure JS files get the proper mimetype to support ES modules
+ mimeType = "application/javascript";
+ } else if (path.endsWith(".wasm")) {
+ mimeType = "application/wasm";
+ } else {
+ mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
+ }
+ }
+
+ return new WebResourceResponse(mimeType, null, is);
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOG.e(TAG, e.getMessage());
+ }
+ return null;
+ });
+
+ this.assetLoader = assetLoaderBuilder.build();
+ }
+
+ /**
+ * Give the host application a chance to take over the control when a new url
+ * is about to be loaded in the current WebView.
+ *
+ * @param view The WebView that is initiating the callback.
+ * @param url The url to be loaded.
+ * @return true to override, false for default behavior
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ return parentEngine.client.onNavigationAttempt(url);
+ }
+
+ /**
+ * On received http auth request.
+ * The method reacts on all registered authentication tokens. There is one and only one authentication token for any host + realm combination
+ */
+ @Override
+ public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
+
+ // Get the authentication token (if specified)
+ AuthenticationToken token = this.getAuthenticationToken(host, realm);
+ if (token != null) {
+ handler.proceed(token.getUserName(), token.getPassword());
+ return;
+ }
+
+ // Check if there is some plugin which can resolve this auth challenge
+ PluginManager pluginManager = this.parentEngine.pluginManager;
+ if (pluginManager != null && pluginManager.onReceivedHttpAuthRequest(null, new CordovaHttpAuthHandler(handler), host, realm)) {
+ parentEngine.client.clearLoadTimeoutTimer();
+ return;
+ }
+
+ // By default handle 401 like we'd normally do!
+ super.onReceivedHttpAuthRequest(view, handler, host, realm);
+ }
+
+ /**
+ * On received client cert request.
+ * The method forwards the request to any running plugins before using the default implementation.
+ *
+ * @param view
+ * @param request
+ */
+ @Override
+ public void onReceivedClientCertRequest (WebView view, ClientCertRequest request)
+ {
+
+ // Check if there is some plugin which can resolve this certificate request
+ PluginManager pluginManager = this.parentEngine.pluginManager;
+ if (pluginManager != null && pluginManager.onReceivedClientCertRequest(null, new CordovaClientCertRequest(request))) {
+ parentEngine.client.clearLoadTimeoutTimer();
+ return;
+ }
+
+ // By default pass to WebViewClient
+ super.onReceivedClientCertRequest(view, request);
+ }
+
+ /**
+ * Notify the host application that a page has started loading.
+ * This method is called once for each main frame load so a page with iframes or framesets will call onPageStarted
+ * one time for the main frame. This also means that onPageStarted will not be called when the contents of an
+ * embedded frame changes, i.e. clicking a link whose target is an iframe.
+ *
+ * @param view The webview initiating the callback.
+ * @param url The url of the page.
+ */
+ @Override
+ public void onPageStarted(WebView view, String url, Bitmap favicon) {
+ super.onPageStarted(view, url, favicon);
+ isCurrentlyLoading = true;
+ // Flush stale messages & reset plugins.
+ parentEngine.bridge.reset();
+ parentEngine.client.onPageStarted(url);
+ }
+
+ /**
+ * Notify the host application that a page has finished loading.
+ * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet.
+ *
+ *
+ * @param view The webview initiating the callback.
+ * @param url The url of the page.
+ */
+ @Override
+ public void onPageFinished(WebView view, String url) {
+ super.onPageFinished(view, url);
+ // Ignore excessive calls, if url is not about:blank (CB-8317).
+ if (!isCurrentlyLoading && !url.startsWith("about:")) {
+ return;
+ }
+ isCurrentlyLoading = false;
+
+ /**
+ * Because of a timing issue we need to clear this history in onPageFinished as well as
+ * onPageStarted. However we only want to do this if the doClearHistory boolean is set to
+ * true. You see when you load a url with a # in it which is common in jQuery applications
+ * onPageStared is not called. Clearing the history at that point would break jQuery apps.
+ */
+ if (this.doClearHistory) {
+ view.clearHistory();
+ this.doClearHistory = false;
+ }
+ parentEngine.client.onPageFinishedLoading(url);
+
+ }
+
+ /**
+ * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
+ * The errorCode parameter corresponds to one of the ERROR_* constants.
+ *
+ * @param view The WebView that is initiating the callback.
+ * @param errorCode The error code corresponding to an ERROR_* value.
+ * @param description A String describing the error.
+ * @param failingUrl The url that failed to load.
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
+ // Ignore error due to stopLoading().
+ if (!isCurrentlyLoading) {
+ return;
+ }
+ LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl);
+
+ // If this is a "Protocol Not Supported" error, then revert to the previous
+ // page. If there was no previous page, then punt. The application's config
+ // is likely incorrect (start page set to sms: or something like that)
+ if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) {
+ parentEngine.client.clearLoadTimeoutTimer();
+
+ if (view.canGoBack()) {
+ view.goBack();
+ return;
+ } else {
+ super.onReceivedError(view, errorCode, description, failingUrl);
+ }
+ }
+ parentEngine.client.onReceivedError(errorCode, description, failingUrl);
+ }
+
+ /**
+ * Notify the host application that an SSL error occurred while loading a resource.
+ * The host application must call either handler.cancel() or handler.proceed().
+ * Note that the decision may be retained for use in response to future SSL errors.
+ * The default behavior is to cancel the load.
+ *
+ * @param view The WebView that is initiating the callback.
+ * @param handler An SslErrorHandler object that will handle the user's response.
+ * @param error The SSL error object.
+ */
+ @Override
+ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
+
+ final String packageName = parentEngine.cordova.getActivity().getPackageName();
+ final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();
+
+ ApplicationInfo appInfo;
+ try {
+ appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
+ if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
+ // debug = true
+ handler.proceed();
+ return;
+ } else {
+ // debug = false
+ super.onReceivedSslError(view, handler, error);
+ }
+ } catch (NameNotFoundException e) {
+ // When it doubt, lock it out!
+ super.onReceivedSslError(view, handler, error);
+ }
+ }
+
+
+ /**
+ * Sets the authentication token.
+ *
+ * @param authenticationToken
+ * @param host
+ * @param realm
+ */
+ public void setAuthenticationToken(AuthenticationToken authenticationToken, String host, String realm) {
+ if (host == null) {
+ host = "";
+ }
+ if (realm == null) {
+ realm = "";
+ }
+ this.authenticationTokens.put(host.concat(realm), authenticationToken);
+ }
+
+ /**
+ * Removes the authentication token.
+ *
+ * @param host
+ * @param realm
+ *
+ * @return the authentication token or null if did not exist
+ */
+ public AuthenticationToken removeAuthenticationToken(String host, String realm) {
+ return this.authenticationTokens.remove(host.concat(realm));
+ }
+
+ /**
+ * Gets the authentication token.
+ *
+ * In order it tries:
+ * 1- host + realm
+ * 2- host
+ * 3- realm
+ * 4- no host, no realm
+ *
+ * @param host
+ * @param realm
+ *
+ * @return the authentication token
+ */
+ public AuthenticationToken getAuthenticationToken(String host, String realm) {
+ AuthenticationToken token = null;
+ token = this.authenticationTokens.get(host.concat(realm));
+
+ if (token == null) {
+ // try with just the host
+ token = this.authenticationTokens.get(host);
+
+ // Try the realm
+ if (token == null) {
+ token = this.authenticationTokens.get(realm);
+ }
+
+ // if no host found, just query for default
+ if (token == null) {
+ token = this.authenticationTokens.get("");
+ }
+ }
+
+ return token;
+ }
+
+ /**
+ * Clear all authentication tokens.
+ */
+ public void clearAuthenticationTokens() {
+ this.authenticationTokens.clear();
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
+ try {
+ // Check the against the allow list and lock out access to the WebView directory
+ // Changing this will cause problems for your application
+ if (!parentEngine.pluginManager.shouldAllowRequest(url)) {
+ LOG.w(TAG, "URL blocked by allow list: " + url);
+ // Results in a 404.
+ return new WebResourceResponse("text/plain", "UTF-8", null);
+ }
+
+ CordovaResourceApi resourceApi = parentEngine.resourceApi;
+ Uri origUri = Uri.parse(url);
+ // Allow plugins to intercept WebView requests.
+ Uri remappedUri = resourceApi.remapUri(origUri);
+
+ if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsContentUrlFix(origUri)) {
+ CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true);
+ return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream);
+ }
+ // If we don't need to special-case the request, let the browser load it.
+ return null;
+ } catch (IOException e) {
+ if (!(e instanceof FileNotFoundException)) {
+ LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e);
+ }
+ // Results in a 404.
+ return new WebResourceResponse("text/plain", "UTF-8", null);
+ }
+ }
+
+ private static boolean needsContentUrlFix(Uri uri) {
+ return "content".equals(uri.getScheme());
+ }
+
+ private static boolean needsSpecialsInAssetUrlFix(Uri uri) {
+ if (CordovaResourceApi.getUriType(uri) != CordovaResourceApi.URI_TYPE_ASSET) {
+ return false;
+ }
+ if (uri.getQuery() != null || uri.getFragment() != null) {
+ return true;
+ }
+
+ if (!uri.toString().contains("%")) {
+ return false;
+ }
+
+ return false;
+ }
+
+ @Override
+ public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
+ return this.assetLoader.shouldInterceptRequest(request.getUrl());
+ }
+}
diff --git a/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
new file mode 100644
index 0000000..71fa33d
--- /dev/null
+++ b/node_modules/cordova-android/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
@@ -0,0 +1,317 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova.engine;
+
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
+import android.os.Build;
+import android.view.View;
+import android.webkit.ValueCallback;
+import android.webkit.WebSettings;
+import android.webkit.WebSettings.LayoutAlgorithm;
+import android.webkit.WebView;
+
+import org.apache.cordova.CordovaBridge;
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.CordovaPreferences;
+import org.apache.cordova.CordovaResourceApi;
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaWebViewEngine;
+import org.apache.cordova.ICordovaCookieManager;
+import org.apache.cordova.LOG;
+import org.apache.cordova.NativeToJsMessageQueue;
+import org.apache.cordova.PluginManager;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+
+/**
+ * Glue class between CordovaWebView (main Cordova logic) and SystemWebView (the actual View).
+ * We make the Engine separate from the actual View so that:
+ * A) We don't need to worry about WebView methods clashing with CordovaWebViewEngine methods
+ * (e.g.: goBack() is void for WebView, and boolean for CordovaWebViewEngine)
+ * B) Separating the actual View from the Engine makes API surfaces smaller.
+ * Class uses two-phase initialization. However, CordovaWebView is responsible for calling .init().
+ */
+public class SystemWebViewEngine implements CordovaWebViewEngine {
+ public static final String TAG = "SystemWebViewEngine";
+
+ protected final SystemWebView webView;
+ protected final SystemCookieManager cookieManager;
+ protected CordovaPreferences preferences;
+ protected CordovaBridge bridge;
+ protected CordovaWebViewEngine.Client client;
+ protected CordovaWebView parentWebView;
+ protected CordovaInterface cordova;
+ protected PluginManager pluginManager;
+ protected CordovaResourceApi resourceApi;
+ protected NativeToJsMessageQueue nativeToJsMessageQueue;
+ private BroadcastReceiver receiver;
+
+ /** Used when created via reflection. */
+ public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
+ this(new SystemWebView(context), preferences);
+ }
+
+ public SystemWebViewEngine(SystemWebView webView) {
+ this(webView, null);
+ }
+
+ public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
+ this.preferences = preferences;
+ this.webView = webView;
+ cookieManager = new SystemCookieManager(webView);
+ }
+
+ @Override
+ public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
+ CordovaResourceApi resourceApi, PluginManager pluginManager,
+ NativeToJsMessageQueue nativeToJsMessageQueue) {
+ if (this.cordova != null) {
+ throw new IllegalStateException();
+ }
+ // Needed when prefs are not passed by the constructor
+ if (preferences == null) {
+ preferences = parentWebView.getPreferences();
+ }
+ this.parentWebView = parentWebView;
+ this.cordova = cordova;
+ this.client = client;
+ this.resourceApi = resourceApi;
+ this.pluginManager = pluginManager;
+ this.nativeToJsMessageQueue = nativeToJsMessageQueue;
+ webView.init(this, cordova);
+
+ initWebViewSettings();
+
+ nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
+ @Override
+ public void setNetworkAvailable(boolean value) {
+ //sometimes this can be called after calling webview.destroy() on destroy()
+ //thus resulting in a NullPointerException
+ if(webView!=null) {
+ webView.setNetworkAvailable(value);
+ }
+ }
+ @Override
+ public void runOnUiThread(Runnable r) {
+ SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
+ }
+ }));
+ nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
+ bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
+ exposeJsInterface(webView, bridge);
+ }
+
+ @Override
+ public CordovaWebView getCordovaWebView() {
+ return parentWebView;
+ }
+
+ @Override
+ public ICordovaCookieManager getCookieManager() {
+ return cookieManager;
+ }
+
+ @Override
+ public View getView() {
+ return webView;
+ }
+
+ @SuppressLint({"NewApi", "SetJavaScriptEnabled"})
+ @SuppressWarnings("deprecation")
+ private void initWebViewSettings() {
+ webView.setInitialScale(0);
+ webView.setVerticalScrollBarEnabled(false);
+ // Enable JavaScript
+ final WebSettings settings = webView.getSettings();
+ settings.setJavaScriptEnabled(true);
+ settings.setJavaScriptCanOpenWindowsAutomatically(true);
+ settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
+
+ String manufacturer = android.os.Build.MANUFACTURER;
+ LOG.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);
+
+ // We don't save any form data in the application
+ // @todo remove when Cordova drop API level 26 support
+ settings.setSaveFormData(false);
+
+ if (preferences.getBoolean("AndroidInsecureFileModeEnabled", false)) {
+ //These settings are deprecated and loading content via file:// URLs is generally discouraged,
+ //but we allow this for compatibility reasons
+ LOG.d(TAG, "Enabled insecure file access");
+ settings.setAllowFileAccess(true);
+ settings.setAllowUniversalAccessFromFileURLs(true);
+ }
+
+ settings.setMediaPlaybackRequiresUserGesture(false);
+
+ // Enable database
+ // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16
+ String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
+ settings.setDatabaseEnabled(true);
+
+ //Determine whether we're in debug or release mode, and turn on Debugging!
+ ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
+ if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
+ enableRemoteDebugging();
+ }
+
+ // @todo remove when Cordova drop API level 24 support
+ settings.setGeolocationDatabasePath(databasePath);
+
+ // Enable DOM storage
+ settings.setDomStorageEnabled(true);
+
+ // Enable built-in geolocation
+ settings.setGeolocationEnabled(true);
+
+ // Fix for CB-1405
+ // Google issue 4641
+ String defaultUserAgent = settings.getUserAgentString();
+
+ // Fix for CB-3360
+ String overrideUserAgent = preferences.getString("OverrideUserAgent", null);
+ if (overrideUserAgent != null) {
+ settings.setUserAgentString(overrideUserAgent);
+ } else {
+ String appendUserAgent = preferences.getString("AppendUserAgent", null);
+ if (appendUserAgent != null) {
+ settings.setUserAgentString(defaultUserAgent + " " + appendUserAgent);
+ }
+ }
+ // End CB-3360
+
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
+ if (this.receiver == null) {
+ this.receiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ settings.getUserAgentString();
+ }
+ };
+ webView.getContext().registerReceiver(this.receiver, intentFilter);
+ }
+ // end CB-1405
+ }
+
+ private void enableRemoteDebugging() {
+ try {
+ WebView.setWebContentsDebuggingEnabled(true);
+ } catch (IllegalArgumentException e) {
+ LOG.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
+ e.printStackTrace();
+ }
+ }
+
+ // Yeah, we know. It'd be great if lint was just a little smarter.
+ @SuppressLint("AddJavascriptInterface")
+ private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
+ SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
+ webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
+ }
+
+
+ /**
+ * Load the url into the webview.
+ */
+ @Override
+ public void loadUrl(final String url, boolean clearNavigationStack) {
+ webView.loadUrl(url);
+ }
+
+ @Override
+ public String getUrl() {
+ return webView.getUrl();
+ }
+
+ @Override
+ public void stopLoading() {
+ webView.stopLoading();
+ }
+
+ @Override
+ public void clearCache() {
+ webView.clearCache(true);
+ }
+
+ @Override
+ public void clearHistory() {
+ webView.clearHistory();
+ }
+
+ @Override
+ public boolean canGoBack() {
+ return webView.canGoBack();
+ }
+
+ /**
+ * Go to previous page in history. (We manage our own history)
+ *
+ * @return true if we went back, false if we are already at top
+ */
+ @Override
+ public boolean goBack() {
+ // Check webview first to see if there is a history
+ // This is needed to support curPage#diffLink, since they are added to parentEngine's history, but not our history url array (JQMobile behavior)
+ if (webView.canGoBack()) {
+ webView.goBack();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void setPaused(boolean value) {
+ if (value) {
+ webView.onPause();
+ webView.pauseTimers();
+ } else {
+ webView.onResume();
+ webView.resumeTimers();
+ }
+ }
+
+ @Override
+ public void destroy() {
+ webView.chromeClient.destroyLastDialog();
+ webView.destroy();
+ // unregister the receiver
+ if (receiver != null) {
+ try {
+ webView.getContext().unregisterReceiver(receiver);
+ } catch (Exception e) {
+ LOG.e(TAG, "Error unregistering configuration receiver: " + e.getMessage(), e);
+ }
+ }
+ }
+
+ @Override
+ public void evaluateJavascript(String js, ValueCallback callback) {
+ webView.evaluateJavascript(js, callback);
+ }
+}
diff --git a/node_modules/cordova-android/lib/Adb.js b/node_modules/cordova-android/lib/Adb.js
new file mode 100644
index 0000000..9326269
--- /dev/null
+++ b/node_modules/cordova-android/lib/Adb.js
@@ -0,0 +1,97 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var os = require('os');
+var execa = require('execa');
+var events = require('cordova-common').events;
+var CordovaError = require('cordova-common').CordovaError;
+
+var Adb = {};
+
+/**
+ * Lists available/connected devices and emulators
+ *
+ * @return {Promise} list of available/connected
+ * devices/emulators
+ */
+Adb.devices = async function () {
+ const { stdout } = await execa('adb', ['devices'], { cwd: os.tmpdir() });
+
+ // Split into lines & drop first one (header)
+ const rawDeviceLines = stdout.trim().split(/\r?\n/).slice(1);
+
+ return rawDeviceLines
+ .map(line => line.split('\t'))
+
+ // We are only interested in fully booted devices & emulators. These
+ // have a state of `device`. For a list of all the other possible states
+ // see https://github.com/aosp-mirror/platform_system_core/blob/2abdb1eb5b83c8f39874644af576c869815f5c5b/adb/transport.cpp#L1129
+ .filter(([, state]) => state === 'device')
+
+ .map(([id]) => id);
+};
+
+Adb.install = function (target, packagePath, { replace = false, execOptions = {} } = {}) {
+ events.emit('verbose', 'Installing apk ' + packagePath + ' on target ' + target + '...');
+
+ var args = ['-s', target, 'install'];
+ if (replace) args.push('-r');
+
+ const opts = { cwd: os.tmpdir(), ...execOptions };
+
+ return execa('adb', args.concat(packagePath), opts).then(({ stdout: output }) => {
+ // adb does not return an error code even if installation fails. Instead it puts a specific
+ // message to stdout, so we have to use RegExp matching to detect installation failure.
+ if (output.match(/Failure/)) {
+ if (output.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {
+ output += '\n\n' + 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +
+ ' or sign and deploy the unsigned apk manually using Android tools.';
+ } else if (output.match(/INSTALL_FAILED_VERSION_DOWNGRADE/)) {
+ output += '\n\n' + 'You\'re trying to install apk with a lower versionCode that is already installed.' +
+ '\nEither uninstall an app or increment the versionCode.';
+ }
+
+ throw new CordovaError('Failed to install apk to target: ' + output);
+ }
+ });
+};
+
+Adb.uninstall = function (target, packageId) {
+ events.emit('verbose', 'Uninstalling package ' + packageId + ' from target ' + target + '...');
+ return execa('adb', ['-s', target, 'uninstall', packageId], { cwd: os.tmpdir() }).then(({ stdout }) => stdout);
+};
+
+Adb.shell = function (target, shellCommand) {
+ events.emit('verbose', 'Running adb shell command "' + shellCommand + '" on target ' + target + '...');
+ var args = ['-s', target, 'shell'];
+ shellCommand = shellCommand.split(/\s+/);
+ return execa('adb', args.concat(shellCommand), { cwd: os.tmpdir() })
+ .then(({ stdout }) => stdout)
+ .catch(error => Promise.reject(new CordovaError(`Failed to execute shell command "${shellCommand}" on device: ${error}`)));
+};
+
+Adb.start = function (target, activityName) {
+ events.emit('verbose', 'Starting application "' + activityName + '" on target ' + target + '...');
+ return Adb.shell(target, 'am start -W -a android.intent.action.MAIN -n' + activityName).catch((error) => {
+ return Promise.reject(new CordovaError('Failed to start application "' +
+ activityName + '"" on device: ' + error));
+ });
+};
+
+module.exports = Adb;
diff --git a/node_modules/cordova-android/lib/AndroidManifest.js b/node_modules/cordova-android/lib/AndroidManifest.js
new file mode 100644
index 0000000..be4fecc
--- /dev/null
+++ b/node_modules/cordova-android/lib/AndroidManifest.js
@@ -0,0 +1,128 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var fs = require('fs');
+var xml = require('cordova-common').xmlHelpers;
+
+var DEFAULT_ORIENTATION = 'default';
+
+/** Wraps an AndroidManifest file */
+class AndroidManifest {
+ constructor (path) {
+ this.path = path;
+ this.doc = xml.parseElementtreeSync(path);
+ if (this.doc.getroot().tag !== 'manifest') {
+ throw new Error('AndroidManifest at ' + path + ' has incorrect root node name (expected "manifest")');
+ }
+ }
+
+ getVersionName () {
+ return this.doc.getroot().attrib['android:versionName'];
+ }
+
+ setVersionName (versionName) {
+ this.doc.getroot().attrib['android:versionName'] = versionName;
+ return this;
+ }
+
+ getVersionCode () {
+ return this.doc.getroot().attrib['android:versionCode'];
+ }
+
+ setVersionCode (versionCode) {
+ this.doc.getroot().attrib['android:versionCode'] = versionCode;
+ return this;
+ }
+
+ getPackageId () {
+ return this.doc.getroot().attrib.package;
+ }
+
+ setPackageId (pkgId) {
+ this.doc.getroot().attrib.package = pkgId;
+ return this;
+ }
+
+ getActivity () {
+ var activity = this.doc.getroot().find('./application/activity');
+ return {
+ getName: function () {
+ return activity.attrib['android:name'];
+ },
+ setName: function (name) {
+ if (!name) {
+ delete activity.attrib['android:name'];
+ } else {
+ activity.attrib['android:name'] = name;
+ }
+ return this;
+ },
+ getOrientation: function () {
+ return activity.attrib['android:screenOrientation'];
+ },
+ setOrientation: function (orientation) {
+ if (!orientation || orientation.toLowerCase() === DEFAULT_ORIENTATION) {
+ delete activity.attrib['android:screenOrientation'];
+ } else {
+ activity.attrib['android:screenOrientation'] = orientation;
+ }
+ return this;
+ },
+ getLaunchMode: function () {
+ return activity.attrib['android:launchMode'];
+ },
+ setLaunchMode: function (launchMode) {
+ if (!launchMode) {
+ delete activity.attrib['android:launchMode'];
+ } else {
+ activity.attrib['android:launchMode'] = launchMode;
+ }
+ return this;
+ }
+ };
+ }
+
+ getDebuggable () {
+ return this.doc.getroot().find('./application').attrib['android:debuggable'] === 'true';
+ }
+
+ setDebuggable (value) {
+ var application = this.doc.getroot().find('./application');
+ if (value) {
+ application.attrib['android:debuggable'] = 'true';
+ } else {
+ // The default value is "false", so we can remove attribute at all.
+ delete application.attrib['android:debuggable'];
+ }
+ return this;
+ }
+
+ /**
+ * Writes manifest to disk syncronously. If filename is specified, then manifest
+ * will be written to that file
+ *
+ * @param {String} [destPath] File to write manifest to. If omitted,
+ * manifest will be written to file it has been read from.
+ */
+ write (destPath) {
+ fs.writeFileSync(destPath || this.path, this.doc.write({ indent: 4 }), 'utf-8');
+ }
+}
+
+module.exports = AndroidManifest;
diff --git a/node_modules/cordova-android/lib/AndroidProject.js b/node_modules/cordova-android/lib/AndroidProject.js
new file mode 100644
index 0000000..5d1c3c3
--- /dev/null
+++ b/node_modules/cordova-android/lib/AndroidProject.js
@@ -0,0 +1,202 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var fs = require('fs');
+var path = require('path');
+var properties_parser = require('properties-parser');
+var AndroidManifest = require('./AndroidManifest');
+var pluginHandlers = require('./pluginHandlers');
+
+var projectFileCache = {};
+
+function addToPropertyList (projectProperties, key, value) {
+ var i = 1;
+ while (projectProperties.get(key + '.' + i)) { i++; }
+
+ projectProperties.set(key + '.' + i, value);
+ projectProperties.dirty = true;
+}
+
+function removeFromPropertyList (projectProperties, key, value) {
+ var i = 1;
+ var currentValue;
+ while ((currentValue = projectProperties.get(key + '.' + i))) {
+ if (currentValue === value) {
+ while ((currentValue = projectProperties.get(key + '.' + (i + 1)))) {
+ projectProperties.set(key + '.' + i, currentValue);
+ i++;
+ }
+ projectProperties.set(key + '.' + i);
+ break;
+ }
+ i++;
+ }
+ projectProperties.dirty = true;
+}
+
+function getRelativeLibraryPath (parentDir, subDir) {
+ var libraryPath = path.relative(parentDir, subDir);
+ return (path.sep === '\\') ? libraryPath.replace(/\\/g, '/') : libraryPath;
+}
+
+class AndroidProject {
+ constructor (projectDir) {
+ this._propertiesEditors = {};
+ this._subProjectDirs = {};
+ this._dirty = false;
+ this.projectDir = projectDir;
+ this.platformWww = path.join(this.projectDir, 'platform_www');
+ this.www = path.join(this.projectDir, 'app/src/main/assets/www');
+ }
+
+ /**
+ * Reads the package name out of the Android Manifest file
+ *
+ * @param {String} projectDir The absolute path to the directory containing the project
+ * @return {String} The name of the package
+ */
+ getPackageName () {
+ var manifestPath = path.join(this.projectDir, 'app/src/main/AndroidManifest.xml');
+ return new AndroidManifest(manifestPath).getPackageId();
+ }
+
+ getCustomSubprojectRelativeDir (plugin_id, src) {
+ // All custom subprojects are prefixed with the last portion of the package id.
+ // This is to avoid collisions when opening multiple projects in Eclipse that have subprojects with the same name.
+ var packageName = this.getPackageName();
+ var lastDotIndex = packageName.lastIndexOf('.');
+ var prefix = packageName.substring(lastDotIndex + 1);
+ var subRelativeDir = path.join(plugin_id, prefix + '-' + path.basename(src));
+ return subRelativeDir;
+ }
+
+ addSubProject (parentDir, subDir) {
+ var parentProjectFile = path.resolve(parentDir, 'project.properties');
+ var subProjectFile = path.resolve(subDir, 'project.properties');
+ var parentProperties = this._getPropertiesFile(parentProjectFile);
+ // TODO: Setting the target needs to happen only for pre-3.7.0 projects
+ if (fs.existsSync(subProjectFile)) {
+ var subProperties = this._getPropertiesFile(subProjectFile);
+ subProperties.set('target', parentProperties.get('target'));
+ subProperties.dirty = true;
+ this._subProjectDirs[subDir] = true;
+ }
+ addToPropertyList(parentProperties, 'android.library.reference', getRelativeLibraryPath(parentDir, subDir));
+
+ this._dirty = true;
+ }
+
+ removeSubProject (parentDir, subDir) {
+ var parentProjectFile = path.resolve(parentDir, 'project.properties');
+ var parentProperties = this._getPropertiesFile(parentProjectFile);
+ removeFromPropertyList(parentProperties, 'android.library.reference', getRelativeLibraryPath(parentDir, subDir));
+ delete this._subProjectDirs[subDir];
+ this._dirty = true;
+ }
+
+ addGradleReference (parentDir, subDir) {
+ var parentProjectFile = path.resolve(parentDir, 'project.properties');
+ var parentProperties = this._getPropertiesFile(parentProjectFile);
+ addToPropertyList(parentProperties, 'cordova.gradle.include', getRelativeLibraryPath(parentDir, subDir));
+ this._dirty = true;
+ }
+
+ removeGradleReference (parentDir, subDir) {
+ var parentProjectFile = path.resolve(parentDir, 'project.properties');
+ var parentProperties = this._getPropertiesFile(parentProjectFile);
+ removeFromPropertyList(parentProperties, 'cordova.gradle.include', getRelativeLibraryPath(parentDir, subDir));
+ this._dirty = true;
+ }
+
+ addSystemLibrary (parentDir, value) {
+ var parentProjectFile = path.resolve(parentDir, 'project.properties');
+ var parentProperties = this._getPropertiesFile(parentProjectFile);
+ addToPropertyList(parentProperties, 'cordova.system.library', value);
+ this._dirty = true;
+ }
+
+ removeSystemLibrary (parentDir, value) {
+ var parentProjectFile = path.resolve(parentDir, 'project.properties');
+ var parentProperties = this._getPropertiesFile(parentProjectFile);
+ removeFromPropertyList(parentProperties, 'cordova.system.library', value);
+ this._dirty = true;
+ }
+
+ write () {
+ if (!this._dirty) {
+ return;
+ }
+ this._dirty = false;
+
+ for (var filename in this._propertiesEditors) {
+ var editor = this._propertiesEditors[filename];
+ if (editor.dirty) {
+ fs.writeFileSync(filename, editor.toString());
+ editor.dirty = false;
+ }
+ }
+ }
+
+ getInstaller (type) {
+ return pluginHandlers.getInstaller(type);
+ }
+
+ getUninstaller (type) {
+ return pluginHandlers.getUninstaller(type);
+ }
+
+ /*
+ * This checks if an Android project is clean or has old build artifacts
+ */
+ isClean () {
+ var build_path = path.join(this.projectDir, 'build');
+ // If the build directory doesn't exist, it's clean
+ return !(fs.existsSync(build_path));
+ }
+
+ _getPropertiesFile (filename) {
+ if (!this._propertiesEditors[filename]) {
+ if (fs.existsSync(filename)) {
+ this._propertiesEditors[filename] = properties_parser.createEditor(filename);
+ } else {
+ this._propertiesEditors[filename] = properties_parser.createEditor();
+ }
+ }
+
+ return this._propertiesEditors[filename];
+ }
+
+ static getProjectFile (projectDir) {
+ if (!projectFileCache[projectDir]) {
+ projectFileCache[projectDir] = new AndroidProject(projectDir);
+ }
+
+ return projectFileCache[projectDir];
+ }
+
+ static purgeCache (projectDir) {
+ if (projectDir) {
+ delete projectFileCache[projectDir];
+ } else {
+ projectFileCache = {};
+ }
+ }
+}
+
+module.exports = AndroidProject;
diff --git a/node_modules/cordova-android/lib/Api.js b/node_modules/cordova-android/lib/Api.js
new file mode 100644
index 0000000..b9b5192
--- /dev/null
+++ b/node_modules/cordova-android/lib/Api.js
@@ -0,0 +1,378 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var path = require('path');
+
+var AndroidProject = require('./AndroidProject');
+var PluginManager = require('cordova-common').PluginManager;
+
+var CordovaLogger = require('cordova-common').CordovaLogger;
+var selfEvents = require('cordova-common').events;
+var ConfigParser = require('cordova-common').ConfigParser;
+const prepare = require('./prepare').prepare;
+
+var PLATFORM = 'android';
+const VERSION = require('../package').version;
+
+function setupEvents (externalEventEmitter) {
+ if (externalEventEmitter) {
+ // This will make the platform internal events visible outside
+ selfEvents.forwardEventsTo(externalEventEmitter);
+ return externalEventEmitter;
+ }
+
+ // There is no logger if external emitter is not present,
+ // so attach a console logger
+ CordovaLogger.get().subscribe(selfEvents);
+ return selfEvents;
+}
+
+/**
+ * Class, that acts as abstraction over particular platform. Encapsulates the
+ * platform's properties and methods.
+ *
+ * Platform that implements own PlatformApi instance _should implement all
+ * prototype methods_ of this class to be fully compatible with cordova-lib.
+ *
+ * The PlatformApi instance also should define the following field:
+ *
+ * * platform: String that defines a platform name.
+ * @class Api
+ */
+class Api {
+ constructor (platform, platformRootDir, events) {
+ this.platform = PLATFORM;
+ this.root = platformRootDir;
+
+ setupEvents(events);
+
+ const appMain = path.join(this.root, 'app', 'src', 'main');
+ const appRes = path.join(appMain, 'res');
+
+ this.locations = {
+ root: this.root,
+ www: path.join(appMain, 'assets', 'www'),
+ res: appRes,
+ platformWww: path.join(this.root, 'platform_www'),
+ configXml: path.join(appRes, 'xml', 'config.xml'),
+ defaultConfigXml: path.join(this.root, 'cordova', 'defaults.xml'),
+ strings: path.join(appRes, 'values', 'strings.xml'),
+ manifest: path.join(appMain, 'AndroidManifest.xml'),
+ build: path.join(this.root, 'build'),
+ javaSrc: path.join(appMain, 'java')
+ };
+
+ this._builder = require('./builders/builders').getBuilder(this.root);
+ }
+
+ /**
+ * Gets a CordovaPlatform object, that represents the platform structure.
+ *
+ * @return {CordovaPlatform} A structure that contains the description of
+ * platform's file structure and other properties of platform.
+ */
+ getPlatformInfo () {
+ var result = {};
+ result.locations = this.locations;
+ result.root = this.root;
+ result.name = this.platform;
+ result.version = Api.version();
+ result.projectConfig = this._config;
+
+ return result;
+ }
+
+ /**
+ * Updates installed platform with provided www assets and new app
+ * configuration. This method is required for CLI workflow and will be called
+ * each time before build, so the changes, made to app configuration and www
+ * code, will be applied to platform.
+ *
+ * @param {CordovaProject} cordovaProject A CordovaProject instance, that defines a
+ * project structure and configuration, that should be applied to platform
+ * (contains project's www location and ConfigParser instance for project's
+ * config).
+ *
+ * @return {Promise} Return a promise either fulfilled, or rejected with
+ * CordovaError instance.
+ */
+ prepare (cordovaProject, prepareOptions) {
+ cordovaProject.projectConfig = new ConfigParser(cordovaProject.locations.rootConfigXml || cordovaProject.projectConfig.path);
+
+ return prepare.call(this, cordovaProject, prepareOptions);
+ }
+
+ /**
+ * Installs a new plugin into platform. This method only copies non-www files
+ * (sources, libs, etc.) to platform. It also doesn't resolves the
+ * dependencies of plugin. Both of handling of www files, such as assets and
+ * js-files and resolving dependencies are the responsibility of caller.
+ *
+ * @param {PluginInfo} plugin A PluginInfo instance that represents plugin
+ * that will be installed.
+ * @param {Object} installOptions An options object. Possible options below:
+ * @param {Boolean} installOptions.link: Flag that specifies that plugin
+ * sources will be symlinked to app's directory instead of copying (if
+ * possible).
+ * @param {Object} installOptions.variables An object that represents
+ * variables that will be used to install plugin. See more details on plugin
+ * variables in documentation:
+ * https://cordova.apache.org/docs/en/4.0.0/plugin_ref_spec.md.html
+ *
+ * @return {Promise} Return a promise either fulfilled, or rejected with
+ * CordovaError instance.
+ */
+ addPlugin (plugin, installOptions) {
+ var project = AndroidProject.getProjectFile(this.root);
+ var self = this;
+
+ installOptions = installOptions || {};
+ installOptions.variables = installOptions.variables || {};
+ // Add PACKAGE_NAME variable into vars
+ if (!installOptions.variables.PACKAGE_NAME) {
+ installOptions.variables.PACKAGE_NAME = project.getPackageName();
+ }
+
+ return Promise.resolve().then(function () {
+ return PluginManager.get(self.platform, self.locations, project).addPlugin(plugin, installOptions);
+ }).then(function () {
+ if (plugin.getFrameworks(this.platform).length === 0) return;
+ selfEvents.emit('verbose', 'Updating build files since android plugin contained ');
+ // This should pick the correct builder, not just get gradle
+ this._builder.prepBuildFiles();
+ }.bind(this))
+ // CB-11022 Return truthy value to prevent running prepare after
+ .then(() => true);
+ }
+
+ /**
+ * Removes an installed plugin from platform.
+ *
+ * Since method accepts PluginInfo instance as input parameter instead of plugin
+ * id, caller shoud take care of managing/storing PluginInfo instances for
+ * future uninstalls.
+ *
+ * @param {PluginInfo} plugin A PluginInfo instance that represents plugin
+ * that will be installed.
+ *
+ * @return {Promise} Return a promise either fulfilled, or rejected with
+ * CordovaError instance.
+ */
+ removePlugin (plugin, uninstallOptions) {
+ var project = AndroidProject.getProjectFile(this.root);
+
+ if (uninstallOptions && uninstallOptions.usePlatformWww === true) {
+ uninstallOptions.usePlatformWww = false;
+ }
+
+ return PluginManager.get(this.platform, this.locations, project)
+ .removePlugin(plugin, uninstallOptions)
+ .then(function () {
+ if (plugin.getFrameworks(this.platform).length === 0) return;
+
+ selfEvents.emit('verbose', 'Updating build files since android plugin contained ');
+ this._builder.prepBuildFiles();
+ }.bind(this))
+ // CB-11022 Return truthy value to prevent running prepare after
+ .then(() => true);
+ }
+
+ /**
+ * Builds an application package for current platform.
+ *
+ * @param {Object} buildOptions A build options. This object's structure is
+ * highly depends on platform's specific. The most common options are:
+ * @param {Boolean} buildOptions.debug Indicates that packages should be
+ * built with debug configuration. This is set to true by default unless the
+ * 'release' option is not specified.
+ * @param {Boolean} buildOptions.release Indicates that packages should be
+ * built with release configuration. If not set to true, debug configuration
+ * will be used.
+ * @param {Boolean} buildOptions.device Specifies that built app is intended
+ * to run on device
+ * @param {Boolean} buildOptions.emulator: Specifies that built app is
+ * intended to run on emulator
+ * @param {String} buildOptions.target Specifies the device id that will be
+ * used to run built application.
+ * @param {Boolean} buildOptions.nobuild Indicates that this should be a
+ * dry-run call, so no build artifacts will be produced.
+ * @param {String[]} buildOptions.archs Specifies chip architectures which
+ * app packages should be built for. List of valid architectures is depends on
+ * platform.
+ * @param {String} buildOptions.buildConfig The path to build configuration
+ * file. The format of this file is depends on platform.
+ * @param {String[]} buildOptions.argv Raw array of command-line arguments,
+ * passed to `build` command. The purpose of this property is to pass a
+ * platform-specific arguments, and eventually let platform define own
+ * arguments processing logic.
+ *
+ * @return {Promise} A promise either fulfilled with an array of build
+ * artifacts (application packages) if package was built successfully,
+ * or rejected with CordovaError. The resultant build artifact objects is not
+ * strictly typed and may conatin arbitrary set of fields as in sample below.
+ *
+ * {
+ * architecture: 'x86',
+ * buildType: 'debug',
+ * path: '/path/to/build',
+ * type: 'app'
+ * }
+ *
+ * The return value in most cases will contain only one item but in some cases
+ * there could be multiple items in output array, e.g. when multiple
+ * arhcitectures is specified.
+ */
+ build (buildOptions) {
+ var self = this;
+
+ return require('./check_reqs').run().then(function () {
+ return require('./build').run.call(self, buildOptions);
+ }).then(function (buildResults) {
+ // Cast build result to array of build artifacts
+ return buildResults.paths.map(function (apkPath) {
+ return {
+ buildType: buildResults.buildType,
+ buildMethod: buildResults.buildMethod,
+ path: apkPath,
+ type: path.extname(apkPath).replace(/\./g, '')
+ };
+ });
+ });
+ }
+
+ /**
+ * Builds an application package for current platform and runs it on
+ * specified/default device. If no 'device'/'emulator'/'target' options are
+ * specified, then tries to run app on default device if connected, otherwise
+ * runs the app on emulator.
+ *
+ * @param {Object} runOptions An options object. The structure is the same
+ * as for build options.
+ *
+ * @return {Promise} A promise either fulfilled if package was built and ran
+ * successfully, or rejected with CordovaError.
+ */
+ run (runOptions) {
+ var self = this;
+ return require('./check_reqs').run().then(function () {
+ return require('./run').run.call(self, runOptions);
+ });
+ }
+
+ /**
+ * Cleans out the build artifacts from platform's directory, and also
+ * cleans out the platform www directory if called without options specified.
+ *
+ * @return {Promise} Return a promise either fulfilled, or rejected with
+ * CordovaError.
+ */
+ clean (cleanOptions) {
+ var self = this;
+ // This will lint, checking for null won't
+ if (typeof cleanOptions === 'undefined') {
+ cleanOptions = {};
+ }
+
+ return require('./check_reqs').run().then(function () {
+ return require('./build').runClean.call(self, cleanOptions);
+ }).then(function () {
+ return require('./prepare').clean.call(self, cleanOptions);
+ });
+ }
+
+ /**
+ * Performs a requirements check for current platform. Each platform defines its
+ * own set of requirements, which should be resolved before platform can be
+ * built successfully.
+ *
+ * @return {Promise} Promise, resolved with set of Requirement
+ * objects for current platform.
+ */
+ requirements () {
+ return require('./check_reqs').check_all(this.root);
+ }
+
+ /**
+ * Installs platform to specified directory and creates a platform project.
+ *
+ * @param {String} destination Destination directory, where insatll platform to
+ * @param {ConfigParser} [config] ConfgiParser instance, used to retrieve
+ * project creation options, such as package id and project name.
+ * @param {Object} [options] An options object. The most common options are:
+ * @param {String} [options.customTemplate] A path to custom template, that
+ * should override the default one from platform.
+ * @param {Boolean} [options.link] Flag that indicates that platform's
+ * sources will be linked to installed platform instead of copying.
+ * @param {EventEmitter} [events] An EventEmitter instance that will be used for
+ * logging purposes. If no EventEmitter provided, all events will be logged to
+ * console
+ *
+ * @return {Promise} Promise either fulfilled with PlatformApi
+ * instance or rejected with CordovaError.
+ */
+ static createPlatform (destination, config, options, events) {
+ events = setupEvents(events);
+ var result;
+ try {
+ result = require('./create').create(destination, config, options, events).then(function (destination) {
+ return new Api(PLATFORM, destination, events);
+ });
+ } catch (e) {
+ events.emit('error', 'createPlatform is not callable from the android project API.');
+ throw (e);
+ }
+ return result;
+ }
+
+ /**
+ * Updates already installed platform.
+ *
+ * @param {String} destination Destination directory, where platform installed
+ * @param {Object} [options] An options object. The most common options are:
+ * @param {String} [options.customTemplate] A path to custom template, that
+ * should override the default one from platform.
+ * @param {Boolean} [options.link] Flag that indicates that platform's
+ * sources will be linked to installed platform instead of copying.
+ * @param {EventEmitter} [events] An EventEmitter instance that will be used for
+ * logging purposes. If no EventEmitter provided, all events will be logged to
+ * console
+ *
+ * @return {Promise} Promise either fulfilled with PlatformApi
+ * instance or rejected with CordovaError.
+ */
+ static updatePlatform (destination, options, events) {
+ events = setupEvents(events);
+ var result;
+ try {
+ result = require('../../lib/create').update(destination, options, events).then(function (destination) {
+ return new Api(PLATFORM, destination, events);
+ });
+ } catch (e) {
+ events.emit('error', 'updatePlatform is not callable from the android project API, you will need to do this manually.');
+ throw (e);
+ }
+ return result;
+ }
+
+ static version () {
+ return VERSION;
+ }
+}
+
+module.exports = Api;
diff --git a/node_modules/cordova-android/lib/PackageType.js b/node_modules/cordova-android/lib/PackageType.js
new file mode 100644
index 0000000..fd129f1
--- /dev/null
+++ b/node_modules/cordova-android/lib/PackageType.js
@@ -0,0 +1,25 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const PackageType = {
+ APK: 'apk',
+ BUNDLE: 'bundle'
+};
+
+module.exports = PackageType;
diff --git a/node_modules/cordova-android/lib/android_sdk.js b/node_modules/cordova-android/lib/android_sdk.js
new file mode 100644
index 0000000..5d9da08
--- /dev/null
+++ b/node_modules/cordova-android/lib/android_sdk.js
@@ -0,0 +1,90 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const execa = require('execa');
+
+var suffix_number_regex = /(\d+)$/;
+// Used for sorting Android targets, example strings to sort:
+// android-19
+// android-L
+// Google Inc.:Google APIs:20
+// Google Inc.:Glass Development Kit Preview:20
+// The idea is to sort based on largest "suffix" number - meaning the bigger
+// the number at the end, the more recent the target, the closer to the
+// start of the array.
+function sort_by_largest_numerical_suffix (a, b) {
+ let suffix_a = a.match(suffix_number_regex);
+ let suffix_b = b.match(suffix_number_regex);
+ // If no number is detected (eg: preview version like android-R),
+ // designate a suffix of 0 so it gets moved to the end
+ suffix_a = suffix_a || ['0', '0'];
+ suffix_b = suffix_b || ['0', '0'];
+ // Return < zero, or > zero, based on which suffix is larger.
+ return (parseInt(suffix_a[1]) > parseInt(suffix_b[1]) ? -1 : 1);
+}
+
+module.exports.print_newest_available_sdk_target = function () {
+ return module.exports.list_targets().then(function (targets) {
+ targets.sort(sort_by_largest_numerical_suffix);
+ console.log(targets[0]);
+ });
+};
+
+// Versions should not be represented as float, so we disable quote-props here
+/* eslint-disable quote-props */
+module.exports.version_string_to_api_level = {
+ '4.0': 14,
+ '4.0.3': 15,
+ '4.1': 16,
+ '4.2': 17,
+ '4.3': 18,
+ '4.4': 19,
+ '4.4W': 20,
+ '5.0': 21,
+ '5.1': 22,
+ '6.0': 23,
+ '7.0': 24,
+ '7.1.1': 25,
+ '8.0': 26
+};
+/* eslint-enable quote-props */
+
+function parse_targets (output) {
+ var target_out = output.split('\n');
+ var targets = [];
+ for (var i = target_out.length - 1; i >= 0; i--) {
+ if (target_out[i].match(/id:/)) { // if "id:" is in the line...
+ targets.push(target_out[i].match(/"(.+)"/)[1]); // .. match whatever is in quotes.
+ }
+ }
+ return targets;
+}
+
+module.exports.list_targets_with_avdmanager = function () {
+ return execa('avdmanager', ['list', 'target']).then(result => parse_targets(result.stdout));
+};
+
+module.exports.list_targets = function () {
+ return module.exports.list_targets_with_avdmanager().then(function (targets) {
+ if (targets.length === 0) {
+ return Promise.reject(new Error('No android targets (SDKs) installed!'));
+ }
+ return targets;
+ });
+};
diff --git a/node_modules/cordova-android/lib/build.js b/node_modules/cordova-android/lib/build.js
new file mode 100644
index 0000000..1a5c54d
--- /dev/null
+++ b/node_modules/cordova-android/lib/build.js
@@ -0,0 +1,246 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var path = require('path');
+var fs = require('fs');
+var nopt = require('nopt');
+const untildify = require('untildify');
+
+var Adb = require('./Adb');
+
+var events = require('cordova-common').events;
+var PackageType = require('./PackageType');
+
+module.exports.parseBuildOptions = parseOpts;
+function parseOpts (options, resolvedTarget, projectRoot) {
+ options = options || {};
+ options.argv = nopt({
+ prepenv: Boolean,
+ versionCode: String,
+ minSdkVersion: String,
+ maxSdkVersion: String,
+ targetSdkVersion: String,
+ gradleArg: [String, Array],
+ keystore: path,
+ alias: String,
+ storePassword: String,
+ password: String,
+ keystoreType: String,
+ packageType: String
+ }, {}, options.argv, 0);
+
+ // Android Studio Build method is the default
+ var ret = {
+ buildType: options.release ? 'release' : 'debug',
+ prepEnv: options.argv.prepenv,
+ arch: resolvedTarget && resolvedTarget.arch,
+ extraArgs: []
+ };
+
+ if (options.argv.versionCode) { ret.extraArgs.push('-PcdvVersionCode=' + options.argv.versionCode); }
+ if (options.argv.minSdkVersion) { ret.extraArgs.push('-PcdvMinSdkVersion=' + options.argv.minSdkVersion); }
+ if (options.argv.maxSdkVersion) { ret.extraArgs.push('-PcdvMaxSdkVersion=' + options.argv.maxSdkVersion); }
+ if (options.argv.targetSdkVersion) { ret.extraArgs.push('-PcdvTargetSdkVersion=' + options.argv.targetSdkVersion); }
+ if (options.argv.gradleArg) {
+ ret.extraArgs = ret.extraArgs.concat(options.argv.gradleArg);
+ }
+
+ var packageArgs = {};
+
+ if (options.argv.keystore) { packageArgs.keystore = path.relative(projectRoot, path.resolve(options.argv.keystore)); }
+
+ ['alias', 'storePassword', 'password', 'keystoreType', 'packageType'].forEach(function (flagName) {
+ if (options.argv[flagName]) { packageArgs[flagName] = options.argv[flagName]; }
+ });
+
+ var buildConfig = options.buildConfig;
+
+ // If some values are not specified as command line arguments - use build config to supplement them.
+ // Command line arguments have precedence over build config.
+ if (buildConfig) {
+ if (!fs.existsSync(buildConfig)) {
+ throw new Error('Specified build config file does not exist: ' + buildConfig);
+ }
+ events.emit('log', 'Reading build config file: ' + path.resolve(buildConfig));
+ var buildjson = fs.readFileSync(buildConfig, 'utf8');
+ var config = JSON.parse(buildjson.replace(/^\ufeff/, '')); // Remove BOM
+ if (config.android && config.android[ret.buildType]) {
+ var androidInfo = config.android[ret.buildType];
+ if (androidInfo.keystore && !packageArgs.keystore) {
+ androidInfo.keystore = untildify(androidInfo.keystore);
+ packageArgs.keystore = path.resolve(path.dirname(buildConfig), androidInfo.keystore);
+ events.emit('log', 'Reading the keystore from: ' + packageArgs.keystore);
+ }
+
+ ['alias', 'storePassword', 'password', 'keystoreType', 'packageType'].forEach(function (key) {
+ packageArgs[key] = packageArgs[key] || androidInfo[key];
+ });
+ }
+ }
+
+ if (packageArgs.keystore && packageArgs.alias) {
+ ret.packageInfo = new PackageInfo(packageArgs.keystore, packageArgs.alias, packageArgs.storePassword,
+ packageArgs.password, packageArgs.keystoreType);
+ }
+
+ if (!ret.packageInfo) {
+ // The following loop is to decide whether to print a warning about generating a signed archive
+ // We only want to produce a warning if they are using a config property that is related to signing, but
+ // missing the required properties for signing. We don't want to produce a warning if they are simply
+ // using a build property that isn't related to signing, such as --packageType
+ let shouldWarn = false;
+ const signingKeys = ['keystore', 'alias', 'storePassword', 'password', 'keystoreType'];
+
+ for (const key in packageArgs) {
+ if (!shouldWarn && signingKeys.indexOf(key) > -1) {
+ // If we enter this condition, we have a key used for signing a build,
+ // but we are missing some required signing properties
+ shouldWarn = true;
+ }
+ }
+
+ if (shouldWarn) {
+ events.emit('warn', '\'keystore\' and \'alias\' need to be specified to generate a signed archive.');
+ }
+ }
+
+ if (packageArgs.packageType) {
+ const VALID_PACKAGE_TYPES = [PackageType.APK, PackageType.BUNDLE];
+ if (VALID_PACKAGE_TYPES.indexOf(packageArgs.packageType) === -1) {
+ events.emit('warn', '"' + packageArgs.packageType + '" is an invalid packageType. Valid values are: ' + VALID_PACKAGE_TYPES.join(', ') + '\nDefaulting packageType to ' + PackageType.APK);
+ ret.packageType = PackageType.APK;
+ } else {
+ ret.packageType = packageArgs.packageType;
+ }
+ } else {
+ if (ret.buildType === 'release') {
+ ret.packageType = PackageType.BUNDLE;
+ } else {
+ ret.packageType = PackageType.APK;
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Builds the project with the specifed options
+ * Returns a promise.
+ */
+module.exports.runClean = function (options) {
+ var opts = parseOpts(options, null, this.root);
+ var builder = this._builder;
+
+ return builder.prepEnv(opts).then(function () {
+ return builder.clean(opts);
+ });
+};
+
+/**
+ * Builds the project with the specifed options.
+ *
+ * @param {BuildOptions} options A set of options. See PlatformApi.build
+ * method documentation for reference.
+ * @param {Object} optResolvedTarget A deployment target. Used to pass
+ * target architecture from upstream 'run' call. TODO: remove this option in
+ * favor of setting buildOptions.archs field.
+ *
+ * @return {Promise} Promise, resolved with built packages
+ * information.
+ */
+module.exports.run = function (options, optResolvedTarget) {
+ var opts = parseOpts(options, optResolvedTarget, this.root);
+ var builder = this._builder;
+
+ return builder.prepEnv(opts).then(function () {
+ if (opts.prepEnv) {
+ events.emit('verbose', 'Build file successfully prepared.');
+ return;
+ }
+ return builder.build(opts).then(function () {
+ var paths;
+ if (opts.packageType === PackageType.BUNDLE) {
+ paths = builder.findOutputBundles(opts.buildType);
+ events.emit('log', 'Built the following bundle(s): \n\t' + paths.join('\n\t'));
+ } else {
+ paths = builder.findOutputApks(opts.buildType, opts.arch);
+ events.emit('log', 'Built the following apk(s): \n\t' + paths.join('\n\t'));
+ }
+
+ return {
+ paths: paths,
+ buildType: opts.buildType
+ };
+ });
+ });
+};
+
+/*
+ * Detects the architecture of a device/emulator
+ * Returns "arm" or "x86".
+ */
+module.exports.detectArchitecture = function (target) {
+ return Adb.shell(target, 'cat /proc/cpuinfo').then(function (output) {
+ return /intel/i.exec(output) ? 'x86' : 'arm';
+ });
+};
+
+module.exports.findBestApkForArchitecture = function (buildResults, arch) {
+ var paths = buildResults.apkPaths.filter(function (p) {
+ var apkName = path.basename(p);
+ if (buildResults.buildType === 'debug') {
+ return /-debug/.exec(apkName);
+ }
+ return !/-debug/.exec(apkName);
+ });
+ var archPattern = new RegExp('-' + arch);
+ var hasArchPattern = /-x86|-arm/;
+ for (var i = 0; i < paths.length; ++i) {
+ var apkName = path.basename(paths[i]);
+ if (hasArchPattern.exec(apkName)) {
+ if (archPattern.exec(apkName)) {
+ return paths[i];
+ }
+ } else {
+ return paths[i];
+ }
+ }
+ throw new Error('Could not find apk architecture: ' + arch + ' build-type: ' + buildResults.buildType);
+};
+
+function PackageInfo (keystore, alias, storePassword, password, keystoreType) {
+ const createNameKeyObject = (name, value) => ({ name, value: value.replace(/\\/g, '\\\\') });
+
+ this.data = [
+ createNameKeyObject('key.store', keystore),
+ createNameKeyObject('key.alias', alias)
+ ];
+
+ if (storePassword) this.data.push(createNameKeyObject('key.store.password', storePassword));
+ if (password) this.data.push(createNameKeyObject('key.alias.password', password));
+ if (keystoreType) this.data.push(createNameKeyObject('key.store.type', keystoreType));
+}
+
+PackageInfo.prototype = {
+ appendToProperties: function (propertiesParser) {
+ for (const { name, value } of this.data) propertiesParser.set(name, value);
+
+ propertiesParser.save();
+ }
+};
diff --git a/node_modules/cordova-android/lib/builders/ProjectBuilder.js b/node_modules/cordova-android/lib/builders/ProjectBuilder.js
new file mode 100644
index 0000000..f92e358
--- /dev/null
+++ b/node_modules/cordova-android/lib/builders/ProjectBuilder.js
@@ -0,0 +1,364 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var fs = require('fs-extra');
+var path = require('path');
+const execa = require('execa');
+const glob = require('fast-glob');
+var events = require('cordova-common').events;
+var CordovaError = require('cordova-common').CordovaError;
+var check_reqs = require('../check_reqs');
+var PackageType = require('../PackageType');
+const { compareByAll } = require('../utils');
+const { createEditor } = require('properties-parser');
+
+const MARKER = 'YOUR CHANGES WILL BE ERASED!';
+const SIGNING_PROPERTIES = '-signing.properties';
+const TEMPLATE =
+ '# This file is automatically generated.\n' +
+ '# Do not modify this file -- ' + MARKER + '\n';
+
+const isPathArchSpecific = p => /-x86|-arm/.test(path.basename(p));
+
+const outputFileComparator = compareByAll([
+ // Sort arch specific builds after generic ones
+ isPathArchSpecific,
+
+ // Sort unsigned builds after signed ones
+ filePath => /-unsigned/.test(path.basename(filePath)),
+
+ // Sort by file modification time, latest first
+ filePath => -fs.statSync(filePath).mtime.getTime(),
+
+ // Sort by file name length, ascending
+ filePath => filePath.length
+]);
+
+/**
+ * @param {'apk' | 'aab'} bundleType
+ * @param {'debug' | 'release'} buildType
+ * @param {{arch?: string}} options
+ */
+function findOutputFiles (bundleType, buildType, { arch } = {}) {
+ let files = glob.sync(`**/*.${bundleType}`, {
+ absolute: true,
+ cwd: path.resolve(this[`${bundleType}Dir`], buildType)
+ }).map(path.normalize);
+
+ if (files.length === 0) return files;
+
+ // Assume arch-specific build if newest apk has -x86 or -arm.
+ const archSpecific = isPathArchSpecific(files[0]);
+
+ // And show only arch-specific ones (or non-arch-specific)
+ files = files.filter(p => isPathArchSpecific(p) === archSpecific);
+
+ if (archSpecific && files.length > 1 && arch) {
+ files = files.filter(p => path.basename(p).includes('-' + arch));
+ }
+
+ return files.sort(outputFileComparator);
+}
+
+class ProjectBuilder {
+ constructor (rootDirectory) {
+ this.root = rootDirectory;
+ this.apkDir = path.join(this.root, 'app', 'build', 'outputs', 'apk');
+ this.aabDir = path.join(this.root, 'app', 'build', 'outputs', 'bundle');
+ }
+
+ getArgs (cmd, opts) {
+ let args;
+ let buildCmd = cmd;
+ if (opts.packageType === PackageType.BUNDLE) {
+ if (cmd === 'release') {
+ buildCmd = ':app:bundleRelease';
+ } else if (cmd === 'debug') {
+ buildCmd = ':app:bundleDebug';
+ }
+
+ args = [buildCmd, '-b', path.join(this.root, 'build.gradle')];
+ } else {
+ if (cmd === 'release') {
+ buildCmd = 'cdvBuildRelease';
+ } else if (cmd === 'debug') {
+ buildCmd = 'cdvBuildDebug';
+ }
+
+ args = [buildCmd, '-b', path.join(this.root, 'build.gradle')];
+
+ if (opts.arch) {
+ args.push('-PcdvBuildArch=' + opts.arch);
+ }
+ }
+
+ args.push.apply(args, opts.extraArgs);
+
+ return args;
+ }
+
+ /*
+ * This returns a promise
+ */
+ runGradleWrapper (gradle_cmd) {
+ var gradlePath = path.join(this.root, 'gradlew');
+ var wrapperGradle = path.join(this.root, 'wrapper.gradle');
+ if (fs.existsSync(gradlePath)) {
+ // Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
+ } else {
+ return execa(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], { stdio: 'inherit' });
+ }
+ }
+
+ readProjectProperties () {
+ function findAllUniq (data, r) {
+ var s = {};
+ var m;
+ while ((m = r.exec(data))) {
+ s[m[1]] = 1;
+ }
+ return Object.keys(s);
+ }
+
+ var data = fs.readFileSync(path.join(this.root, 'project.properties'), 'utf8');
+ return {
+ libs: findAllUniq(data, /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg),
+ gradleIncludes: findAllUniq(data, /^\s*cordova\.gradle\.include\.\d+=(.*)(?:\s|$)/mg),
+ systemLibs: findAllUniq(data, /^\s*cordova\.system\.library\.\d+=(.*)(?:\s|$)/mg)
+ };
+ }
+
+ extractRealProjectNameFromManifest () {
+ var manifestPath = path.join(this.root, 'app', 'src', 'main', 'AndroidManifest.xml');
+ var manifestData = fs.readFileSync(manifestPath, 'utf8');
+ var m = / {
+ const config = this._getCordovaConfig();
+ // update/set the distributionUrl in the gradle-wrapper.properties
+ const gradleWrapperPropertiesPath = path.join(self.root, 'gradle/wrapper/gradle-wrapper.properties');
+ const gradleWrapperProperties = createEditor(gradleWrapperPropertiesPath);
+ const distributionUrl = process.env.CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL || `https://services.gradle.org/distributions/gradle-${config.GRADLE_VERSION}-all.zip`;
+ gradleWrapperProperties.set('distributionUrl', distributionUrl);
+ gradleWrapperProperties.save();
+
+ events.emit('verbose', `Gradle Distribution URL: ${distributionUrl}`);
+ })
+ .then(() => {
+ const signingPropertiesPath = path.join(self.root, `${opts.buildType}${SIGNING_PROPERTIES}`);
+
+ if (fs.existsSync(signingPropertiesPath)) fs.removeSync(signingPropertiesPath);
+ if (opts.packageInfo) {
+ fs.ensureFileSync(signingPropertiesPath);
+ const signingProperties = createEditor(signingPropertiesPath);
+ signingProperties.addHeadComment(TEMPLATE);
+ opts.packageInfo.appendToProperties(signingProperties);
+ }
+ });
+ }
+
+ /**
+ * @private
+ * @returns The user defined configs
+ */
+ _getCordovaConfig () {
+ return fs.readJSONSync(path.join(this.root, 'cdv-gradle-config.json'));
+ }
+
+ /*
+ * Builds the project with gradle.
+ * Returns a promise.
+ */
+ async build (opts) {
+ var wrapper = path.join(this.root, 'gradlew');
+ var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
+
+ try {
+ return await execa(wrapper, args, { stdio: 'inherit', cwd: path.resolve(this.root) });
+ } catch (error) {
+ if (error.toString().includes('failed to find target with hash string')) {
+ // Add hint from check_android_target to error message
+ try {
+ await check_reqs.check_android_target(this.root);
+ } catch (checkAndroidTargetError) {
+ error.message += '\n' + checkAndroidTargetError.message;
+ }
+ }
+ throw error;
+ }
+ }
+
+ clean (opts) {
+ const wrapper = path.join(this.root, 'gradlew');
+ const args = this.getArgs('clean', opts);
+ return execa(wrapper, args, { stdio: 'inherit', cwd: path.resolve(this.root) })
+ .then(() => {
+ fs.removeSync(path.join(this.root, 'out'));
+
+ ['debug', 'release'].map(config => path.join(this.root, `${config}${SIGNING_PROPERTIES}`))
+ .forEach(file => {
+ const hasFile = fs.existsSync(file);
+ const hasMarker = hasFile && fs.readFileSync(file, 'utf8')
+ .includes(MARKER);
+
+ if (hasFile && hasMarker) fs.removeSync(file);
+ });
+ });
+ }
+
+ findOutputApks (build_type, arch) {
+ return findOutputFiles.call(this, 'apk', build_type, { arch });
+ }
+
+ findOutputBundles (build_type) {
+ return findOutputFiles.call(this, 'aab', build_type);
+ }
+
+ fetchBuildResults (build_type, arch) {
+ return {
+ apkPaths: this.findOutputApks(build_type, arch),
+ buildType: build_type
+ };
+ }
+}
+
+module.exports = ProjectBuilder;
diff --git a/node_modules/cordova-android/lib/builders/builders.js b/node_modules/cordova-android/lib/builders/builders.js
new file mode 100644
index 0000000..edc1a52
--- /dev/null
+++ b/node_modules/cordova-android/lib/builders/builders.js
@@ -0,0 +1,34 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const CordovaError = require('cordova-common').CordovaError;
+
+/**
+ * Helper method that instantiates and returns a builder for specified build type.
+ *
+ * @return {Builder} A builder instance for specified build type.
+ */
+module.exports.getBuilder = function (projectPath) {
+ try {
+ const Builder = require('./ProjectBuilder');
+ return new Builder(projectPath);
+ } catch (err) {
+ throw new CordovaError('Failed to instantiate ProjectBuilder builder: ' + err);
+ }
+};
diff --git a/node_modules/cordova-android/lib/builders/plugin-build.gradle b/node_modules/cordova-android/lib/builders/plugin-build.gradle
new file mode 100644
index 0000000..985f1d6
--- /dev/null
+++ b/node_modules/cordova-android/lib/builders/plugin-build.gradle
@@ -0,0 +1,69 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+// GENERATED FILE! DO NOT EDIT!
+
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ // Switch the Android Gradle plugin version requirement depending on the
+ // installed version of Gradle. This dependency is documented at
+ // http://tools.android.com/tech-docs/new-build-system/version-compatibility
+ // and https://issues.apache.org/jira/browse/CB-8143
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.0.0+'
+ }
+}
+
+apply plugin: 'com.android.library'
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: '*.jar')
+ debugCompile project(path: ":CordovaLib", configuration: "debug")
+ releaseCompile project(path: ":CordovaLib", configuration: "release")
+}
+
+android {
+ compileSdkVersion cordovaConfig.SDK_VERSION
+ buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_6
+ targetCompatibility JavaVersion.VERSION_1_6
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ jniLibs.srcDirs = ['libs']
+ }
+ }
+}
+
+if (file('build-extras.gradle').exists()) {
+ apply from: 'build-extras.gradle'
+}
diff --git a/node_modules/cordova-android/lib/check_reqs.js b/node_modules/cordova-android/lib/check_reqs.js
new file mode 100644
index 0000000..8c18db9
--- /dev/null
+++ b/node_modules/cordova-android/lib/check_reqs.js
@@ -0,0 +1,327 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const execa = require('execa');
+var path = require('path');
+var fs = require('fs-extra');
+const { forgivingWhichSync, isWindows, isDarwin } = require('./utils');
+const java = require('./env/java');
+const { CordovaError, ConfigParser, events } = require('cordova-common');
+var android_sdk = require('./android_sdk');
+const { SDK_VERSION } = require('./gradle-config-defaults');
+
+// Re-exporting these for backwards compatibility and for unit testing.
+// TODO: Remove uses and use the ./utils module directly.
+Object.assign(module.exports, { isWindows, isDarwin });
+
+/**
+ * @param {string} projectRoot
+ * @returns {string} The android target in format "android-${target}"
+ */
+module.exports.get_target = function (projectRoot) {
+ const userTargetSdkVersion = getUserTargetSdkVersion(projectRoot);
+
+ if (userTargetSdkVersion && userTargetSdkVersion < SDK_VERSION) {
+ events.emit('warn', `android-targetSdkVersion should be greater than or equal to ${SDK_VERSION}.`);
+ }
+
+ return `android-${Math.max(userTargetSdkVersion, SDK_VERSION)}`;
+};
+
+/**
+ * @param {string} projectRoot
+ * @returns {number} target sdk or 0 if undefined
+ */
+function getUserTargetSdkVersion (projectRoot) {
+ // If the repo config.xml file exists, find the desired targetSdkVersion.
+ // We need to use the cordova project's config.xml here, since the platform
+ // project's config.xml does not yet have the user's preferences when this
+ // function is called during `Api.createPlatform`.
+ const configFile = path.join(projectRoot, '../../config.xml');
+ if (!fs.existsSync(configFile)) return 0;
+
+ const configParser = new ConfigParser(configFile);
+ const targetSdkVersion = parseInt(configParser.getPreference('android-targetSdkVersion', 'android'), 10);
+ return isNaN(targetSdkVersion) ? 0 : targetSdkVersion;
+}
+
+module.exports.get_gradle_wrapper = function () {
+ var androidStudioPath;
+ var i = 0;
+ var foundStudio = false;
+ var program_dir;
+ // OK, This hack only works on Windows, not on Mac OS or Linux. We will be deleting this eventually!
+ if (module.exports.isWindows()) {
+ var result = execa.sync(path.join(__dirname, 'getASPath.bat'));
+ // console.log('result.stdout =' + result.stdout.toString());
+ // console.log('result.stderr =' + result.stderr.toString());
+
+ if (result.stderr.toString().length > 0) {
+ var androidPath = path.join(process.env.ProgramFiles, 'Android') + '/';
+ if (fs.existsSync(androidPath)) {
+ program_dir = fs.readdirSync(androidPath);
+ while (i < program_dir.length && !foundStudio) {
+ if (program_dir[i].startsWith('Android Studio')) {
+ foundStudio = true;
+ androidStudioPath = path.join(process.env.ProgramFiles, 'Android', program_dir[i], 'gradle');
+ } else { ++i; }
+ }
+ }
+ } else {
+ // console.log('got android studio path from registry');
+ // remove the (os independent) new line char at the end of stdout
+ // add gradle to match the above.
+ androidStudioPath = path.join(result.stdout.toString().split('\r\n')[0], 'gradle');
+ }
+ }
+
+ if (androidStudioPath !== null && fs.existsSync(androidStudioPath)) {
+ var dirs = fs.readdirSync(androidStudioPath);
+ if (dirs[0].split('-')[0] === 'gradle') {
+ return path.join(androidStudioPath, dirs[0], 'bin', 'gradle');
+ }
+ } else {
+ // OK, let's try to check for Gradle!
+ return forgivingWhichSync('gradle');
+ }
+};
+
+// Returns a promise. Called only by build and clean commands.
+module.exports.check_gradle = function () {
+ var sdkDir = process.env.ANDROID_SDK_ROOT || process.env.ANDROID_HOME;
+ if (!sdkDir) {
+ return Promise.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' +
+ 'Might need to install Android SDK or set up \'ANDROID_SDK_ROOT\' env variable.'));
+ }
+
+ var gradlePath = module.exports.get_gradle_wrapper();
+
+ if (gradlePath.length !== 0) return Promise.resolve(gradlePath);
+
+ return Promise.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' +
+ 'or on your system to install the gradle wrapper. Please include gradle \n' +
+ 'in your path, or install Android Studio'));
+};
+
+/**
+ * Checks for the java installation and correct version
+ *
+ * Despite the name, it should return the Java version value, it's used by the Cordova CLI.
+ */
+module.exports.check_java = async function () {
+ const javaVersion = await java.getVersion();
+ return javaVersion;
+};
+
+// Returns a promise.
+module.exports.check_android = function () {
+ return Promise.resolve().then(function () {
+ function maybeSetAndroidHome (value) {
+ if (!hasAndroidHome && fs.existsSync(value)) {
+ hasAndroidHome = true;
+ process.env.ANDROID_SDK_ROOT = value;
+ }
+ }
+
+ var adbInPath = forgivingWhichSync('adb');
+ var avdmanagerInPath = forgivingWhichSync('avdmanager');
+ var hasAndroidHome = false;
+
+ if (process.env.ANDROID_SDK_ROOT) {
+ maybeSetAndroidHome(path.resolve(process.env.ANDROID_SDK_ROOT));
+ }
+
+ // First ensure ANDROID_HOME is set
+ // If we have no hints (nothing in PATH), try a few default locations
+ if (!hasAndroidHome && !adbInPath && !avdmanagerInPath) {
+ if (process.env.ANDROID_HOME) {
+ // Fallback to deprecated `ANDROID_HOME` variable
+ maybeSetAndroidHome(path.join(process.env.ANDROID_HOME));
+ }
+ if (module.exports.isWindows()) {
+ // Android Studio 1.0 installer
+ if (process.env.LOCALAPPDATA) {
+ maybeSetAndroidHome(path.join(process.env.LOCALAPPDATA, 'Android', 'sdk'));
+ }
+ if (process.env.ProgramFiles) {
+ maybeSetAndroidHome(path.join(process.env.ProgramFiles, 'Android', 'sdk'));
+ }
+
+ // Android Studio pre-1.0 installer
+ if (process.env.LOCALAPPDATA) {
+ maybeSetAndroidHome(path.join(process.env.LOCALAPPDATA, 'Android', 'android-studio', 'sdk'));
+ }
+ if (process.env.ProgramFiles) {
+ maybeSetAndroidHome(path.join(process.env.ProgramFiles, 'Android', 'android-studio', 'sdk'));
+ }
+
+ // Stand-alone installer
+ if (process.env.LOCALAPPDATA) {
+ maybeSetAndroidHome(path.join(process.env.LOCALAPPDATA, 'Android', 'android-sdk'));
+ }
+ if (process.env.ProgramFiles) {
+ maybeSetAndroidHome(path.join(process.env.ProgramFiles, 'Android', 'android-sdk'));
+ }
+ } else if (module.exports.isDarwin()) {
+ // Android Studio 1.0 installer
+ if (process.env.HOME) {
+ maybeSetAndroidHome(path.join(process.env.HOME, 'Library', 'Android', 'sdk'));
+ }
+ // Android Studio pre-1.0 installer
+ maybeSetAndroidHome('/Applications/Android Studio.app/sdk');
+ // Stand-alone zip file that user might think to put under /Applications
+ maybeSetAndroidHome('/Applications/android-sdk-macosx');
+ maybeSetAndroidHome('/Applications/android-sdk');
+ }
+ if (process.env.HOME) {
+ // Stand-alone zip file that user might think to put under their home directory
+ maybeSetAndroidHome(path.join(process.env.HOME, 'android-sdk-macosx'));
+ maybeSetAndroidHome(path.join(process.env.HOME, 'android-sdk'));
+ }
+ }
+
+ if (!hasAndroidHome) {
+ // If we dont have ANDROID_SDK_ROOT, but we do have some tools on the PATH, try to infer from the tooling PATH.
+ var parentDir, grandParentDir;
+ if (adbInPath) {
+ parentDir = path.dirname(adbInPath);
+ grandParentDir = path.dirname(parentDir);
+ if (path.basename(parentDir) === 'platform-tools') {
+ maybeSetAndroidHome(grandParentDir);
+ } else {
+ throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
+ 'Detected \'adb\' command at ' + parentDir + ' but no \'platform-tools\' directory found near.\n' +
+ 'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'platform-tools directory.');
+ }
+ }
+ if (avdmanagerInPath) {
+ parentDir = path.dirname(avdmanagerInPath);
+ grandParentDir = path.dirname(parentDir);
+ if (path.basename(parentDir) === 'bin' && path.basename(grandParentDir) === 'tools') {
+ maybeSetAndroidHome(path.dirname(grandParentDir));
+ } else {
+ throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
+ 'Detected \'avdmanager\' command at ' + parentDir + ' but no \'tools' + path.sep + 'bin\' directory found near.\n' +
+ 'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools' + path.sep + 'bin directory.');
+ }
+ }
+ }
+ if (!process.env.ANDROID_SDK_ROOT) {
+ throw new CordovaError('Failed to find \'ANDROID_SDK_ROOT\' environment variable. Try setting it manually.\n' +
+ 'Failed to find \'android\' command in your \'PATH\'. Try update your \'PATH\' to include path to valid SDK directory.');
+ }
+ if (!fs.existsSync(process.env.ANDROID_SDK_ROOT)) {
+ throw new CordovaError('\'ANDROID_SDK_ROOT\' environment variable is set to non-existent path: ' + process.env.ANDROID_SDK_ROOT +
+ '\nTry update it manually to point to valid SDK directory.');
+ }
+ // Next let's make sure relevant parts of the SDK tooling is in our PATH
+ if (hasAndroidHome && !adbInPath) {
+ process.env.PATH += path.delimiter + path.join(process.env.ANDROID_SDK_ROOT, 'platform-tools');
+ }
+ if (hasAndroidHome && !avdmanagerInPath) {
+ process.env.PATH += path.delimiter + path.join(process.env.ANDROID_SDK_ROOT, 'tools', 'bin');
+ }
+ return hasAndroidHome;
+ });
+};
+
+module.exports.check_android_target = function (projectRoot) {
+ // valid_target can look like:
+ // android-19
+ // android-L
+ // Google Inc.:Google APIs:20
+ // Google Inc.:Glass Development Kit Preview:20
+ var desired_api_level = module.exports.get_target(projectRoot);
+ return android_sdk.list_targets().then(function (targets) {
+ if (targets.indexOf(desired_api_level) >= 0) {
+ return targets;
+ }
+ throw new CordovaError(`Please install the Android SDK Platform "platforms;${desired_api_level}"`);
+ });
+};
+
+// Returns a promise.
+module.exports.run = function () {
+ console.log('Checking Java JDK and Android SDK versions');
+ console.log('ANDROID_SDK_ROOT=' + process.env.ANDROID_SDK_ROOT + ' (recommended setting)');
+ console.log('ANDROID_HOME=' + process.env.ANDROID_HOME + ' (DEPRECATED)');
+
+ return Promise.all([this.check_java(), this.check_android()]).then(function (values) {
+ console.log('Using Android SDK: ' + process.env.ANDROID_SDK_ROOT);
+
+ if (!values[1]) {
+ throw new CordovaError('Requirements check failed for Android SDK! Android SDK was not detected.');
+ }
+ });
+};
+
+/**
+ * Object thar represents one of requirements for current platform.
+ * @param {String} id The unique identifier for this requirements.
+ * @param {String} name The name of requirements. Human-readable field.
+ * @param {String} version The version of requirement installed. In some cases could be an array of strings
+ * (for example, check_android_target returns an array of android targets installed)
+ * @param {Boolean} installed Indicates whether the requirement is installed or not
+ */
+var Requirement = function (id, name, version, installed) {
+ this.id = id;
+ this.name = name;
+ this.installed = installed || false;
+ this.metadata = {
+ version: version
+ };
+};
+
+/**
+ * Methods that runs all checks one by one and returns a result of checks
+ * as an array of Requirement objects. This method intended to be used by cordova-lib check_reqs method
+ *
+ * @param {string} projectRoot
+ * @return Promise Array of requirements. Due to implementation, promise is always fulfilled.
+ */
+module.exports.check_all = function (projectRoot) {
+ var requirements = [
+ new Requirement('java', 'Java JDK'),
+ new Requirement('androidSdk', 'Android SDK'),
+ new Requirement('androidTarget', 'Android target'),
+ new Requirement('gradle', 'Gradle')
+ ];
+
+ var checkFns = [
+ this.check_java,
+ this.check_android,
+ this.check_android_target.bind(this, projectRoot),
+ this.check_gradle
+ ];
+
+ // Then execute requirement checks one-by-one
+ return checkFns.reduce(function (promise, checkFn, idx) {
+ // Update each requirement with results
+ var requirement = requirements[idx];
+ return promise.then(checkFn).then(function (version) {
+ requirement.installed = true;
+ requirement.metadata.version = version;
+ }, function (err) {
+ requirement.metadata.reason = err instanceof Error ? err.message : err;
+ });
+ }, Promise.resolve()).then(function () {
+ // When chain is completed, return requirements array to upstream API
+ return requirements;
+ });
+};
diff --git a/node_modules/cordova-android/lib/config/GradlePropertiesParser.js b/node_modules/cordova-android/lib/config/GradlePropertiesParser.js
new file mode 100644
index 0000000..9189a91
--- /dev/null
+++ b/node_modules/cordova-android/lib/config/GradlePropertiesParser.js
@@ -0,0 +1,147 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const fs = require('fs');
+const path = require('path');
+const propertiesParser = require('properties-parser');
+const events = require('cordova-common').events;
+
+class GradlePropertiesParser {
+ /**
+ * Loads and Edits Gradle Properties File.
+ *
+ * @param {String} platformDir is the path of the Android platform directory
+ */
+ constructor (platformDir) {
+ this._defaults = {
+ // to allow dex in process
+ 'org.gradle.jvmargs': '-Xmx2048m',
+
+ // Android X
+ 'android.useAndroidX': 'true',
+ 'android.enableJetifier': 'true'
+
+ // Shaves another 100ms, but produces a "try at own risk" warning. Not worth it (yet):
+ // 'org.gradle.parallel': 'true'
+ };
+
+ this.gradleFilePath = path.join(platformDir, 'gradle.properties');
+ }
+
+ configure (userConfigs) {
+ events.emit('verbose', '[Gradle Properties] Preparing Configuration');
+
+ this._initializeEditor();
+
+ events.emit('verbose', '[Gradle Properties] Appending default configuration properties');
+ this._configureProperties(this._defaults);
+
+ events.emit('verbose', '[Gradle Properties] Appending custom configuration properties');
+ this._configureProperties(userConfigs);
+
+ this._save();
+ }
+
+ /**
+ * Initialize the properties editor for parsing, setting, etc.
+ */
+ _initializeEditor () {
+ // Touch empty gradle.properties file if missing.
+ if (!fs.existsSync(this.gradleFilePath)) {
+ events.emit('verbose', '[Gradle Properties] File missing, creating file with Cordova defaults.');
+ fs.writeFileSync(this.gradleFilePath, '', 'utf-8');
+ }
+
+ // Create an editor for parsing, getting, and setting configurations.
+ this.gradleFile = propertiesParser.createEditor(this.gradleFilePath);
+ }
+
+ /**
+ * Validate that defaults or user configuration properties are set and
+ * set the missing items.
+ */
+ _configureProperties (properties) {
+ // Iterate though the properties and set only if missing.
+ Object.keys(properties).forEach(key => {
+ const value = this.gradleFile.get(key);
+
+ if (!value) {
+ // Handles the case of adding missing defaults or new properties that are missing.
+ events.emit('verbose', `[Gradle Properties] Appending configuration item: ${key}=${properties[key]}`);
+ this.gradleFile.set(key, properties[key]);
+ } else if (value !== properties[key]) {
+ if (this._defaults[key] && this._defaults[key] !== properties[key]) {
+ let shouldEmit = true;
+ if (key === 'org.gradle.jvmargs') {
+ shouldEmit = this._isJVMMemoryLessThanRecommended(properties[key], this._defaults[key]);
+ }
+
+ if (shouldEmit) {
+ // Since the value does not match default, we will notify the discrepancy with Cordova's recommended value.
+ events.emit('info', `[Gradle Properties] Detected Gradle property "${key}" with the value of "${properties[key]}", Cordova's recommended value is "${this._defaults[key]}"`);
+ }
+ } else {
+ // When the current value exists but does not match the new value or does matches the default key value, the new value it set.
+ events.emit('verbose', `[Gradle Properties] Updating Gradle property "${key}" with the value of "${properties[key]}"`);
+ }
+
+ // We will set the new value in either case.
+ this.gradleFile.set(key, properties[key]);
+ }
+ });
+ }
+
+ _isJVMMemoryLessThanRecommended (memoryValue, recommendedMemoryValue) {
+ const UNIT = 2;
+ const SIZE = 1;
+ const regex = /-Xmx+([0-9]+)+([mMgGkK])/;
+
+ const recommendedCapture = regex.exec(recommendedMemoryValue);
+ const recommendedBase = this._getBaseJVMSize(recommendedCapture[SIZE], recommendedCapture[UNIT]);
+ const memoryCapture = regex.exec(memoryValue);
+ const memoryBase = this._getBaseJVMSize(memoryCapture[SIZE], memoryCapture[UNIT]);
+
+ return memoryBase < recommendedBase;
+ }
+
+ _getBaseJVMSize (size, unit) {
+ const KILOBYTE = 1024;
+ const MEGABYTE = 1048576;
+ const GIGABYTE = 1073741824;
+
+ switch (unit.toLowerCase()) {
+ case 'k': return size * KILOBYTE;
+ case 'm': return size * MEGABYTE;
+ case 'g': return size * GIGABYTE;
+ }
+
+ events.emit('warn', `[Gradle Properties] Unknown memory size unit (${unit})`);
+ return null;
+ }
+
+ /**
+ * Saves any changes that has been made to the properties file.
+ */
+ _save () {
+ events.emit('verbose', '[Gradle Properties] Updating and Saving File');
+ this.gradleFile.save();
+ }
+}
+
+module.exports = GradlePropertiesParser;
diff --git a/node_modules/cordova-android/lib/create.js b/node_modules/cordova-android/lib/create.js
new file mode 100644
index 0000000..da75631
--- /dev/null
+++ b/node_modules/cordova-android/lib/create.js
@@ -0,0 +1,300 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var path = require('path');
+var fs = require('fs-extra');
+var utils = require('./utils');
+var check_reqs = require('./check_reqs');
+var ROOT = path.join(__dirname, '..');
+const { createEditor } = require('properties-parser');
+
+var CordovaError = require('cordova-common').CordovaError;
+var AndroidManifest = require('./AndroidManifest');
+
+// Export all helper functions, and make sure internally within this module, we
+// reference these methods via the `exports` object - this helps with testing
+// (since we can then mock and control behaviour of all of these functions)
+exports.validatePackageName = validatePackageName;
+exports.validateProjectName = validateProjectName;
+exports.copyJsAndLibrary = copyJsAndLibrary;
+exports.copyScripts = copyScripts;
+exports.copyBuildRules = copyBuildRules;
+exports.writeProjectProperties = writeProjectProperties;
+exports.prepBuildFiles = prepBuildFiles;
+
+function getFrameworkDir (projectPath, shared) {
+ return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
+}
+
+function copyJsAndLibrary (projectPath, shared, projectName, targetAPI) {
+ var nestedCordovaLibPath = getFrameworkDir(projectPath, false);
+ var srcCordovaJsPath = path.join(ROOT, 'templates', 'project', 'assets', 'www', 'cordova.js');
+ var app_path = path.join(projectPath, 'app', 'src', 'main');
+ const platform_www = path.join(projectPath, 'platform_www');
+
+ fs.copySync(srcCordovaJsPath, path.join(app_path, 'assets', 'www', 'cordova.js'));
+
+ // Copy the cordova.js file to platforms//platform_www/
+ // The www dir is nuked on each prepare so we keep cordova.js in platform_www
+ fs.ensureDirSync(platform_www);
+ fs.copySync(srcCordovaJsPath, path.join(platform_www, 'cordova.js'));
+
+ if (shared) {
+ var relativeFrameworkPath = path.relative(projectPath, getFrameworkDir(projectPath, true));
+ fs.symlinkSync(relativeFrameworkPath, nestedCordovaLibPath, 'dir');
+ } else {
+ fs.ensureDirSync(nestedCordovaLibPath);
+ fs.copySync(path.join(ROOT, 'framework', 'AndroidManifest.xml'), path.join(nestedCordovaLibPath, 'AndroidManifest.xml'));
+ const propertiesEditor = createEditor(path.join(ROOT, 'framework', 'project.properties'));
+ propertiesEditor.set('target', targetAPI);
+ propertiesEditor.save(path.join(nestedCordovaLibPath, 'project.properties'));
+ fs.copySync(path.join(ROOT, 'framework', 'build.gradle'), path.join(nestedCordovaLibPath, 'build.gradle'));
+ fs.copySync(path.join(ROOT, 'framework', 'cordova.gradle'), path.join(nestedCordovaLibPath, 'cordova.gradle'));
+ fs.copySync(path.join(ROOT, 'framework', 'repositories.gradle'), path.join(nestedCordovaLibPath, 'repositories.gradle'));
+ fs.copySync(path.join(ROOT, 'framework', 'src'), path.join(nestedCordovaLibPath, 'src'));
+ fs.copySync(path.join(ROOT, 'framework', 'cdv-gradle-config-defaults.json'), path.join(projectPath, 'cdv-gradle-config.json'));
+ }
+}
+
+function extractSubProjectPaths (data) {
+ var ret = {};
+ var r = /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg;
+ var m;
+ while ((m = r.exec(data))) {
+ ret[m[1]] = 1;
+ }
+ return Object.keys(ret);
+}
+
+function writeProjectProperties (projectPath, target_api) {
+ var dstPath = path.join(projectPath, 'project.properties');
+ var templatePath = path.join(ROOT, 'templates', 'project', 'project.properties');
+ var srcPath = fs.existsSync(dstPath) ? dstPath : templatePath;
+
+ var data = fs.readFileSync(srcPath, 'utf8');
+ data = data.replace(/^target=.*/m, 'target=' + target_api);
+ var subProjects = extractSubProjectPaths(data);
+ subProjects = subProjects.filter(function (p) {
+ return !(/^CordovaLib$/m.exec(p) ||
+ /[\\/]cordova-android[\\/]framework$/m.exec(p) ||
+ /^(\.\.[\\/])+framework$/m.exec(p));
+ });
+ subProjects.unshift('CordovaLib');
+ data = data.replace(/^\s*android\.library\.reference\.\d+=.*\n/mg, '');
+ if (!/\n$/.exec(data)) {
+ data += '\n';
+ }
+ for (var i = 0; i < subProjects.length; ++i) {
+ data += 'android.library.reference.' + (i + 1) + '=' + subProjects[i] + '\n';
+ }
+ fs.writeFileSync(dstPath, data);
+}
+
+// This makes no sense, what if you're building with a different build system?
+function prepBuildFiles (projectPath) {
+ var buildModule = require('./builders/builders');
+ buildModule.getBuilder(projectPath).prepBuildFiles();
+}
+
+function copyBuildRules (projectPath, isLegacy) {
+ var srcDir = path.join(ROOT, 'templates', 'project');
+
+ if (isLegacy) {
+ // The project's build.gradle is identical to the earlier build.gradle, so it should still work
+ fs.copySync(path.join(srcDir, 'legacy', 'build.gradle'), path.join(projectPath, 'legacy', 'build.gradle'));
+ fs.copySync(path.join(srcDir, 'wrapper.gradle'), path.join(projectPath, 'wrapper.gradle'));
+ } else {
+ fs.copySync(path.join(srcDir, 'build.gradle'), path.join(projectPath, 'build.gradle'));
+ fs.copySync(path.join(srcDir, 'app', 'build.gradle'), path.join(projectPath, 'app', 'build.gradle'));
+ fs.copySync(path.join(srcDir, 'app', 'repositories.gradle'), path.join(projectPath, 'app', 'repositories.gradle'));
+ fs.copySync(path.join(srcDir, 'repositories.gradle'), path.join(projectPath, 'repositories.gradle'));
+ fs.copySync(path.join(srcDir, 'wrapper.gradle'), path.join(projectPath, 'wrapper.gradle'));
+ }
+}
+
+function copyScripts (projectPath) {
+ var srcScriptsDir = path.join(ROOT, 'templates', 'cordova');
+ var destScriptsDir = path.join(projectPath, 'cordova');
+ // Delete old scripts directory if this is an update.
+ fs.removeSync(destScriptsDir);
+ // Copy in the new ones.
+ fs.copySync(srcScriptsDir, destScriptsDir);
+}
+
+/**
+ * Test whether a package name is acceptable for use as an android project.
+ * Returns a promise, fulfilled if the package name is acceptable; rejected
+ * otherwise.
+ */
+function validatePackageName (package_name) {
+ // Make the package conform to Java package types
+ // http://developer.android.com/guide/topics/manifest/manifest-element.html#package
+ // Enforce underscore limitation
+ var msg = 'Error validating package name. ';
+
+ if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
+ return Promise.reject(new CordovaError(msg + 'Must look like: `com.company.Name`. Currently is: `' + package_name + '`'));
+ }
+
+ // Class is a reserved word
+ if (/\b[Cc]lass\b/.test(package_name)) {
+ return Promise.reject(new CordovaError(msg + '"class" is a reserved word'));
+ }
+
+ return Promise.resolve();
+}
+
+/**
+ * Test whether given string is acceptable for use as a project name
+ * Returns a promise, fulfilled if the project name is acceptable; rejected
+ * otherwise.
+ */
+function validateProjectName (project_name) {
+ var msg = 'Error validating project name. ';
+ // Make sure there's something there
+ if (project_name === '') {
+ return Promise.reject(new CordovaError(msg + 'Project name cannot be empty'));
+ }
+
+ return Promise.resolve();
+}
+
+/**
+ * Creates an android application with the given options.
+ *
+ * @param {String} project_path Path to the new Cordova android project.
+ * @param {ConfigParser} config Instance of ConfigParser to retrieve basic
+ * project properties.
+ * @param {Object} [options={}] Various options
+ * @param {String} [options.activityName='MainActivity'] Name for the
+ * activity
+ * @param {Boolean} [options.link=false] Specifies whether javascript files
+ * and CordovaLib framework will be symlinked to created application.
+ * @param {String} [options.customTemplate] Path to project template
+ * (override)
+ * @param {EventEmitter} [events] An EventEmitter instance for logging
+ * events
+ *
+ * @return {Promise} Directory where application has been created
+ */
+exports.create = function (project_path, config, options, events) {
+ options = options || {};
+
+ // Set default values for path, package and name
+ project_path = path.relative(process.cwd(), project_path);
+ // Check if project already exists
+ if (fs.existsSync(project_path)) {
+ return Promise.reject(new CordovaError('Project already exists! Delete and recreate'));
+ }
+
+ var package_name = config.android_packageName() || config.packageName() || 'io.cordova.helloCordova';
+ var project_name = config.name() || 'Hello Cordova';
+
+ var safe_activity_name = config.android_activityName() || options.activityName || 'MainActivity';
+ var target_api = check_reqs.get_target(project_path);
+
+ // Make the package conform to Java package types
+ return exports.validatePackageName(package_name)
+ .then(function () {
+ return exports.validateProjectName(project_name);
+ }).then(function () {
+ // Log the given values for the project
+ events.emit('log', 'Creating Cordova project for the Android platform:');
+ events.emit('log', '\tPath: ' + project_path);
+ events.emit('log', '\tPackage: ' + package_name);
+ events.emit('log', '\tName: ' + project_name);
+ events.emit('log', '\tActivity: ' + safe_activity_name);
+ events.emit('log', '\tAndroid target: ' + target_api);
+
+ events.emit('verbose', 'Copying android template project to ' + project_path);
+
+ var project_template_dir = options.customTemplate || path.join(ROOT, 'templates', 'project');
+ var app_path = path.join(project_path, 'app', 'src', 'main');
+
+ // copy project template
+ fs.ensureDirSync(app_path);
+ fs.copySync(path.join(project_template_dir, 'assets'), path.join(app_path, 'assets'));
+ fs.copySync(path.join(project_template_dir, 'res'), path.join(app_path, 'res'));
+ fs.copySync(path.join(project_template_dir, 'gitignore'), path.join(project_path, '.gitignore'));
+
+ // Manually create directories that would be empty within the template (since git doesn't track directories).
+ fs.ensureDirSync(path.join(app_path, 'libs'));
+
+ // copy cordova.js, cordova.jar
+ exports.copyJsAndLibrary(project_path, options.link, safe_activity_name, target_api);
+
+ // Set up ther Android Studio paths
+ var java_path = path.join(app_path, 'java');
+ var assets_path = path.join(app_path, 'assets');
+ var resource_path = path.join(app_path, 'res');
+ fs.ensureDirSync(java_path);
+ fs.ensureDirSync(assets_path);
+ fs.ensureDirSync(resource_path);
+
+ // interpolate the activity name and package
+ var packagePath = package_name.replace(/\./g, path.sep);
+ var activity_dir = path.join(java_path, packagePath);
+ var activity_path = path.join(activity_dir, safe_activity_name + '.java');
+
+ fs.ensureDirSync(activity_dir);
+ fs.copySync(path.join(project_template_dir, 'Activity.java'), activity_path);
+ utils.replaceFileContents(activity_path, /__ACTIVITY__/, safe_activity_name);
+ utils.replaceFileContents(path.join(app_path, 'res', 'values', 'strings.xml'), /__NAME__/, utils.escape(project_name));
+ utils.replaceFileContents(activity_path, /__ID__/, package_name);
+
+ var manifest = new AndroidManifest(path.join(project_template_dir, 'AndroidManifest.xml'));
+ manifest.setPackageId(package_name)
+ .getActivity().setName(safe_activity_name);
+
+ var manifest_path = path.join(app_path, 'AndroidManifest.xml');
+ manifest.write(manifest_path);
+
+ exports.copyScripts(project_path);
+ exports.copyBuildRules(project_path);
+
+ // Link it to local android install.
+ exports.writeProjectProperties(project_path, target_api);
+ exports.prepBuildFiles(project_path);
+ events.emit('log', generateDoneMessage('create', options.link));
+ }).then(() => project_path);
+};
+
+function generateDoneMessage (type, link) {
+ var pkg = require('../package');
+ var msg = 'Android project ' + (type === 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version;
+ if (link) {
+ msg += ' and has a linked CordovaLib';
+ }
+ return msg;
+}
+
+// Returns a promise.
+exports.update = function (projectPath, options, events) {
+ var errorString =
+ 'An in-place platform update is not supported. \n' +
+ 'The `platforms` folder is always treated as a build artifact in the CLI workflow.\n' +
+ 'To update your platform, you have to remove, then add your android platform again.\n' +
+ 'Make sure you save your plugins beforehand using `cordova plugin save`, and save \n' + 'a copy of the platform first if you had manual changes in it.\n' +
+ '\tcordova plugin save\n' +
+ '\tcordova platform rm android\n' +
+ '\tcordova platform add android\n'
+ ;
+
+ return Promise.reject(errorString);
+};
diff --git a/node_modules/cordova-android/lib/emulator.js b/node_modules/cordova-android/lib/emulator.js
new file mode 100644
index 0000000..c2834f6
--- /dev/null
+++ b/node_modules/cordova-android/lib/emulator.js
@@ -0,0 +1,293 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const execa = require('execa');
+const fs = require('fs-extra');
+var android_versions = require('android-versions');
+var path = require('path');
+var Adb = require('./Adb');
+var events = require('cordova-common').events;
+var CordovaError = require('cordova-common').CordovaError;
+var android_sdk = require('./android_sdk');
+var which = require('which');
+
+// constants
+const ONE_SECOND = 1000; // in milliseconds
+const CHECK_BOOTED_INTERVAL = 3 * ONE_SECOND; // in milliseconds
+
+function forgivingWhichSync (cmd) {
+ const whichResult = which.sync(cmd, { nothrow: true });
+
+ // On null, returns empty string to maintain backwards compatibility
+ // realpathSync follows symlinks
+ return whichResult === null ? '' : fs.realpathSync(whichResult);
+}
+
+module.exports.list_images_using_avdmanager = function () {
+ return execa('avdmanager', ['list', 'avd']).then(({ stdout: output }) => {
+ var response = output.split('\n');
+ var emulator_list = [];
+ for (var i = 1; i < response.length; i++) {
+ // To return more detailed information use img_obj
+ var img_obj = {};
+ if (response[i].match(/Name:\s/)) {
+ img_obj.name = response[i].split('Name: ')[1].replace('\r', '');
+ if (response[i + 1].match(/Device:\s/)) {
+ i++;
+ img_obj.device = response[i].split('Device: ')[1].replace('\r', '');
+ }
+ if (response[i + 1].match(/Path:\s/)) {
+ i++;
+ img_obj.path = response[i].split('Path: ')[1].replace('\r', '');
+ }
+ if (response[i + 1].match(/Target:\s/)) {
+ i++;
+ if (response[i + 1].match(/ABI:\s/)) {
+ img_obj.abi = response[i + 1].split('ABI: ')[1].replace('\r', '');
+ }
+ // This next conditional just aims to match the old output of `android list avd`
+ // We do so so that we don't have to change the logic when parsing for the
+ // best emulator target to spawn (see below in `best_image`)
+ // This allows us to transitionally support both `android` and `avdmanager` binaries,
+ // depending on what SDK version the user has
+ if (response[i + 1].match(/Based\son:\s/)) {
+ img_obj.target = response[i + 1].split('Based on:')[1];
+ if (img_obj.target.match(/Tag\/ABI:\s/)) {
+ img_obj.target = img_obj.target.split('Tag/ABI:')[0].replace('\r', '').trim();
+ if (img_obj.target.indexOf('(') > -1) {
+ img_obj.target = img_obj.target.substr(0, img_obj.target.indexOf('(') - 1).trim();
+ }
+ }
+ var version_string = img_obj.target.replace(/Android\s+/, '');
+
+ var api_level = android_sdk.version_string_to_api_level[version_string];
+ if (api_level) {
+ img_obj.target += ' (API level ' + api_level + ')';
+ }
+ }
+ }
+ if (response[i + 1].match(/Skin:\s/)) {
+ i++;
+ img_obj.skin = response[i].split('Skin: ')[1].replace('\r', '');
+ }
+
+ emulator_list.push(img_obj);
+ }
+ /* To just return a list of names use this
+ if (response[i].match(/Name:\s/)) {
+ emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
+ } */
+ }
+ return emulator_list;
+ });
+};
+
+/**
+ * Returns a Promise for a list of emulator images in the form of objects
+ * {
+ name : ,
+ device : ,
+ path : ,
+ target : ,
+ abi : ,
+ skin :
+ }
+ */
+module.exports.list_images = function () {
+ return Promise.resolve().then(function () {
+ if (forgivingWhichSync('avdmanager')) {
+ return module.exports.list_images_using_avdmanager();
+ } else {
+ return Promise.reject(new CordovaError('Could not find `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?'));
+ }
+ }).then(function (avds) {
+ // In case we're missing the Android OS version string from the target description, add it.
+ return avds.map(function (avd) {
+ if (avd.target && avd.target.indexOf('Android API') > -1 && avd.target.indexOf('API level') < 0) {
+ var api_level = avd.target.match(/\d+/);
+ if (api_level) {
+ var level = android_versions.get(api_level);
+ if (level) {
+ avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
+ }
+ }
+ }
+ return avd;
+ });
+ });
+};
+
+/**
+ * Returns the best image (if any) for given target.
+ *
+ * @param {Number} project_target Android targetSDK API level
+ * @return {{name: string} | undefined} the closest avd to the given target
+ * or undefined if no avds exist.
+ */
+module.exports.best_image = function (project_target) {
+ return this.list_images().then(function (images) {
+ // Just return undefined if there is no images
+ if (images.length === 0) return;
+
+ var closest = 9999;
+ var best = images[0];
+ for (var i in images) {
+ var target = images[i].target;
+ if (target && target.indexOf('API level') > -1) {
+ var num = parseInt(target.split('(API level ')[1].replace(')', ''));
+ if (num === project_target) {
+ return images[i];
+ } else if (project_target - num < closest && project_target > num) {
+ closest = project_target - num;
+ best = images[i];
+ }
+ }
+ }
+ return best;
+ });
+};
+
+exports.list_started = async () => {
+ return (await Adb.devices())
+ .filter(id => id.startsWith('emulator-'));
+};
+
+/*
+ * Gets unused port for android emulator, between 5554 and 5584
+ * Returns a promise.
+ */
+module.exports.get_available_port = function () {
+ var self = this;
+
+ return self.list_started().then(function (emulators) {
+ for (var p = 5584; p >= 5554; p -= 2) {
+ if (emulators.indexOf('emulator-' + p) === -1) {
+ events.emit('verbose', 'Found available port: ' + p);
+ return p;
+ }
+ }
+ throw new CordovaError('Could not find an available avd port');
+ });
+};
+
+/*
+ * Starts an emulator with the given ID,
+ * and returns the started ID of that emulator.
+ * If no boot timeout is given or the value is negative it will wait forever for
+ * the emulator to boot
+ *
+ * Returns a promise.
+ */
+module.exports.start = function (emulatorId, boot_timeout) {
+ var self = this;
+
+ return Promise.resolve().then(function () {
+ if (!emulatorId) {
+ throw new CordovaError('No emulator ID given');
+ }
+
+ return self.get_available_port().then(function (port) {
+ // Figure out the directory the emulator binary runs in, and set the cwd to that directory.
+ // Workaround for https://code.google.com/p/android/issues/detail?id=235461
+ var emulator_dir = path.dirname(which.sync('emulator'));
+ var args = ['-avd', emulatorId, '-port', port];
+ // Don't wait for it to finish, since the emulator will probably keep running for a long time.
+ execa('emulator', args, { stdio: 'inherit', detached: true, cwd: emulator_dir })
+ .unref();
+
+ // wait for emulator to start
+ events.emit('log', 'Waiting for emulator to start...');
+ return self.wait_for_emulator(port);
+ });
+ }).then(function (emulatorId) {
+ if (!emulatorId) { return Promise.reject(new CordovaError('Failed to start emulator')); }
+
+ // wait for emulator to boot up
+ process.stdout.write('Waiting for emulator to boot (this may take a while)...');
+ return self.wait_for_boot(emulatorId, boot_timeout).then(function (success) {
+ if (success) {
+ events.emit('log', 'BOOT COMPLETE');
+ // unlock screen
+ return Adb.shell(emulatorId, 'input keyevent 82').then(function () {
+ // return the new emulator id for the started emulators
+ return emulatorId;
+ });
+ } else {
+ // We timed out waiting for the boot to happen
+ return null;
+ }
+ });
+ });
+};
+
+/*
+ * Waits for an emulator to boot on a given port.
+ * Returns this emulator's ID in a promise.
+ */
+module.exports.wait_for_emulator = function (port) {
+ var self = this;
+ return Promise.resolve().then(function () {
+ var emulator_id = 'emulator-' + port;
+ return Adb.shell(emulator_id, 'getprop dev.bootcomplete').then(function (output) {
+ if (output.indexOf('1') >= 0) {
+ return emulator_id;
+ }
+ return self.wait_for_emulator(port);
+ }, function (error) {
+ if ((error && error.message &&
+ (error.message.indexOf('not found') > -1)) ||
+ (error.message.indexOf('device offline') > -1) ||
+ (error.message.indexOf('device still connecting') > -1) ||
+ (error.message.indexOf('device still authorizing') > -1)) {
+ // emulator not yet started, continue waiting
+ return self.wait_for_emulator(port);
+ } else {
+ // something unexpected has happened
+ throw error;
+ }
+ });
+ });
+};
+
+/*
+ * Waits for the core android process of the emulator to start. Returns a
+ * promise that resolves to a boolean indicating success. Not specifying a
+ * time_remaining or passing a negative value will cause it to wait forever
+ */
+module.exports.wait_for_boot = function (emulator_id, time_remaining) {
+ var self = this;
+ return Adb.shell(emulator_id, 'getprop sys.boot_completed').then(function (output) {
+ if (output.match(/1/)) {
+ return true;
+ } else if (time_remaining === 0) {
+ return false;
+ } else {
+ process.stdout.write('.');
+
+ return new Promise(resolve => {
+ const delay = time_remaining < CHECK_BOOTED_INTERVAL ? time_remaining : CHECK_BOOTED_INTERVAL;
+
+ setTimeout(() => {
+ const updated_time = time_remaining >= 0 ? Math.max(time_remaining - CHECK_BOOTED_INTERVAL, 0) : time_remaining;
+ resolve(self.wait_for_boot(emulator_id, updated_time));
+ }, delay);
+ });
+ }
+ });
+};
diff --git a/node_modules/cordova-android/lib/env/java.js b/node_modules/cordova-android/lib/env/java.js
new file mode 100644
index 0000000..5bd75cb
--- /dev/null
+++ b/node_modules/cordova-android/lib/env/java.js
@@ -0,0 +1,129 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const execa = require('execa');
+const fs = require('fs-extra');
+const path = require('path');
+const glob = require('fast-glob');
+const { CordovaError, events } = require('cordova-common');
+const utils = require('../utils');
+const semver = require('semver');
+
+/**
+ * Will be set to true on successful ensureness.
+ * If true, skips the expensive java checks.
+ */
+let javaIsEnsured = false;
+
+const java = {
+ /**
+ * Gets the version from the javac executable.
+ *
+ * @returns {semver.SemVer}
+ */
+ getVersion: async () => {
+ await java._ensure(process.env);
+
+ // Java <= 8 writes version info to stderr, Java >= 9 to stdout
+ let javacOutput;
+ try {
+ javacOutput = (await execa('javac', ['-version'], { all: true })).all;
+ } catch (ex) {
+ events.emit('verbose', ex.shortMessage);
+
+ let msg =
+ 'Failed to run "javac -version", make sure that you have a JDK version 8 installed.\n' +
+ 'You can get it from the following location:\n' +
+ 'https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html';
+ if (process.env.JAVA_HOME) {
+ msg += '\n\n';
+ msg += 'Your JAVA_HOME is invalid: ' + process.env.JAVA_HOME;
+ }
+ throw new CordovaError(msg);
+ }
+
+ // We have to filter the output, because javac prints _JAVA_OPTIONS
+ // before printing the version which causes semver.coerce to fail to get
+ // the correct version if those options contain any numbers.
+ const match = /javac\s+([\d.]+)/i.exec(javacOutput);
+ return semver.coerce(match && match[1]);
+ },
+
+ /**
+ * Ensures that Java is installed. Will throw exception if not.
+ * Will set JAVA_HOME and PATH environment variables.
+ *
+ * This function becomes a no-op if already ran previously.
+ */
+ _ensure: async (environment) => {
+ if (javaIsEnsured) {
+ return;
+ }
+
+ const javaHome = environment.CORDOVA_JAVA_HOME || environment.JAVA_HOME;
+ if (javaHome) {
+ // Ensure that CORDOVA_JAVA_HOME overrides
+ environment.JAVA_HOME = javaHome;
+ // Ensure that the JAVA_HOME bin path is before anything else
+ // to cover cases where different Java versions is in the PATH
+ environment.PATH = path.join(environment.JAVA_HOME, 'bin') + path.delimiter + environment.PATH;
+ } else {
+ const javacPath = utils.forgivingWhichSync('javac');
+ if (javacPath) {
+ // OS X has a command for finding JAVA_HOME.
+ const find_java = '/usr/libexec/java_home';
+ const default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting it manually.';
+ if (fs.existsSync(find_java)) {
+ try {
+ environment.JAVA_HOME = (await execa(find_java)).stdout;
+ } catch (ex) {
+ events.emit('verbose', ex.shortMessage);
+ throw new CordovaError(default_java_error_msg);
+ }
+ } else {
+ // See if we can derive it from javac's location.
+ var maybeJavaHome = path.dirname(path.dirname(javacPath));
+ if (fs.existsSync(path.join(maybeJavaHome, 'bin', 'java')) ||
+ fs.existsSync(path.join(maybeJavaHome, 'bin', 'java.exe'))) {
+ environment.JAVA_HOME = maybeJavaHome;
+ } else {
+ throw new CordovaError(default_java_error_msg);
+ }
+ }
+ } else if (utils.isWindows()) {
+ const baseDirs = [environment.ProgramFiles, environment['ProgramFiles(x86)']];
+ const globOpts = { absolute: true, onlyDirectories: true };
+ const flatMap = (arr, f) => [].concat(...arr.map(f));
+ const jdkDir = flatMap(baseDirs, cwd => {
+ return glob.sync('java/jdk*', { cwd, ...globOpts });
+ }
+ )[0];
+
+ if (jdkDir) {
+ environment.PATH += path.delimiter + path.join(jdkDir, 'bin');
+ environment.JAVA_HOME = path.normalize(jdkDir);
+ }
+ }
+ }
+
+ javaIsEnsured = true;
+ }
+};
+
+module.exports = java;
diff --git a/node_modules/cordova-android/lib/getASPath.bat b/node_modules/cordova-android/lib/getASPath.bat
new file mode 100644
index 0000000..4712b0e
--- /dev/null
+++ b/node_modules/cordova-android/lib/getASPath.bat
@@ -0,0 +1,20 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements. See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership. The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License. You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied. See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+@ECHO OFF
+for /f "tokens=2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Android Studio" /v Path') do set "ASPath=%%~b"
+ECHO %ASPath%
\ No newline at end of file
diff --git a/node_modules/cordova-android/lib/gradle-config-defaults.js b/node_modules/cordova-android/lib/gradle-config-defaults.js
new file mode 100644
index 0000000..933fe64
--- /dev/null
+++ b/node_modules/cordova-android/lib/gradle-config-defaults.js
@@ -0,0 +1,29 @@
+/*!
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const ABS_MODULE_PATH = '/framework/cdv-gradle-config-defaults.json';
+
+try {
+ // Try relative require first, …
+ module.exports = require('..' + ABS_MODULE_PATH);
+} catch (error) {
+ // … then fall back to installed-package require
+ if (error.code !== 'MODULE_NOT_FOUND') throw error;
+ module.exports = require('cordova-android' + ABS_MODULE_PATH);
+}
diff --git a/node_modules/cordova-android/lib/pluginHandlers.js b/node_modules/cordova-android/lib/pluginHandlers.js
new file mode 100644
index 0000000..617c30e
--- /dev/null
+++ b/node_modules/cordova-android/lib/pluginHandlers.js
@@ -0,0 +1,324 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var fs = require('fs-extra');
+var path = require('path');
+var isPathInside = require('is-path-inside');
+var events = require('cordova-common').events;
+var CordovaError = require('cordova-common').CordovaError;
+
+var handlers = {
+ 'source-file': {
+ install: function (obj, plugin, project, options) {
+ if (!obj.src) throw new CordovaError(generateAttributeError('src', 'source-file', plugin.id));
+ if (!obj.targetDir) throw new CordovaError(generateAttributeError('target-dir', 'source-file', plugin.id));
+
+ var dest = getInstallDestination(obj);
+
+ if (options && options.force) {
+ copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
+ } else {
+ copyNewFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
+ }
+ },
+ uninstall: function (obj, plugin, project, options) {
+ var dest = getInstallDestination(obj);
+
+ // TODO: Add Koltin extension to uninstall, since they are handled like Java files
+ if (obj.src.endsWith('java')) {
+ deleteJava(project.projectDir, dest);
+ } else {
+ // Just remove the file, not the whole parent directory
+ removeFile(path.resolve(project.projectDir, dest));
+ }
+ }
+ },
+ 'lib-file': {
+ install: function (obj, plugin, project, options) {
+ var dest = path.join('app/libs', path.basename(obj.src));
+ copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
+ },
+ uninstall: function (obj, plugin, project, options) {
+ var dest = path.join('app/libs', path.basename(obj.src));
+ removeFile(path.resolve(project.projectDir, dest));
+ }
+ },
+ 'resource-file': {
+ install: function (obj, plugin, project, options) {
+ var dest = path.join('app', 'src', 'main', obj.target);
+ copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
+ },
+ uninstall: function (obj, plugin, project, options) {
+ var dest = path.join('app', 'src', 'main', obj.target);
+ removeFile(path.resolve(project.projectDir, dest));
+ }
+ },
+ framework: {
+ install: function (obj, plugin, project, options) {
+ var src = obj.src;
+ if (!src) throw new CordovaError(generateAttributeError('src', 'framework', plugin.id));
+
+ events.emit('verbose', 'Installing Android library: ' + src);
+ var parentDir = obj.parent ? path.resolve(project.projectDir, obj.parent) : project.projectDir;
+ var subDir;
+
+ if (obj.custom) {
+ var subRelativeDir = project.getCustomSubprojectRelativeDir(plugin.id, src);
+ copyNewFile(plugin.dir, src, project.projectDir, subRelativeDir, !!(options && options.link));
+ subDir = path.resolve(project.projectDir, subRelativeDir);
+ } else {
+ obj.type = 'sys';
+ subDir = src;
+ }
+
+ if (obj.type === 'gradleReference') {
+ project.addGradleReference(parentDir, subDir);
+ } else if (obj.type === 'sys') {
+ project.addSystemLibrary(parentDir, subDir);
+ } else {
+ project.addSubProject(parentDir, subDir);
+ }
+ },
+ uninstall: function (obj, plugin, project, options) {
+ var src = obj.src;
+ if (!src) throw new CordovaError(generateAttributeError('src', 'framework', plugin.id));
+
+ events.emit('verbose', 'Uninstalling Android library: ' + src);
+ var parentDir = obj.parent ? path.resolve(project.projectDir, obj.parent) : project.projectDir;
+ var subDir;
+
+ if (obj.custom) {
+ var subRelativeDir = project.getCustomSubprojectRelativeDir(plugin.id, src);
+ removeFile(path.resolve(project.projectDir, subRelativeDir));
+ subDir = path.resolve(project.projectDir, subRelativeDir);
+ // If it's the last framework in the plugin, remove the parent directory.
+ var parDir = path.dirname(subDir);
+ if (fs.existsSync(parDir) && fs.readdirSync(parDir).length === 0) {
+ fs.rmdirSync(parDir);
+ }
+ } else {
+ obj.type = 'sys';
+ subDir = src;
+ }
+
+ if (obj.type === 'gradleReference') {
+ project.removeGradleReference(parentDir, subDir);
+ } else if (obj.type === 'sys') {
+ project.removeSystemLibrary(parentDir, subDir);
+ } else {
+ project.removeSubProject(parentDir, subDir);
+ }
+ }
+ },
+ asset: {
+ install: function (obj, plugin, project, options) {
+ if (!obj.src) {
+ throw new CordovaError(generateAttributeError('src', 'asset', plugin.id));
+ }
+ if (!obj.target) {
+ throw new CordovaError(generateAttributeError('target', 'asset', plugin.id));
+ }
+
+ copyFile(plugin.dir, obj.src, project.www, obj.target);
+ if (options && options.usePlatformWww) {
+ // CB-11022 copy file to both directories if usePlatformWww is specified
+ copyFile(plugin.dir, obj.src, project.platformWww, obj.target);
+ }
+ },
+ uninstall: function (obj, plugin, project, options) {
+ var target = obj.target || obj.src;
+
+ if (!target) throw new CordovaError(generateAttributeError('target', 'asset', plugin.id));
+
+ removeFile(path.resolve(project.www, target));
+ removeFile(path.resolve(project.www, 'plugins', plugin.id));
+ if (options && options.usePlatformWww) {
+ // CB-11022 remove file from both directories if usePlatformWww is specified
+ removeFile(path.resolve(project.platformWww, target));
+ removeFile(path.resolve(project.platformWww, 'plugins', plugin.id));
+ }
+ }
+ },
+ 'js-module': {
+ install: function (obj, plugin, project, options) {
+ // Copy the plugin's files into the www directory.
+ var moduleSource = path.resolve(plugin.dir, obj.src);
+ var moduleName = plugin.id + '.' + (obj.name || path.basename(obj.src, path.extname(obj.src)));
+
+ // Read in the file, prepend the cordova.define, and write it back out.
+ var scriptContent = fs.readFileSync(moduleSource, 'utf-8').replace(/^\ufeff/, ''); // Window BOM
+ if (moduleSource.match(/.*\.json$/)) {
+ scriptContent = 'module.exports = ' + scriptContent;
+ }
+ scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) {\n' + scriptContent + '\n});\n';
+
+ var wwwDest = path.resolve(project.www, 'plugins', plugin.id, obj.src);
+ fs.ensureDirSync(path.dirname(wwwDest));
+ fs.writeFileSync(wwwDest, scriptContent, 'utf-8');
+
+ if (options && options.usePlatformWww) {
+ // CB-11022 copy file to both directories if usePlatformWww is specified
+ var platformWwwDest = path.resolve(project.platformWww, 'plugins', plugin.id, obj.src);
+ fs.ensureDirSync(path.dirname(platformWwwDest));
+ fs.writeFileSync(platformWwwDest, scriptContent, 'utf-8');
+ }
+ },
+ uninstall: function (obj, plugin, project, options) {
+ var pluginRelativePath = path.join('plugins', plugin.id, obj.src);
+ removeFileAndParents(project.www, pluginRelativePath);
+ if (options && options.usePlatformWww) {
+ // CB-11022 remove file from both directories if usePlatformWww is specified
+ removeFileAndParents(project.platformWww, pluginRelativePath);
+ }
+ }
+ }
+};
+
+module.exports.getInstaller = function (type) {
+ if (handlers[type] && handlers[type].install) {
+ return handlers[type].install;
+ }
+
+ events.emit('verbose', '<' + type + '> is not supported for android plugins');
+};
+
+module.exports.getUninstaller = function (type) {
+ if (handlers[type] && handlers[type].uninstall) {
+ return handlers[type].uninstall;
+ }
+
+ events.emit('verbose', '<' + type + '> is not supported for android plugins');
+};
+
+function copyFile (plugin_dir, src, project_dir, dest, link) {
+ src = path.resolve(plugin_dir, src);
+ if (!fs.existsSync(src)) throw new CordovaError('"' + src + '" not found!');
+
+ // check that src path is inside plugin directory
+ var real_path = fs.realpathSync(src);
+ var real_plugin_path = fs.realpathSync(plugin_dir);
+ if (!isPathInside(real_path, real_plugin_path)) { throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); }
+
+ dest = path.resolve(project_dir, dest);
+
+ // check that dest path is located in project directory
+ if (!isPathInside(dest, project_dir)) { throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); }
+
+ fs.ensureDirSync(path.dirname(dest));
+ if (link) {
+ symlinkFileOrDirTree(src, dest);
+ } else {
+ fs.copySync(src, dest);
+ }
+}
+
+// Same as copy file but throws error if target exists
+function copyNewFile (plugin_dir, src, project_dir, dest, link) {
+ var target_path = path.resolve(project_dir, dest);
+ if (fs.existsSync(target_path)) { throw new CordovaError('"' + target_path + '" already exists!'); }
+
+ copyFile(plugin_dir, src, project_dir, dest, !!link);
+}
+
+function symlinkFileOrDirTree (src, dest) {
+ if (fs.existsSync(dest)) {
+ fs.removeSync(dest);
+ }
+
+ if (fs.statSync(src).isDirectory()) {
+ fs.ensureDirSync(path.dirname(dest));
+ fs.readdirSync(src).forEach(function (entry) {
+ symlinkFileOrDirTree(path.join(src, entry), path.join(dest, entry));
+ });
+ } else {
+ fs.symlinkSync(path.relative(fs.realpathSync(path.dirname(dest)), src), dest);
+ }
+}
+
+function removeFile (file) {
+ fs.removeSync(file);
+}
+
+// Sometimes we want to remove some java, and prune any unnecessary empty directories
+function deleteJava (project_dir, destFile) {
+ removeFileAndParents(project_dir, destFile, 'src');
+}
+
+function removeFileAndParents (baseDir, destFile, stopper) {
+ stopper = stopper || '.';
+ var file = path.resolve(baseDir, destFile);
+ if (!fs.existsSync(file)) return;
+
+ removeFile(file);
+
+ // check if directory is empty
+ var curDir = path.dirname(file);
+
+ while (curDir !== path.resolve(baseDir, stopper)) {
+ if (fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
+ fs.rmdirSync(curDir);
+ curDir = path.resolve(curDir, '..');
+ } else {
+ // directory not empty...do nothing
+ break;
+ }
+ }
+}
+
+function generateAttributeError (attribute, element, id) {
+ return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id;
+}
+
+function getInstallDestination (obj) {
+ var APP_MAIN_PREFIX = 'app/src/main';
+ var PATH_SEPARATOR = '/';
+
+ var PATH_SEP_MATCH = '\\' + PATH_SEPARATOR;
+ var PATH_SEP_OR_EOL_MATCH = '(\\' + PATH_SEPARATOR + '|$)';
+
+ var appReg = new RegExp('^app' + PATH_SEP_OR_EOL_MATCH);
+ var libsReg = new RegExp('^libs' + PATH_SEP_OR_EOL_MATCH);
+ var srcReg = new RegExp('^src' + PATH_SEP_OR_EOL_MATCH);
+ var srcMainReg = new RegExp('^src' + PATH_SEP_MATCH + 'main' + PATH_SEP_OR_EOL_MATCH);
+
+ if (appReg.test(obj.targetDir)) {
+ // If any source file is using the new app directory structure,
+ // don't penalize it
+ return path.join(obj.targetDir, path.basename(obj.src));
+ } else {
+ // Plugin using deprecated target directory structure (GH-580)
+ if (obj.src.endsWith('.java')) {
+ return path.join(APP_MAIN_PREFIX, 'java', obj.targetDir.replace(srcReg, ''),
+ path.basename(obj.src));
+ } else if (obj.src.endsWith('.aidl')) {
+ return path.join(APP_MAIN_PREFIX, 'aidl', obj.targetDir.replace(srcReg, ''),
+ path.basename(obj.src));
+ } else if (libsReg.test(obj.targetDir)) {
+ if (obj.src.endsWith('.so')) {
+ return path.join(APP_MAIN_PREFIX, 'jniLibs', obj.targetDir.replace(libsReg, ''),
+ path.basename(obj.src));
+ } else {
+ return path.join('app', obj.targetDir, path.basename(obj.src));
+ }
+ } else if (srcMainReg.test(obj.targetDir)) {
+ return path.join('app', obj.targetDir, path.basename(obj.src));
+ }
+
+ // For all other source files not using the new app directory structure,
+ // add 'app/src/main' to the targetDir
+ return path.join(APP_MAIN_PREFIX, obj.targetDir, path.basename(obj.src));
+ }
+}
diff --git a/node_modules/cordova-android/lib/prepare.js b/node_modules/cordova-android/lib/prepare.js
new file mode 100644
index 0000000..9e4f50c
--- /dev/null
+++ b/node_modules/cordova-android/lib/prepare.js
@@ -0,0 +1,821 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var fs = require('fs-extra');
+var path = require('path');
+const nopt = require('nopt');
+const glob = require('fast-glob');
+var events = require('cordova-common').events;
+var AndroidManifest = require('./AndroidManifest');
+var checkReqs = require('./check_reqs');
+var xmlHelpers = require('cordova-common').xmlHelpers;
+var CordovaError = require('cordova-common').CordovaError;
+var ConfigParser = require('cordova-common').ConfigParser;
+var FileUpdater = require('cordova-common').FileUpdater;
+var PlatformJson = require('cordova-common').PlatformJson;
+var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+const utils = require('./utils');
+const gradleConfigDefaults = require('./gradle-config-defaults');
+
+const GradlePropertiesParser = require('./config/GradlePropertiesParser');
+
+function parseArguments (argv) {
+ return nopt({
+ // `jvmargs` is a valid option however, we don't actually want to parse it because we want the entire string as is.
+ // jvmargs: String
+ }, {}, argv || [], 0);
+}
+
+module.exports.prepare = function (cordovaProject, options) {
+ var self = this;
+
+ let args = {};
+ if (options && options.options) {
+ args = parseArguments(options.options.argv);
+ }
+
+ var platformJson = PlatformJson.load(this.locations.root, this.platform);
+ var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());
+
+ this._config = updateConfigFilesFrom(cordovaProject.projectConfig, munger, this.locations);
+
+ // Update Gradle cdv-gradle-config.json
+ updateUserProjectGradleConfig(this);
+
+ // Update Project's Gradle Properties
+ updateUserProjectGradlePropertiesConfig(this, args);
+
+ // Update own www dir with project's www assets and plugins' assets and js-files
+ return Promise.resolve(updateWww(cordovaProject, this.locations)).then(function () {
+ // update project according to config.xml changes.
+ return updateProjectAccordingTo(self._config, self.locations);
+ }).then(function () {
+ updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
+ updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
+ updateFileResources(cordovaProject, path.relative(cordovaProject.root, self.locations.root));
+ }).then(function () {
+ events.emit('verbose', 'Prepared android project successfully');
+ });
+};
+
+/** @param {PlatformApi} project */
+function updateUserProjectGradleConfig (project) {
+ // Generate project gradle config
+ const projectGradleConfig = {
+ ...gradleConfigDefaults,
+ ...getUserGradleConfig(project._config)
+ };
+
+ // Write out changes
+ const projectGradleConfigPath = path.join(project.root, 'cdv-gradle-config.json');
+ fs.writeJSONSync(projectGradleConfigPath, projectGradleConfig, { spaces: 2 });
+}
+
+function getUserGradleConfig (configXml) {
+ const configXmlToGradleMapping = [
+ { xmlKey: 'android-minSdkVersion', gradleKey: 'MIN_SDK_VERSION', type: Number },
+ { xmlKey: 'android-maxSdkVersion', gradleKey: 'MAX_SDK_VERSION', type: Number },
+ { xmlKey: 'android-targetSdkVersion', gradleKey: 'SDK_VERSION', type: Number },
+ { xmlKey: 'android-buildToolsVersion', gradleKey: 'BUILD_TOOLS_VERSION', type: String },
+ { xmlKey: 'GradleVersion', gradleKey: 'GRADLE_VERSION', type: String },
+ { xmlKey: 'AndroidGradlePluginVersion', gradleKey: 'AGP_VERSION', type: String },
+ { xmlKey: 'GradlePluginKotlinVersion', gradleKey: 'KOTLIN_VERSION', type: String },
+ { xmlKey: 'AndroidXAppCompatVersion', gradleKey: 'ANDROIDX_APP_COMPAT_VERSION', type: String },
+ { xmlKey: 'AndroidXWebKitVersion', gradleKey: 'ANDROIDX_WEBKIT_VERSION', type: String },
+ { xmlKey: 'GradlePluginGoogleServicesVersion', gradleKey: 'GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION', type: String },
+ { xmlKey: 'GradlePluginGoogleServicesEnabled', gradleKey: 'IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED', type: Boolean },
+ { xmlKey: 'GradlePluginKotlinEnabled', gradleKey: 'IS_GRADLE_PLUGIN_KOTLIN_ENABLED', type: Boolean }
+ ];
+
+ return configXmlToGradleMapping.reduce((config, mapping) => {
+ const rawValue = configXml.getPreference(mapping.xmlKey, 'android');
+
+ // ignore missing preferences (which occur as '')
+ if (rawValue) {
+ config[mapping.gradleKey] = parseStringAsType(rawValue, mapping.type);
+ }
+
+ return config;
+ }, {});
+}
+
+/** Converts given string to given type */
+function parseStringAsType (value, type) {
+ switch (type) {
+ case String:
+ return String(value);
+ case Number:
+ return parseFloat(value);
+ case Boolean:
+ return value.toLowerCase() === 'true';
+ default:
+ throw new CordovaError('Invalid type: ' + type);
+ }
+}
+
+function updateUserProjectGradlePropertiesConfig (project, args) {
+ const gradlePropertiesUserConfig = {};
+
+ // Get the min SDK version from config.xml
+ if (args.jvmargs) gradlePropertiesUserConfig['org.gradle.jvmargs'] = args.jvmargs;
+
+ const isGradlePluginKotlinEnabled = project._config.getPreference('GradlePluginKotlinEnabled', 'android');
+ if (isGradlePluginKotlinEnabled) {
+ const gradlePluginKotlinCodeStyle = project._config.getPreference('GradlePluginKotlinCodeStyle', 'android');
+ gradlePropertiesUserConfig['kotlin.code.style'] = gradlePluginKotlinCodeStyle || 'official';
+ }
+
+ const gradlePropertiesParser = new GradlePropertiesParser(project.root);
+ gradlePropertiesParser.configure(gradlePropertiesUserConfig);
+}
+
+module.exports.clean = function (options) {
+ // A cordovaProject isn't passed into the clean() function, because it might have
+ // been called from the platform shell script rather than the CLI. Check for the
+ // noPrepare option passed in by the non-CLI clean script. If that's present, or if
+ // there's no config.xml found at the project root, then don't clean prepared files.
+ var projectRoot = path.resolve(this.root, '../..');
+ if ((options && options.noPrepare) || !fs.existsSync(this.locations.configXml) ||
+ !fs.existsSync(this.locations.configXml)) {
+ return Promise.resolve();
+ }
+
+ var projectConfig = new ConfigParser(this.locations.configXml);
+
+ var self = this;
+ return Promise.resolve().then(function () {
+ cleanWww(projectRoot, self.locations);
+ cleanIcons(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
+ cleanSplashes(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
+ cleanFileResources(projectRoot, projectConfig, path.relative(projectRoot, self.locations.root));
+ });
+};
+
+/**
+ * Updates config files in project based on app's config.xml and config munge,
+ * generated by plugins.
+ *
+ * @param {ConfigParser} sourceConfig A project's configuration that will
+ * be merged into platform's config.xml
+ * @param {ConfigChanges} configMunger An initialized ConfigChanges instance
+ * for this platform.
+ * @param {Object} locations A map of locations for this platform
+ *
+ * @return {ConfigParser} An instance of ConfigParser, that
+ * represents current project's configuration. When returned, the
+ * configuration is already dumped to appropriate config.xml file.
+ */
+function updateConfigFilesFrom (sourceConfig, configMunger, locations) {
+ events.emit('verbose', 'Generating platform-specific config.xml from defaults for android at ' + locations.configXml);
+
+ // First cleanup current config and merge project's one into own
+ // Overwrite platform config.xml with defaults.xml.
+ fs.copySync(locations.defaultConfigXml, locations.configXml);
+
+ // Then apply config changes from global munge to all config files
+ // in project (including project's config)
+ configMunger.reapply_global_munge().save_all();
+
+ events.emit('verbose', 'Merging project\'s config.xml into platform-specific android config.xml');
+ // Merge changes from app's config.xml into platform's one
+ var config = new ConfigParser(locations.configXml);
+ xmlHelpers.mergeXml(sourceConfig.doc.getroot(),
+ config.doc.getroot(), 'android', /* clobber= */true);
+
+ config.write();
+ return config;
+}
+
+/**
+ * Logs all file operations via the verbose event stream, indented.
+ */
+function logFileOp (message) {
+ events.emit('verbose', ' ' + message);
+}
+
+/**
+ * Updates platform 'www' directory by replacing it with contents of
+ * 'platform_www' and app www. Also copies project's overrides' folder into
+ * the platform 'www' folder
+ *
+ * @param {Object} cordovaProject An object which describes cordova project.
+ * @param {Object} destinations An object that contains destination
+ * paths for www files.
+ */
+function updateWww (cordovaProject, destinations) {
+ var sourceDirs = [
+ path.relative(cordovaProject.root, cordovaProject.locations.www),
+ path.relative(cordovaProject.root, destinations.platformWww)
+ ];
+
+ // If project contains 'merges' for our platform, use them as another overrides
+ var merges_path = path.join(cordovaProject.root, 'merges', 'android');
+ if (fs.existsSync(merges_path)) {
+ events.emit('verbose', 'Found "merges/android" folder. Copying its contents into the android project.');
+ sourceDirs.push(path.join('merges', 'android'));
+ }
+
+ var targetDir = path.relative(cordovaProject.root, destinations.www);
+ events.emit(
+ 'verbose', 'Merging and updating files from [' + sourceDirs.join(', ') + '] to ' + targetDir);
+ FileUpdater.mergeAndUpdateDir(
+ sourceDirs, targetDir, { rootDir: cordovaProject.root }, logFileOp);
+}
+
+/**
+ * Cleans all files from the platform 'www' directory.
+ */
+function cleanWww (projectRoot, locations) {
+ var targetDir = path.relative(projectRoot, locations.www);
+ events.emit('verbose', 'Cleaning ' + targetDir);
+
+ // No source paths are specified, so mergeAndUpdateDir() will clear the target directory.
+ FileUpdater.mergeAndUpdateDir(
+ [], targetDir, { rootDir: projectRoot, all: true }, logFileOp);
+}
+
+/**
+ * Updates project structure and AndroidManifest according to project's configuration.
+ *
+ * @param {ConfigParser} platformConfig A project's configuration that will
+ * be used to update project
+ * @param {Object} locations A map of locations for this platform
+ */
+function updateProjectAccordingTo (platformConfig, locations) {
+ // Update app name by editing res/values/strings.xml
+ var strings = xmlHelpers.parseElementtreeSync(locations.strings);
+
+ var name = platformConfig.name();
+ strings.find('string[@name="app_name"]').text = name.replace(/'/g, '\\\'');
+
+ var shortName = platformConfig.shortName && platformConfig.shortName();
+ if (shortName && shortName !== name) {
+ strings.find('string[@name="launcher_name"]').text = shortName.replace(/'/g, '\\\'');
+ }
+
+ fs.writeFileSync(locations.strings, strings.write({ indent: 4 }), 'utf-8');
+ events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
+
+ // Update app name for gradle project
+ fs.writeFileSync(path.join(locations.root, 'cdv-gradle-name.gradle'),
+ '// GENERATED FILE - DO NOT EDIT\n' +
+ 'rootProject.name = "' + name.replace(/[/\\:<>"?*|]/g, '_') + '"\n');
+
+ // Java packages cannot support dashes
+ var androidPkgName = (platformConfig.android_packageName() || platformConfig.packageName()).replace(/-/g, '_');
+
+ var manifest = new AndroidManifest(locations.manifest);
+ var manifestId = manifest.getPackageId();
+
+ manifest.getActivity()
+ .setOrientation(platformConfig.getPreference('orientation'))
+ .setLaunchMode(findAndroidLaunchModePreference(platformConfig));
+
+ manifest.setVersionName(platformConfig.version())
+ .setVersionCode(platformConfig.android_versionCode() || default_versionCode(platformConfig.version()))
+ .setPackageId(androidPkgName)
+ .write();
+
+ // Java file paths shouldn't be hard coded
+ const javaDirectory = path.join(locations.javaSrc, manifestId.replace(/\./g, '/'));
+ const java_files = glob.sync('**/*.java', { cwd: javaDirectory, absolute: true }).filter(f => {
+ const contents = fs.readFileSync(f, 'utf-8');
+ return /extends\s+CordovaActivity/.test(contents);
+ });
+
+ if (java_files.length === 0) {
+ throw new CordovaError('No Java files found that extend CordovaActivity.');
+ } else if (java_files.length > 1) {
+ events.emit('log', 'Multiple candidate Java files that extend CordovaActivity found. Guessing at the first one, ' + java_files[0]);
+ }
+
+ const destFile = java_files[0];
+
+ // var destFile = path.join(locations.root, 'app', 'src', 'main', 'java', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0]));
+ // fs.ensureDirSync(path.dirname(destFile));
+ // events.emit('verbose', java_files[0]);
+ // events.emit('verbose', destFile);
+ // console.log(locations);
+ // fs.copySync(java_files[0], destFile);
+ utils.replaceFileContents(destFile, /package [\w.]*;/, 'package ' + androidPkgName + ';');
+ events.emit('verbose', 'Wrote out Android package name "' + androidPkgName + '" to ' + destFile);
+
+ var removeOrigPkg = checkReqs.isWindows() || checkReqs.isDarwin()
+ ? manifestId.toUpperCase() !== androidPkgName.toUpperCase()
+ : manifestId !== androidPkgName;
+
+ if (removeOrigPkg) {
+ // If package was name changed we need to remove old java with main activity
+ fs.removeSync(java_files[0]);
+ // remove any empty directories
+ var currentDir = path.dirname(java_files[0]);
+ var sourcesRoot = path.resolve(locations.root, 'src');
+ while (currentDir !== sourcesRoot) {
+ if (fs.existsSync(currentDir) && fs.readdirSync(currentDir).length === 0) {
+ fs.rmdirSync(currentDir);
+ currentDir = path.resolve(currentDir, '..');
+ } else {
+ break;
+ }
+ }
+ }
+}
+
+// Consturct the default value for versionCode as
+// PATCH + MINOR * 100 + MAJOR * 10000
+// see http://developer.android.com/tools/publishing/versioning.html
+function default_versionCode (version) {
+ var nums = version.split('-')[0].split('.');
+ var versionCode = 0;
+ if (+nums[0]) {
+ versionCode += +nums[0] * 10000;
+ }
+ if (+nums[1]) {
+ versionCode += +nums[1] * 100;
+ }
+ if (+nums[2]) {
+ versionCode += +nums[2];
+ }
+
+ events.emit('verbose', 'android-versionCode not found in config.xml. Generating a code based on version in config.xml (' + version + '): ' + versionCode);
+ return versionCode;
+}
+
+function getImageResourcePath (resourcesDir, type, density, name, sourceName) {
+ // Use same extension as source with special case for 9-Patch files
+ const ext = sourceName.endsWith('.9.png')
+ ? '.9.png' : path.extname(sourceName).toLowerCase();
+
+ const subDir = density ? `${type}-${density}` : type;
+ return path.join(resourcesDir, subDir, name + ext);
+}
+
+function getAdaptiveImageResourcePath (resourcesDir, type, density, name, sourceName) {
+ if (/\.9\.png$/.test(sourceName)) {
+ name = name.replace(/\.png$/, '.9.png');
+ }
+ var resourcePath = path.join(resourcesDir, (density ? type + '-' + density + '-v26' : type), name);
+ return resourcePath;
+}
+
+function makeSplashCleanupMap (projectRoot, resourcesDir) {
+ // Build an initial resource map that deletes all existing splash screens
+ const existingSplashPaths = glob.sync(
+ `${resourcesDir.replace(/\\/g, '/')}/drawable-*/screen.{png,9.png,webp,jpg,jpeg}`,
+ { cwd: projectRoot }
+ );
+ return makeCleanResourceMap(existingSplashPaths);
+}
+
+function updateSplashes (cordovaProject, platformResourcesDir) {
+ var resources = cordovaProject.projectConfig.getSplashScreens('android');
+
+ // if there are no "splash" elements in config.xml
+ if (resources.length === 0) {
+ events.emit('verbose', 'This app does not have splash screens defined');
+ // We must not return here!
+ // If the user defines no splash screens, the cleanup map will cause any
+ // existing splash screen images (e.g. the defaults that we copy into a
+ // new app) to be removed from the app folder, which is what we want.
+ }
+
+ // Build an initial resource map that deletes all existing splash screens
+ const resourceMap = makeSplashCleanupMap(cordovaProject.root, platformResourcesDir);
+
+ var hadMdpi = false;
+ resources.forEach(function (resource) {
+ if (!resource.density) {
+ return;
+ }
+ if (resource.density === 'mdpi') {
+ hadMdpi = true;
+ }
+ var targetPath = getImageResourcePath(
+ platformResourcesDir, 'drawable', resource.density, 'screen', path.basename(resource.src));
+ resourceMap[targetPath] = resource.src;
+ });
+
+ // There's no "default" drawable, so assume default == mdpi.
+ if (!hadMdpi && resources.defaultResource) {
+ var targetPath = getImageResourcePath(
+ platformResourcesDir, 'drawable', 'mdpi', 'screen', path.basename(resources.defaultResource.src));
+ resourceMap[targetPath] = resources.defaultResource.src;
+ }
+
+ events.emit('verbose', 'Updating splash screens at ' + platformResourcesDir);
+ FileUpdater.updatePaths(
+ resourceMap, { rootDir: cordovaProject.root }, logFileOp);
+}
+
+function cleanSplashes (projectRoot, projectConfig, platformResourcesDir) {
+ var resources = projectConfig.getSplashScreens('android');
+ if (resources.length > 0) {
+ const resourceMap = makeSplashCleanupMap(projectRoot, platformResourcesDir);
+
+ events.emit('verbose', 'Cleaning splash screens at ' + platformResourcesDir);
+
+ // No source paths are specified in the map, so updatePaths() will delete the target files.
+ FileUpdater.updatePaths(
+ resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
+ }
+}
+
+function updateIcons (cordovaProject, platformResourcesDir) {
+ const icons = cordovaProject.projectConfig.getIcons('android');
+
+ // Skip if there are no app defined icons in config.xml
+ if (icons.length === 0) {
+ events.emit('verbose', 'This app does not have launcher icons defined');
+ return;
+ }
+
+ // 1. loop icons determin if there is an error in the setup.
+ // 2. during initial loop, also setup for legacy support.
+ const errorMissingAttributes = [];
+ const errorLegacyIconNeeded = [];
+ let hasAdaptive = false;
+ icons.forEach((icon, key) => {
+ if (
+ (icon.background && !icon.foreground) ||
+ (!icon.background && icon.foreground) ||
+ (!icon.background && !icon.foreground && !icon.src)
+ ) {
+ errorMissingAttributes.push(icon.density ? icon.density : 'size=' + (icon.height || icon.width));
+ }
+
+ if (icon.foreground) {
+ hasAdaptive = true;
+
+ if (
+ !icon.src &&
+ (
+ icon.foreground.startsWith('@color') ||
+ path.extname(path.basename(icon.foreground)) === '.xml'
+ )
+ ) {
+ errorLegacyIconNeeded.push(icon.density ? icon.density : 'size=' + (icon.height || icon.width));
+ } else if (!icon.src) {
+ icons[key].src = icon.foreground;
+ }
+ }
+ });
+
+ const errorMessage = [];
+ if (errorMissingAttributes.length > 0) {
+ errorMessage.push('One of the following attributes are set but missing the other for the density type: ' + errorMissingAttributes.join(', ') + '. Please ensure that all require attributes are defined.');
+ }
+
+ if (errorLegacyIconNeeded.length > 0) {
+ errorMessage.push('For the following icons with the density of: ' + errorLegacyIconNeeded.join(', ') + ', adaptive foreground with a defined color or vector can not be used as a standard fallback icon for older Android devices. To support older Android environments, please provide a value for the src attribute.');
+ }
+
+ if (errorMessage.length > 0) {
+ throw new CordovaError(errorMessage.join(' '));
+ }
+
+ let resourceMap = Object.assign(
+ {},
+ mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher.png'),
+ mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.png'),
+ mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_background.png'),
+ mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.xml'),
+ mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher_background.xml'),
+ mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'ic_launcher.xml')
+ );
+
+ const preparedIcons = prepareIcons(icons);
+
+ if (hasAdaptive) {
+ resourceMap = updateIconResourceForAdaptive(preparedIcons, resourceMap, platformResourcesDir);
+ }
+
+ resourceMap = updateIconResourceForLegacy(preparedIcons, resourceMap, platformResourcesDir);
+
+ events.emit('verbose', 'Updating icons at ' + platformResourcesDir);
+ FileUpdater.updatePaths(resourceMap, { rootDir: cordovaProject.root }, logFileOp);
+}
+
+function updateIconResourceForAdaptive (preparedIcons, resourceMap, platformResourcesDir) {
+ const android_icons = preparedIcons.android_icons;
+ const default_icon = preparedIcons.default_icon;
+
+ // The source paths for icons and splashes are relative to
+ // project's config.xml location, so we use it as base path.
+ let background;
+ let foreground;
+ let targetPathBackground;
+ let targetPathForeground;
+
+ for (const density in android_icons) {
+ let backgroundVal = '@mipmap/ic_launcher_background';
+ let foregroundVal = '@mipmap/ic_launcher_foreground';
+
+ background = android_icons[density].background;
+ foreground = android_icons[density].foreground;
+
+ if (!background || !foreground) {
+ // This icon isn't an adaptive icon, so skip it
+ continue;
+ }
+
+ if (background.startsWith('@color')) {
+ // Colors Use Case
+ backgroundVal = background; // Example: @color/background_foobar_1
+ } else if (path.extname(path.basename(background)) === '.xml') {
+ // Vector Use Case
+ targetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_background.xml', path.basename(android_icons[density].background));
+ resourceMap[targetPathBackground] = android_icons[density].background;
+ } else if (path.extname(path.basename(background)) === '.png') {
+ // Images Use Case
+ targetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_background.png', path.basename(android_icons[density].background));
+ resourceMap[targetPathBackground] = android_icons[density].background;
+ }
+
+ if (foreground.startsWith('@color')) {
+ // Colors Use Case
+ foregroundVal = foreground;
+ } else if (path.extname(path.basename(foreground)) === '.xml') {
+ // Vector Use Case
+ targetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_foreground.xml', path.basename(android_icons[density].foreground));
+ resourceMap[targetPathForeground] = android_icons[density].foreground;
+ } else if (path.extname(path.basename(foreground)) === '.png') {
+ // Images Use Case
+ targetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher_foreground.png', path.basename(android_icons[density].foreground));
+ resourceMap[targetPathForeground] = android_icons[density].foreground;
+ }
+
+ // create an XML for DPI and set color
+ const icLauncherTemplate = `
+
+
+
+ `;
+
+ const launcherXmlPath = path.join(platformResourcesDir, 'mipmap-' + density + '-v26', 'ic_launcher.xml');
+
+ // Remove the XML from the resourceMap so the file does not get removed.
+ delete resourceMap[launcherXmlPath];
+
+ fs.writeFileSync(path.resolve(launcherXmlPath), icLauncherTemplate);
+ }
+
+ // There's no "default" drawable, so assume default == mdpi.
+ if (default_icon && !android_icons.mdpi) {
+ let defaultTargetPathBackground;
+ let defaultTargetPathForeground;
+
+ if (background.startsWith('@color')) {
+ // Colors Use Case
+ targetPathBackground = default_icon.background;
+ } else if (path.extname(path.basename(background)) === '.xml') {
+ // Vector Use Case
+ defaultTargetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_background.xml', path.basename(default_icon.background));
+ resourceMap[defaultTargetPathBackground] = default_icon.background;
+ } else if (path.extname(path.basename(background)) === '.png') {
+ // Images Use Case
+ defaultTargetPathBackground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_background.png', path.basename(default_icon.background));
+ resourceMap[defaultTargetPathBackground] = default_icon.background;
+ }
+
+ if (foreground.startsWith('@color')) {
+ // Colors Use Case
+ targetPathForeground = default_icon.foreground;
+ } else if (path.extname(path.basename(foreground)) === '.xml') {
+ // Vector Use Case
+ defaultTargetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_foreground.xml', path.basename(default_icon.foreground));
+ resourceMap[defaultTargetPathForeground] = default_icon.foreground;
+ } else if (path.extname(path.basename(foreground)) === '.png') {
+ // Images Use Case
+ defaultTargetPathForeground = getAdaptiveImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher_foreground.png', path.basename(default_icon.foreground));
+ resourceMap[defaultTargetPathForeground] = default_icon.foreground;
+ }
+ }
+
+ return resourceMap;
+}
+
+function updateIconResourceForLegacy (preparedIcons, resourceMap, platformResourcesDir) {
+ const android_icons = preparedIcons.android_icons;
+ const default_icon = preparedIcons.default_icon;
+
+ // The source paths for icons and splashes are relative to
+ // project's config.xml location, so we use it as base path.
+ for (var density in android_icons) {
+ var targetPath = getImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher', path.basename(android_icons[density].src));
+ resourceMap[targetPath] = android_icons[density].src;
+ }
+
+ // There's no "default" drawable, so assume default == mdpi.
+ if (default_icon && !android_icons.mdpi) {
+ var defaultTargetPath = getImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher', path.basename(default_icon.src));
+ resourceMap[defaultTargetPath] = default_icon.src;
+ }
+
+ return resourceMap;
+}
+
+function prepareIcons (icons) {
+ // http://developer.android.com/design/style/iconography.html
+ const SIZE_TO_DENSITY_MAP = {
+ 36: 'ldpi',
+ 48: 'mdpi',
+ 72: 'hdpi',
+ 96: 'xhdpi',
+ 144: 'xxhdpi',
+ 192: 'xxxhdpi'
+ };
+
+ const android_icons = {};
+ let default_icon;
+
+ // find the best matching icon for a given density or size
+ // @output android_icons
+ var parseIcon = function (icon, icon_size) {
+ // do I have a platform icon for that density already
+ var density = icon.density || SIZE_TO_DENSITY_MAP[icon_size];
+ if (!density) {
+ // invalid icon defition ( or unsupported size)
+ return;
+ }
+ var previous = android_icons[density];
+ if (previous && previous.platform) {
+ return;
+ }
+ android_icons[density] = icon;
+ };
+
+ // iterate over all icon elements to find the default icon and call parseIcon
+ for (var i = 0; i < icons.length; i++) {
+ var icon = icons[i];
+ var size = icon.width;
+
+ if (!size) {
+ size = icon.height;
+ }
+
+ if (!size && !icon.density) {
+ if (default_icon) {
+ const found = {};
+ const favor = {};
+
+ // populating found icon.
+ if (icon.background && icon.foreground) {
+ found.background = icon.background;
+ found.foreground = icon.foreground;
+ }
+ if (icon.src) {
+ found.src = icon.src;
+ }
+
+ if (default_icon.background && default_icon.foreground) {
+ favor.background = default_icon.background;
+ favor.foreground = default_icon.foreground;
+ }
+ if (default_icon.src) {
+ favor.src = default_icon.src;
+ }
+
+ events.emit('verbose', 'Found extra default icon: ' + JSON.stringify(found) + ' and ignoring in favor of ' + JSON.stringify(favor) + '.');
+ } else {
+ default_icon = icon;
+ }
+ } else {
+ parseIcon(icon, size);
+ }
+ }
+
+ return {
+ android_icons: android_icons,
+ default_icon: default_icon
+ };
+}
+
+function cleanIcons (projectRoot, projectConfig, platformResourcesDir) {
+ var icons = projectConfig.getIcons('android');
+
+ // Skip if there are no app defined icons in config.xml
+ if (icons.length === 0) {
+ events.emit('verbose', 'This app does not have launcher icons defined');
+ return;
+ }
+
+ const resourceMap = Object.assign(
+ {},
+ mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher.png'),
+ mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.png'),
+ mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_background.png'),
+ mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_foreground.xml'),
+ mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher_background.xml'),
+ mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'ic_launcher.xml')
+ );
+
+ events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir);
+
+ // No source paths are specified in the map, so updatePaths() will delete the target files.
+ FileUpdater.updatePaths(resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
+}
+
+/**
+ * Gets a map containing resources of a specified name from all drawable folders in a directory.
+ */
+function mapImageResources (rootDir, subDir, type, resourceName) {
+ const pathMap = {};
+ const globOptions = { cwd: path.join(rootDir, subDir), onlyDirectories: true };
+ glob.sync(type + '-*', globOptions).forEach(drawableFolder => {
+ const imagePath = path.join(subDir, drawableFolder, resourceName);
+ pathMap[imagePath] = null;
+ });
+ return pathMap;
+}
+
+/** Returns resource map that deletes all given paths */
+function makeCleanResourceMap (resourcePaths) {
+ const pathMap = {};
+ resourcePaths.map(path.normalize)
+ .forEach(resourcePath => {
+ pathMap[resourcePath] = null;
+ });
+ return pathMap;
+}
+
+function updateFileResources (cordovaProject, platformDir) {
+ var files = cordovaProject.projectConfig.getFileResources('android');
+
+ // if there are resource-file elements in config.xml
+ if (files.length === 0) {
+ events.emit('verbose', 'This app does not have additional resource files defined');
+ return;
+ }
+
+ var resourceMap = {};
+ files.forEach(function (res) {
+ var targetPath = path.join(platformDir, res.target);
+ resourceMap[targetPath] = res.src;
+ });
+
+ events.emit('verbose', 'Updating resource files at ' + platformDir);
+ FileUpdater.updatePaths(
+ resourceMap, { rootDir: cordovaProject.root }, logFileOp);
+}
+
+function cleanFileResources (projectRoot, projectConfig, platformDir) {
+ var files = projectConfig.getFileResources('android', true);
+ if (files.length > 0) {
+ events.emit('verbose', 'Cleaning resource files at ' + platformDir);
+
+ var resourceMap = {};
+ files.forEach(function (res) {
+ var filePath = path.join(platformDir, res.target);
+ resourceMap[filePath] = null;
+ });
+
+ FileUpdater.updatePaths(
+ resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
+ }
+}
+
+/**
+ * Gets and validates 'AndroidLaunchMode' prepference from config.xml. Returns
+ * preference value and warns if it doesn't seems to be valid
+ *
+ * @param {ConfigParser} platformConfig A configParser instance for
+ * platform.
+ *
+ * @return {String} Preference's value from config.xml or
+ * default value, if there is no such preference. The default value is
+ * 'singleTop'
+ */
+function findAndroidLaunchModePreference (platformConfig) {
+ var launchMode = platformConfig.getPreference('AndroidLaunchMode');
+ if (!launchMode) {
+ // Return a default value
+ return 'singleTop';
+ }
+
+ var expectedValues = ['standard', 'singleTop', 'singleTask', 'singleInstance'];
+ var valid = expectedValues.indexOf(launchMode) >= 0;
+ if (!valid) {
+ // Note: warn, but leave the launch mode as developer wanted, in case the list of options changes in the future
+ events.emit('warn', 'Unrecognized value for AndroidLaunchMode preference: ' +
+ launchMode + '. Expected values are: ' + expectedValues.join(', '));
+ }
+
+ return launchMode;
+}
diff --git a/node_modules/cordova-android/lib/retry.js b/node_modules/cordova-android/lib/retry.js
new file mode 100644
index 0000000..6806422
--- /dev/null
+++ b/node_modules/cordova-android/lib/retry.js
@@ -0,0 +1,43 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+'use strict';
+
+var events = require('cordova-common').events;
+
+/**
+ * Retry a promise-returning function a number of times, propagating its
+ * results on success or throwing its error on a failed final attempt.
+ *
+ * @arg {Number} attemptsLeft - The number of times to retry the passed call.
+ * @arg {Function} promiseFunction - A function that returns a promise.
+ * @arg {...} - Arguments to pass to promiseFunction.
+ *
+ * @returns {Promise}
+ */
+module.exports.retryPromise = async function (attemptsLeft, promiseFunction, ...args) {
+ while (true) {
+ try {
+ return await promiseFunction(...args);
+ } catch (error) {
+ if (--attemptsLeft < 1) throw error;
+ events.emit('verbose', 'A retried call failed. Retrying ' + attemptsLeft + ' more time(s).');
+ }
+ }
+};
diff --git a/node_modules/cordova-android/lib/run.js b/node_modules/cordova-android/lib/run.js
new file mode 100644
index 0000000..2a4ff94
--- /dev/null
+++ b/node_modules/cordova-android/lib/run.js
@@ -0,0 +1,83 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var emulator = require('./emulator');
+const target = require('./target');
+const build = require('./build');
+const PackageType = require('./PackageType');
+const AndroidManifest = require('./AndroidManifest');
+const { CordovaError, events } = require('cordova-common');
+
+/**
+ * Builds a target spec from a runOptions object
+ *
+ * @param {{target?: string, device?: boolean, emulator?: boolean}} runOptions
+ * @return {target.TargetSpec}
+ */
+function buildTargetSpec (runOptions) {
+ const spec = {};
+ if (runOptions.target) {
+ spec.id = runOptions.target;
+ } else if (runOptions.device) {
+ spec.type = 'device';
+ } else if (runOptions.emulator) {
+ spec.type = 'emulator';
+ }
+ return spec;
+}
+
+function formatResolvedTarget ({ id, type }) {
+ return `${type} ${id}`;
+}
+
+/**
+ * Runs the application on a device if available. If no device is found, it will
+ * use a started emulator. If no started emulators are found it will attempt
+ * to start an avd. If no avds are found it will error out.
+ *
+ * @param {Object} runOptions various run/build options. See Api.js build/run
+ * methods for reference.
+ *
+ * @return {Promise}
+ */
+module.exports.run = async function (runOptions = {}) {
+ const { packageType, buildType } = build.parseBuildOptions(runOptions, null, this.root);
+
+ // Android app bundles cannot be deployed directly to the device
+ if (packageType === PackageType.BUNDLE) {
+ throw new CordovaError('Package type "bundle" is not supported during cordova run.');
+ }
+
+ const buildResults = this._builder.fetchBuildResults(buildType);
+ if (buildResults.apkPaths.length === 0) {
+ throw new CordovaError('Could not find any APKs to deploy');
+ }
+
+ const targetSpec = buildTargetSpec(runOptions);
+ const resolvedTarget = await target.resolve(targetSpec, buildResults);
+ events.emit('log', `Deploying to ${formatResolvedTarget(resolvedTarget)}`);
+
+ if (resolvedTarget.type === 'emulator') {
+ await emulator.wait_for_boot(resolvedTarget.id);
+ }
+
+ const manifest = new AndroidManifest(this.locations.manifest);
+
+ return target.install(resolvedTarget, { manifest, buildResults });
+};
diff --git a/node_modules/cordova-android/lib/target.js b/node_modules/cordova-android/lib/target.js
new file mode 100644
index 0000000..8c29788
--- /dev/null
+++ b/node_modules/cordova-android/lib/target.js
@@ -0,0 +1,173 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const { inspect } = require('util');
+const execa = require('execa');
+const Adb = require('./Adb');
+const build = require('./build');
+const emulator = require('./emulator');
+const { compareBy } = require('./utils');
+const { retryPromise } = require('./retry');
+const { events, CordovaError } = require('cordova-common');
+
+const INSTALL_COMMAND_TIMEOUT = 5 * 60 * 1000;
+const NUM_INSTALL_RETRIES = 3;
+const EXEC_KILL_SIGNAL = 'SIGKILL';
+
+/**
+ * @typedef { 'device' | 'emulator' } TargetType
+ * @typedef { { id: string, type: TargetType } } Target
+ * @typedef { { id?: string, type?: TargetType } } TargetSpec
+ * @typedef { { apkPaths: string[] } } BuildResults
+ */
+
+/**
+ * Returns a list of available targets (connected devices & started emulators)
+ *
+ * @return {Promise}
+ */
+exports.list = async () => {
+ return (await Adb.devices())
+ .map(id => ({
+ id,
+ type: id.startsWith('emulator-') ? 'emulator' : 'device'
+ }));
+};
+
+/**
+ * @param {TargetSpec?} spec
+ * @return {Promise}
+ */
+async function resolveToOnlineTarget (spec = {}) {
+ const targetList = await exports.list();
+ if (targetList.length === 0) return null;
+
+ // Sort by type: devices first, then emulators.
+ targetList.sort(compareBy(t => t.type));
+
+ // Find first matching target for spec. {} matches any target.
+ return targetList.find(target =>
+ Object.keys(spec).every(k => spec[k] === target[k])
+ ) || null;
+}
+
+async function isEmulatorName (name) {
+ const emus = await emulator.list_images();
+ return emus.some(avd => avd.name === name);
+}
+
+/**
+ * @param {TargetSpec} spec
+ * @param {BuildResults} buildResults
+ * @return {Promise}
+ */
+async function resolveToOfflineEmulator ({ id: avdName, type }, { apkPaths }) {
+ if (type === 'device') return null;
+
+ if (avdName) {
+ if (!await isEmulatorName(avdName)) return null;
+ } else {
+ events.emit('verbose', 'Looking for emulator image that best matches the target API');
+
+ const targetSdk = await getTargetSdkFromApk(apkPaths[0]);
+ const bestImage = await emulator.best_image(targetSdk);
+ if (!bestImage) return null;
+
+ avdName = bestImage.name;
+ }
+
+ // try to start an emulator with name avdName
+ const emulatorId = await emulator.start(avdName);
+
+ return { id: emulatorId, type: 'emulator' };
+}
+
+async function getTargetSdkFromApk (apkPath) {
+ const { stdout: targetSdkStr } = await execa('apkanalyzer', [
+ 'manifest', 'target-sdk', apkPath
+ ]);
+ return Number(targetSdkStr);
+}
+
+/**
+ * @param {TargetSpec?} spec
+ * @param {BuildResults} buildResults
+ * @return {Promise}
+ */
+exports.resolve = async (spec, buildResults) => {
+ events.emit('verbose', `Trying to find target matching ${inspect(spec)}`);
+
+ const resolvedTarget =
+ (await resolveToOnlineTarget(spec)) ||
+ (await resolveToOfflineEmulator(spec, buildResults));
+
+ if (!resolvedTarget) {
+ throw new CordovaError(`Could not find target matching ${inspect(spec)}`);
+ }
+
+ return {
+ ...resolvedTarget,
+ arch: await build.detectArchitecture(resolvedTarget.id)
+ };
+};
+
+exports.install = async function ({ id: target, arch, type }, { manifest, buildResults }) {
+ const apk_path = build.findBestApkForArchitecture(buildResults, arch);
+ const pkgName = manifest.getPackageId();
+ const launchName = pkgName + '/.' + manifest.getActivity().getName();
+
+ events.emit('log', 'Using apk: ' + apk_path);
+ events.emit('log', 'Package name: ' + pkgName);
+ events.emit('verbose', `Installing app on target ${target}`);
+
+ async function doInstall (execOptions = {}) {
+ try {
+ await Adb.install(target, apk_path, { replace: true, execOptions });
+ } catch (error) {
+ // CB-9557 CB-10157 only uninstall and reinstall app if the one that
+ // is already installed on device was signed w/different certificate
+ if (!/INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES/.test(error.toString())) throw error;
+
+ events.emit('warn', 'Uninstalling app from device and reinstalling it again because the ' +
+ 'installed app already signed with different key');
+
+ // This promise is always resolved, even if 'adb uninstall' fails to uninstall app
+ // or the app doesn't installed at all, so no error catching needed.
+ await Adb.uninstall(target, pkgName);
+ await Adb.install(target, apk_path, { replace: true });
+ }
+ }
+
+ if (type === 'emulator') {
+ // Work around sporadic emulator hangs: http://issues.apache.org/jira/browse/CB-9119
+ await retryPromise(NUM_INSTALL_RETRIES, () => doInstall({
+ timeout: INSTALL_COMMAND_TIMEOUT,
+ killSignal: EXEC_KILL_SIGNAL
+ }));
+ } else {
+ await doInstall();
+ }
+ events.emit('log', 'INSTALL SUCCESS');
+
+ events.emit('verbose', 'Unlocking screen...');
+ await Adb.shell(target, 'input keyevent 82');
+
+ await Adb.start(target, launchName);
+ events.emit('log', 'LAUNCH SUCCESS');
+};
diff --git a/node_modules/cordova-android/lib/utils.js b/node_modules/cordova-android/lib/utils.js
new file mode 100644
index 0000000..28f17d9
--- /dev/null
+++ b/node_modules/cordova-android/lib/utils.js
@@ -0,0 +1,86 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+/*
+ Provides a set of utility methods, which can also be spied on during unit tests.
+*/
+
+// TODO: Perhaps this should live in cordova-common?
+
+const fs = require('fs-extra');
+const which = require('which');
+const os = require('os');
+
+/**
+ * Reads, searches, and replaces the found occurences with replacementString and then writes the file back out.
+ * A backup is not made.
+ *
+ * @param {string} file A file path to a readable & writable file
+ * @param {RegExp} searchRegex The search regex
+ * @param {string} replacementString The string to replace the found occurences
+ * @returns void
+ */
+exports.replaceFileContents = function (file, searchRegex, replacementString) {
+ let contents = fs.readFileSync(file).toString();
+ contents = contents.replace(searchRegex, replacementString);
+ fs.writeFileSync(file, contents);
+};
+
+// Some helpers for easier sorting
+exports.compare = (a, b) => (a < b && -1) || +(a > b);
+exports.compareBy = f => (a, b) => exports.compare(f(a), f(b));
+exports.compareByAll = fns => {
+ const comparators = fns.map(exports.compareBy);
+ return (a, b) => {
+ for (const cmp of comparators) {
+ const result = cmp(a, b);
+ if (result) return result;
+ }
+ return 0;
+ };
+};
+
+exports.forgivingWhichSync = (cmd) => {
+ const whichResult = which.sync(cmd, { nothrow: true });
+
+ // On null, returns empty string to maintain backwards compatibility
+ // realpathSync follows symlinks
+ return whichResult === null ? '' : fs.realpathSync(whichResult);
+};
+
+exports.isWindows = () => os.platform() === 'win32';
+exports.isDarwin = () => os.platform() === 'darwin';
+
+const UNESCAPED_REGEX = /[&<>"']/g;
+
+const escapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+};
+
+/**
+ * Converts the characters "&", "<", ">", '"' and "'" in the given string to
+ * their corresponding escaped value
+ * @param {string} str the string to be escaped
+ * @returns the escaped string
+ */
+exports.escape = (str) => UNESCAPED_REGEX.test(str) ? str.replace(UNESCAPED_REGEX, (key) => escapes[key]) : str;
diff --git a/node_modules/cordova-android/package.json b/node_modules/cordova-android/package.json
new file mode 100644
index 0000000..384eb98
--- /dev/null
+++ b/node_modules/cordova-android/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "cordova-android",
+ "version": "10.1.2",
+ "description": "cordova-android release",
+ "main": "lib/Api.js",
+ "repository": "github:apache/cordova-android",
+ "bugs": "https://github.com/apache/cordova-android/issues",
+ "keywords": [
+ "android",
+ "cordova",
+ "apache"
+ ],
+ "scripts": {
+ "prepare": "cordova-js build > templates/project/assets/www/cordova.js",
+ "test": "npm run lint && npm run cover && npm run java-unit-tests",
+ "lint": "eslint lib spec test \"templates/cordova/**/!(*.*)\"",
+ "unit-tests": "jasmine --config=spec/unit/jasmine.json",
+ "cover": "nyc jasmine --config=spec/coverage.json",
+ "e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
+ "java-unit-tests": "node test/run_java_unit_tests.js",
+ "clean:java-unit-tests": "node test/clean.js"
+ },
+ "author": "Apache Software Foundation",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "android-versions": "^1.7.0",
+ "cordova-common": "^4.0.2",
+ "execa": "^5.1.1",
+ "fast-glob": "^3.2.7",
+ "fs-extra": "^10.0.0",
+ "is-path-inside": "^3.0.3",
+ "nopt": "^5.0.0",
+ "properties-parser": "^0.3.1",
+ "semver": "^7.3.5",
+ "untildify": "^4.0.0",
+ "which": "^2.0.2"
+ },
+ "devDependencies": {
+ "@cordova/eslint-config": "^3.0.0",
+ "cordova-js": "^6.1.0",
+ "jasmine": "^3.8.0",
+ "jasmine-spec-reporter": "^7.0.0",
+ "nyc": "^15.1.0",
+ "rewire": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "nyc": {
+ "include": [
+ "lib"
+ ],
+ "reporter": [
+ "lcov",
+ "text"
+ ]
+ }
+}
diff --git a/node_modules/cordova-android/templates/cordova/Api.js b/node_modules/cordova-android/templates/cordova/Api.js
new file mode 100644
index 0000000..de29478
--- /dev/null
+++ b/node_modules/cordova-android/templates/cordova/Api.js
@@ -0,0 +1,20 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+module.exports = require('cordova-android');
diff --git a/node_modules/cordova-android/templates/cordova/android_sdk_version b/node_modules/cordova-android/templates/cordova/android_sdk_version
new file mode 100644
index 0000000..5ef0238
--- /dev/null
+++ b/node_modules/cordova-android/templates/cordova/android_sdk_version
@@ -0,0 +1,27 @@
+#!/usr/bin/env node
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var android_sdk = require('cordova-android/lib/android_sdk');
+
+android_sdk.print_newest_available_sdk_target().catch(err => {
+ console.error(err);
+ process.exit(2);
+});
diff --git a/node_modules/cordova-android/templates/cordova/defaults.xml b/node_modules/cordova-android/templates/cordova/defaults.xml
new file mode 100644
index 0000000..5286ab9
--- /dev/null
+++ b/node_modules/cordova-android/templates/cordova/defaults.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
diff --git a/node_modules/cordova-android/templates/cordova/lib/list-devices b/node_modules/cordova-android/templates/cordova/lib/list-devices
new file mode 100644
index 0000000..9aa7d99
--- /dev/null
+++ b/node_modules/cordova-android/templates/cordova/lib/list-devices
@@ -0,0 +1,36 @@
+#!/usr/bin/env node
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const { list } = require('cordova-android/lib/target');
+
+// Usage support for when args are given
+require('cordova-android/lib/check_reqs').check_android().then(function () {
+ list().then(targets => {
+ const deviceIds = targets
+ .filter(({ type }) => type === 'device')
+ .map(({ id }) => id);
+
+ console.log(deviceIds.join('\n'));
+ }, function (err) {
+ console.error('ERROR: ' + err);
+ process.exit(2);
+ });
+});
diff --git a/node_modules/cordova-android/templates/cordova/lib/list-emulator-images b/node_modules/cordova-android/templates/cordova/lib/list-emulator-images
new file mode 100644
index 0000000..4351b68
--- /dev/null
+++ b/node_modules/cordova-android/templates/cordova/lib/list-emulator-images
@@ -0,0 +1,34 @@
+#!/usr/bin/env node
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+var emulators = require('cordova-android/lib/emulator');
+
+// Usage support for when args are given
+require('cordova-android/lib/check_reqs').check_android().then(function () {
+ emulators.list_images().then(function (emulator_list) {
+ emulator_list && emulator_list.forEach(function (emu) {
+ console.log(emu.name);
+ });
+ }, function (err) {
+ console.error('ERROR: ' + err);
+ process.exit(2);
+ });
+});
diff --git a/node_modules/cordova-android/templates/cordova/version b/node_modules/cordova-android/templates/cordova/version
new file mode 100644
index 0000000..00f44bb
--- /dev/null
+++ b/node_modules/cordova-android/templates/cordova/version
@@ -0,0 +1,24 @@
+#!/usr/bin/env node
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+const Api = require('./Api');
+
+console.log(Api.version());
diff --git a/node_modules/cordova-android/templates/project/Activity.java b/node_modules/cordova-android/templates/project/Activity.java
new file mode 100644
index 0000000..567b6c7
--- /dev/null
+++ b/node_modules/cordova-android/templates/project/Activity.java
@@ -0,0 +1,41 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package __ID__;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class __ACTIVITY__ extends CordovaActivity
+{
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ // enable Cordova apps to be started in the background
+ Bundle extras = getIntent().getExtras();
+ if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
+ moveTaskToBack(true);
+ }
+
+ // Set by in config.xml
+ loadUrl(launchUrl);
+ }
+}
diff --git a/node_modules/cordova-android/templates/project/AndroidManifest.xml b/node_modules/cordova-android/templates/project/AndroidManifest.xml
new file mode 100644
index 0000000..5edc2af
--- /dev/null
+++ b/node_modules/cordova-android/templates/project/AndroidManifest.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/cordova-android/templates/project/app/build.gradle b/node_modules/cordova-android/templates/project/app/build.gradle
new file mode 100644
index 0000000..08959e0
--- /dev/null
+++ b/node_modules/cordova-android/templates/project/app/build.gradle
@@ -0,0 +1,343 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+apply plugin: 'com.android.application'
+
+if (cordovaConfig.IS_GRADLE_PLUGIN_KOTLIN_ENABLED) {
+ apply plugin: 'kotlin-android'
+ apply plugin: 'kotlin-android-extensions'
+}
+
+buildscript {
+ apply from: '../CordovaLib/cordova.gradle'
+
+ // Checks if the kotlin version format is valid.
+ if(cordovaConfig.IS_GRADLE_PLUGIN_KOTLIN_ENABLED) {
+ if(!cdvHelpers.isVersionValid(cordovaConfig.KOTLIN_VERSION)) {
+ throw new GradleException("The defined Kotlin version (${cordovaConfig.KOTLIN_VERSION}) does not appear to be a valid version.")
+ }
+ }
+
+ apply from: 'repositories.gradle'
+ repositories repos
+
+ dependencies {
+ classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
+
+ if (cordovaConfig.IS_GRADLE_PLUGIN_KOTLIN_ENABLED) {
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${cordovaConfig.KOTLIN_VERSION}"
+ }
+
+ if(cordovaConfig.IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED) {
+ // Checks if the kotlin version format is valid.
+ if(!cdvHelpers.isVersionValid(cordovaConfig.GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION)) {
+ throw new GradleException("The defined Google Services plugin version (${cordovaConfig.GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION}) does not appear to be a valid version.")
+ }
+
+ // Create the Google Services classpath and set it.
+ String gradlePluginGoogleServicesClassPath = "com.google.gms:google-services:${cordovaConfig.GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION}"
+ println "Adding classpath: ${gradlePluginGoogleServicesClassPath}"
+ classpath gradlePluginGoogleServicesClassPath
+ }
+ }
+}
+
+// Allow plugins to declare Maven dependencies via build-extras.gradle.
+allprojects {
+ def hasRepositoriesGradle = file('repositories.gradle').exists()
+ if (hasRepositoriesGradle) {
+ apply from: 'repositories.gradle'
+ } else {
+ apply from: "${project.rootDir}/repositories.gradle"
+ }
+
+ repositories repos
+}
+
+task wrapper(type: Wrapper) {
+ gradleVersion = cordovaConfig.GRADLE_VERSION
+}
+
+// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
+// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
+ext {
+ apply from: '../CordovaLib/cordova.gradle'
+
+ // Sets the versionCode to the given value.
+ if (!project.hasProperty('cdvVersionCode')) {
+ cdvVersionCode = null
+ }
+ // Whether to build architecture-specific APKs.
+ if (!project.hasProperty('cdvBuildMultipleApks')) {
+ cdvBuildMultipleApks = null
+ }
+ // Whether to append a 0 "abi digit" to versionCode when only a single APK is build
+ if (!project.hasProperty('cdvVersionCodeForceAbiDigit')) {
+ cdvVersionCodeForceAbiDigit = null
+ }
+ // .properties files to use for release signing.
+ if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
+ cdvReleaseSigningPropertiesFile = null
+ }
+ // .properties files to use for debug signing.
+ if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
+ cdvDebugSigningPropertiesFile = null
+ }
+ // Set by build.js script.
+ if (!project.hasProperty('cdvBuildArch')) {
+ cdvBuildArch = null
+ }
+
+ // Plugin gradle extensions can append to this to have code run at the end.
+ cdvPluginPostBuildExtras = []
+}
+
+// PLUGIN GRADLE EXTENSIONS START
+// PLUGIN GRADLE EXTENSIONS END
+
+def hasBuildExtras1 = file('build-extras.gradle').exists()
+if (hasBuildExtras1) {
+ apply from: 'build-extras.gradle'
+}
+
+def hasBuildExtras2 = file('../build-extras.gradle').exists()
+if (hasBuildExtras2) {
+ apply from: '../build-extras.gradle'
+}
+
+// Apply updates that might come from build-extra.
+privateHelpers.applyCordovaConfigCustomization()
+
+// Set property defaults after extension .gradle files.
+if (ext.cdvDebugSigningPropertiesFile == null && file('../debug-signing.properties').exists()) {
+ ext.cdvDebugSigningPropertiesFile = '../debug-signing.properties'
+}
+if (ext.cdvReleaseSigningPropertiesFile == null && file('../release-signing.properties').exists()) {
+ ext.cdvReleaseSigningPropertiesFile = '../release-signing.properties'
+}
+
+// Cast to appropriate types.
+ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
+ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean();
+ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
+
+def computeBuildTargetName(debugBuild) {
+ def ret = 'assemble'
+ if (cdvBuildMultipleApks && cdvBuildArch) {
+ def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch
+ ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1);
+ }
+ return ret + (debugBuild ? 'Debug' : 'Release')
+}
+
+// Make cdvBuild a task that depends on the debug/arch-sepecific task.
+task cdvBuildDebug
+cdvBuildDebug.dependsOn {
+ return computeBuildTargetName(true)
+}
+
+task cdvBuildRelease
+cdvBuildRelease.dependsOn {
+ return computeBuildTargetName(false)
+}
+
+task cdvPrintProps {
+ doLast {
+ println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
+ println('cdvVersionCode=' + cdvVersionCode)
+ println('cdvVersionCodeForceAbiDigit=' + cdvVersionCodeForceAbiDigit)
+ println('cdvSdkVersion=' + cdvSdkVersion)
+ println('cdvMinSdkVersion=' + cdvMinSdkVersion)
+ println('cdvMaxSdkVersion=' + cdvMaxSdkVersion)
+ println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
+ println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
+ println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
+ println('cdvBuildArch=' + cdvBuildArch)
+ println('computedVersionCode=' + android.defaultConfig.versionCode)
+ println('cdvAndroidXAppCompatVersion=' + cdvAndroidXAppCompatVersion)
+ println('cdvAndroidXWebKitVersion=' + cdvAndroidXWebKitVersion)
+ android.productFlavors.each { flavor ->
+ println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
+ }
+ }
+}
+
+android {
+ defaultConfig {
+ versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
+ applicationId privateHelpers.extractStringFromManifest("package")
+
+ minSdkVersion cordovaConfig.MIN_SDK_VERSION
+ if (cordovaConfig.MAX_SDK_VERSION != null) {
+ maxSdkVersion cordovaConfig.MAX_SDK_VERSION
+ }
+ targetSdkVersion cordovaConfig.SDK_VERSION
+ compileSdkVersion cordovaConfig.SDK_VERSION
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+ buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION
+
+ // This code exists for Crosswalk and other Native APIs.
+ // By default, we multiply the existing version code in the
+ // Android Manifest by 10 and add a number for each architecture.
+ // If you are not using Crosswalk or SQLite, you can
+ // ignore this chunk of code, and your version codes will be respected.
+
+ if (Boolean.valueOf(cdvBuildMultipleApks)) {
+ flavorDimensions "default"
+
+ productFlavors {
+ armeabi {
+ versionCode defaultConfig.versionCode*10 + 1
+ ndk {
+ abiFilters = ["armeabi"]
+ }
+ }
+ armv7 {
+ versionCode defaultConfig.versionCode*10 + 2
+ ndk {
+ abiFilters = ["armeabi-v7a"]
+ }
+ }
+ arm64 {
+ versionCode defaultConfig.versionCode*10 + 3
+ ndk {
+ abiFilters = ["arm64-v8a"]
+ }
+ }
+ x86 {
+ versionCode defaultConfig.versionCode*10 + 4
+ ndk {
+ abiFilters = ["x86"]
+ }
+ }
+ x86_64 {
+ versionCode defaultConfig.versionCode*10 + 5
+ ndk {
+ abiFilters = ["x86_64"]
+ }
+ }
+ }
+ } else if (Boolean.valueOf(cdvVersionCodeForceAbiDigit)) {
+ // This provides compatibility to the default logic for versionCode before cordova-android 5.2.0
+ defaultConfig {
+ versionCode defaultConfig.versionCode*10
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ if (cdvReleaseSigningPropertiesFile) {
+ signingConfigs {
+ release {
+ // These must be set or Gradle will complain (even if they are overridden).
+ keyAlias = ""
+ keyPassword = ""
+ storeFile = null
+ storePassword = ""
+ }
+ }
+ buildTypes {
+ release {
+ signingConfig signingConfigs.release
+ }
+ }
+ addSigningProps(cdvReleaseSigningPropertiesFile, signingConfigs.release)
+ }
+
+ if (cdvDebugSigningPropertiesFile) {
+ addSigningProps(cdvDebugSigningPropertiesFile, signingConfigs.debug)
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+}
+
+/*
+ * WARNING: Cordova Lib and platform scripts do management inside of this code here,
+ * if you are adding the dependencies manually, do so outside the comments, otherwise
+ * the Cordova tools will overwrite them
+ */
+
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: '*.jar')
+ implementation "androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
+
+ if (cordovaConfig.IS_GRADLE_PLUGIN_KOTLIN_ENABLED) {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${cordovaConfig.KOTLIN_VERSION}"
+ }
+
+ // SUB-PROJECT DEPENDENCIES START
+ debugCompile(project(path: ":CordovaLib", configuration: "debug"))
+ releaseCompile(project(path: ":CordovaLib", configuration: "release"))
+ // SUB-PROJECT DEPENDENCIES END
+}
+
+def addSigningProps(propsFilePath, signingConfig) {
+ def propsFile = file(propsFilePath)
+ def props = new Properties()
+ propsFile.withReader { reader ->
+ props.load(reader)
+ }
+
+ def storeFile = new File(props.get('key.store') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'storeFile'))
+ if (!storeFile.isAbsolute()) {
+ storeFile = RelativePath.parse(true, storeFile.toString()).getFile(propsFile.getParentFile())
+ }
+ if (!storeFile.exists()) {
+ throw new FileNotFoundException('Keystore file does not exist: ' + storeFile.getAbsolutePath())
+ }
+ signingConfig.keyAlias = props.get('key.alias') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'keyAlias')
+ signingConfig.keyPassword = props.get('keyPassword', props.get('key.alias.password', signingConfig.keyPassword))
+ signingConfig.storeFile = storeFile
+ signingConfig.storePassword = props.get('storePassword', props.get('key.store.password', signingConfig.storePassword))
+ def storeType = props.get('storeType', props.get('key.store.type', ''))
+ if (!storeType) {
+ def filename = storeFile.getName().toLowerCase()
+ if (filename.endsWith('.p12') || filename.endsWith('.pfx')) {
+ storeType = 'pkcs12'
+ } else {
+ storeType = signingConfig.storeType // "jks"
+ }
+ }
+ signingConfig.storeType = storeType
+}
+
+for (def func : cdvPluginPostBuildExtras) {
+ func()
+}
+
+// This can be defined within build-extras.gradle as:
+// ext.postBuildExtras = { ... code here ... }
+if (hasProperty('postBuildExtras')) {
+ postBuildExtras()
+}
+
+if (cordovaConfig.IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED) {
+ apply plugin: 'com.google.gms.google-services'
+}
diff --git a/node_modules/cordova-android/templates/project/app/repositories.gradle b/node_modules/cordova-android/templates/project/app/repositories.gradle
new file mode 100644
index 0000000..01e73fd
--- /dev/null
+++ b/node_modules/cordova-android/templates/project/app/repositories.gradle
@@ -0,0 +1,22 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+ext.repos = {
+ google()
+ mavenCentral()
+}
diff --git a/node_modules/cordova-android/templates/project/assets/www/cordova.js b/node_modules/cordova-android/templates/project/assets/www/cordova.js
new file mode 100644
index 0000000..f4c4c9f
--- /dev/null
+++ b/node_modules/cordova-android/templates/project/assets/www/cordova.js
@@ -0,0 +1,1904 @@
+// Platform: cordova-android
+// cordova-js 6.1.0
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+;(function() {
+var PLATFORM_VERSION_BUILD_LABEL = '10.1.2';
+// file: src/scripts/require.js
+var require;
+var define;
+
+(function () {
+ var modules = {};
+ // Stack of moduleIds currently being built.
+ var requireStack = [];
+ // Map of module ID -> index into requireStack of modules currently being built.
+ var inProgressModules = {};
+ var SEPARATOR = '.';
+
+ function build (module) {
+ var factory = module.factory;
+ var localRequire = function (id) {
+ var resultantId = id;
+ // Its a relative path, so lop off the last portion and add the id (minus "./")
+ if (id.charAt(0) === '.') {
+ resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
+ }
+ return require(resultantId);
+ };
+ module.exports = {};
+ delete module.factory;
+ factory(localRequire, module.exports, module);
+ return module.exports;
+ }
+
+ require = function (id) {
+ if (!modules[id]) {
+ throw new Error('module ' + id + ' not found');
+ } else if (id in inProgressModules) {
+ var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
+ throw new Error('Cycle in require graph: ' + cycle);
+ }
+ if (modules[id].factory) {
+ try {
+ inProgressModules[id] = requireStack.length;
+ requireStack.push(id);
+ return build(modules[id]);
+ } finally {
+ delete inProgressModules[id];
+ requireStack.pop();
+ }
+ }
+ return modules[id].exports;
+ };
+
+ define = function (id, factory) {
+ if (Object.prototype.hasOwnProperty.call(modules, id)) {
+ throw new Error('module ' + id + ' already defined');
+ }
+
+ modules[id] = {
+ id: id,
+ factory: factory
+ };
+ };
+
+ define.remove = function (id) {
+ delete modules[id];
+ };
+
+ define.moduleMap = modules;
+})();
+
+// Export for use in node
+if (typeof module === 'object' && typeof require === 'function') {
+ module.exports.require = require;
+ module.exports.define = define;
+}
+
+// file: src/cordova.js
+define("cordova", function(require, exports, module) {
+
+// Workaround for Windows 10 in hosted environment case
+// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
+if (window.cordova && !(window.cordova instanceof HTMLElement)) {
+ throw new Error('cordova already defined');
+}
+
+var channel = require('cordova/channel');
+var platform = require('cordova/platform');
+
+/**
+ * Intercept calls to addEventListener + removeEventListener and handle deviceready,
+ * resume, and pause events.
+ */
+var m_document_addEventListener = document.addEventListener;
+var m_document_removeEventListener = document.removeEventListener;
+var m_window_addEventListener = window.addEventListener;
+var m_window_removeEventListener = window.removeEventListener;
+
+/**
+ * Houses custom event handlers to intercept on document + window event listeners.
+ */
+var documentEventHandlers = {};
+var windowEventHandlers = {};
+
+document.addEventListener = function (evt, handler, capture) {
+ var e = evt.toLowerCase();
+ if (typeof documentEventHandlers[e] !== 'undefined') {
+ documentEventHandlers[e].subscribe(handler);
+ } else {
+ m_document_addEventListener.call(document, evt, handler, capture);
+ }
+};
+
+window.addEventListener = function (evt, handler, capture) {
+ var e = evt.toLowerCase();
+ if (typeof windowEventHandlers[e] !== 'undefined') {
+ windowEventHandlers[e].subscribe(handler);
+ } else {
+ m_window_addEventListener.call(window, evt, handler, capture);
+ }
+};
+
+document.removeEventListener = function (evt, handler, capture) {
+ var e = evt.toLowerCase();
+ // If unsubscribing from an event that is handled by a plugin
+ if (typeof documentEventHandlers[e] !== 'undefined') {
+ documentEventHandlers[e].unsubscribe(handler);
+ } else {
+ m_document_removeEventListener.call(document, evt, handler, capture);
+ }
+};
+
+window.removeEventListener = function (evt, handler, capture) {
+ var e = evt.toLowerCase();
+ // If unsubscribing from an event that is handled by a plugin
+ if (typeof windowEventHandlers[e] !== 'undefined') {
+ windowEventHandlers[e].unsubscribe(handler);
+ } else {
+ m_window_removeEventListener.call(window, evt, handler, capture);
+ }
+};
+
+function createEvent (type, data) {
+ var event = document.createEvent('Events');
+ event.initEvent(type, false, false);
+ if (data) {
+ for (var i in data) {
+ if (Object.prototype.hasOwnProperty.call(data, i)) {
+ event[i] = data[i];
+ }
+ }
+ }
+ return event;
+}
+
+var cordova = {
+ define: define,
+ require: require,
+ version: PLATFORM_VERSION_BUILD_LABEL,
+ platformVersion: PLATFORM_VERSION_BUILD_LABEL,
+ platformId: platform.id,
+
+ /**
+ * Methods to add/remove your own addEventListener hijacking on document + window.
+ */
+ addWindowEventHandler: function (event) {
+ return (windowEventHandlers[event] = channel.create(event));
+ },
+ addStickyDocumentEventHandler: function (event) {
+ return (documentEventHandlers[event] = channel.createSticky(event));
+ },
+ addDocumentEventHandler: function (event) {
+ return (documentEventHandlers[event] = channel.create(event));
+ },
+ removeWindowEventHandler: function (event) {
+ delete windowEventHandlers[event];
+ },
+ removeDocumentEventHandler: function (event) {
+ delete documentEventHandlers[event];
+ },
+
+ /**
+ * Retrieve original event handlers that were replaced by Cordova
+ *
+ * @return object
+ */
+ getOriginalHandlers: function () {
+ return {
+ document: {
+ addEventListener: m_document_addEventListener,
+ removeEventListener: m_document_removeEventListener
+ },
+ window: {
+ addEventListener: m_window_addEventListener,
+ removeEventListener: m_window_removeEventListener
+ }
+ };
+ },
+
+ /**
+ * Method to fire event from native code
+ * bNoDetach is required for events which cause an exception which needs to be caught in native code
+ */
+ fireDocumentEvent: function (type, data, bNoDetach) {
+ var evt = createEvent(type, data);
+ if (typeof documentEventHandlers[type] !== 'undefined') {
+ if (bNoDetach) {
+ documentEventHandlers[type].fire(evt);
+ } else {
+ setTimeout(function () {
+ // Fire deviceready on listeners that were registered before cordova.js was loaded.
+ if (type === 'deviceready') {
+ document.dispatchEvent(evt);
+ }
+ documentEventHandlers[type].fire(evt);
+ }, 0);
+ }
+ } else {
+ document.dispatchEvent(evt);
+ }
+ },
+
+ fireWindowEvent: function (type, data) {
+ var evt = createEvent(type, data);
+ if (typeof windowEventHandlers[type] !== 'undefined') {
+ setTimeout(function () {
+ windowEventHandlers[type].fire(evt);
+ }, 0);
+ } else {
+ window.dispatchEvent(evt);
+ }
+ },
+
+ /**
+ * Plugin callback mechanism.
+ */
+ // Randomize the starting callbackId to avoid collisions after refreshing or navigating.
+ // This way, it's very unlikely that any new callback would get the same callbackId as an old callback.
+ callbackId: Math.floor(Math.random() * 2000000000),
+ callbacks: {},
+ callbackStatus: {
+ NO_RESULT: 0,
+ OK: 1,
+ CLASS_NOT_FOUND_EXCEPTION: 2,
+ ILLEGAL_ACCESS_EXCEPTION: 3,
+ INSTANTIATION_EXCEPTION: 4,
+ MALFORMED_URL_EXCEPTION: 5,
+ IO_EXCEPTION: 6,
+ INVALID_ACTION: 7,
+ JSON_EXCEPTION: 8,
+ ERROR: 9
+ },
+
+ /**
+ * Called by native code when returning successful result from an action.
+ */
+ callbackSuccess: function (callbackId, args) {
+ cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
+ },
+
+ /**
+ * Called by native code when returning error result from an action.
+ */
+ callbackError: function (callbackId, args) {
+ // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative.
+ // Derive success from status.
+ cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback);
+ },
+
+ /**
+ * Called by native code when returning the result from an action.
+ */
+ callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) {
+ try {
+ var callback = cordova.callbacks[callbackId];
+ if (callback) {
+ if (isSuccess && status === cordova.callbackStatus.OK) {
+ callback.success && callback.success.apply(null, args);
+ } else if (!isSuccess) {
+ callback.fail && callback.fail.apply(null, args);
+ }
+ /*
+ else
+ Note, this case is intentionally not caught.
+ this can happen if isSuccess is true, but callbackStatus is NO_RESULT
+ which is used to remove a callback from the list without calling the callbacks
+ typically keepCallback is false in this case
+ */
+ // Clear callback if not expecting any more results
+ if (!keepCallback) {
+ delete cordova.callbacks[callbackId];
+ }
+ }
+ } catch (err) {
+ var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
+ cordova.fireWindowEvent('cordovacallbackerror', { message: msg, error: err });
+ throw err;
+ }
+ },
+
+ addConstructor: function (func) {
+ channel.onCordovaReady.subscribe(function () {
+ try {
+ func();
+ } catch (e) {
+ console.log('Failed to run constructor: ' + e);
+ }
+ });
+ }
+};
+
+module.exports = cordova;
+
+});
+
+// file: ../../cordova-js-src/android/nativeapiprovider.js
+define("cordova/android/nativeapiprovider", function(require, exports, module) {
+
+/**
+ * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi.
+ */
+
+var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi');
+var currentApi = nativeApi;
+
+module.exports = {
+ get: function () { return currentApi; },
+ setPreferPrompt: function (value) {
+ currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi;
+ },
+ // Used only by tests.
+ set: function (value) {
+ currentApi = value;
+ }
+};
+
+});
+
+// file: ../../cordova-js-src/android/promptbasednativeapi.js
+define("cordova/android/promptbasednativeapi", function(require, exports, module) {
+
+/**
+ * Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
+ * This is used pre-JellyBean, where addJavascriptInterface() is disabled.
+ */
+
+module.exports = {
+ exec: function (bridgeSecret, service, action, callbackId, argsJson) {
+ return prompt(argsJson, 'gap:' + JSON.stringify([bridgeSecret, service, action, callbackId]));
+ },
+ setNativeToJsBridgeMode: function (bridgeSecret, value) {
+ prompt(value, 'gap_bridge_mode:' + bridgeSecret);
+ },
+ retrieveJsMessages: function (bridgeSecret, fromOnlineEvent) {
+ return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret);
+ }
+};
+
+});
+
+// file: src/common/argscheck.js
+define("cordova/argscheck", function(require, exports, module) {
+
+var utils = require('cordova/utils');
+
+var moduleExports = module.exports;
+
+var typeMap = {
+ A: 'Array',
+ D: 'Date',
+ N: 'Number',
+ S: 'String',
+ F: 'Function',
+ O: 'Object'
+};
+
+function extractParamName (callee, argIndex) {
+ return (/\(\s*([^)]*?)\s*\)/).exec(callee)[1].split(/\s*,\s*/)[argIndex];
+}
+
+/**
+ * Checks the given arguments' types and throws if they are not as expected.
+ *
+ * `spec` is a string where each character stands for the required type of the
+ * argument at the same position. In other words: the character at `spec[i]`
+ * specifies the required type for `args[i]`. The characters in `spec` are the
+ * first letter of the required type's name. The supported types are:
+ *
+ * Array, Date, Number, String, Function, Object
+ *
+ * Lowercase characters specify arguments that must not be `null` or `undefined`
+ * while uppercase characters allow those values to be passed.
+ *
+ * Finally, `*` can be used to allow any type at the corresponding position.
+ *
+ * @example
+ * function foo (arr, opts) {
+ * // require `arr` to be an Array and `opts` an Object, null or undefined
+ * checkArgs('aO', 'my.package.foo', arguments);
+ * // ...
+ * }
+ * @param {String} spec - the type specification for `args` as described above
+ * @param {String} functionName - full name of the callee.
+ * Used in the error message
+ * @param {Array|arguments} args - the arguments to be checked against `spec`
+ * @param {Function} [opt_callee=args.callee] - the recipient of `args`.
+ * Used to extract parameter names for the error message
+ * @throws {TypeError} if args do not satisfy spec
+ */
+function checkArgs (spec, functionName, args, opt_callee) {
+ if (!moduleExports.enableChecks) {
+ return;
+ }
+ var errMsg = null;
+ var typeName;
+ for (var i = 0; i < spec.length; ++i) {
+ var c = spec.charAt(i);
+ var cUpper = c.toUpperCase();
+ var arg = args[i];
+ // Asterix means allow anything.
+ if (c === '*') {
+ continue;
+ }
+ typeName = utils.typeName(arg);
+ if ((arg === null || arg === undefined) && c === cUpper) {
+ continue;
+ }
+ if (typeName !== typeMap[cUpper]) {
+ errMsg = 'Expected ' + typeMap[cUpper];
+ break;
+ }
+ }
+ if (errMsg) {
+ errMsg += ', but got ' + typeName + '.';
+ errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
+ // Don't log when running unit tests.
+ if (typeof jasmine === 'undefined') {
+ console.error(errMsg);
+ }
+ throw TypeError(errMsg);
+ }
+}
+
+function getValue (value, defaultValue) {
+ return value === undefined ? defaultValue : value;
+}
+
+moduleExports.checkArgs = checkArgs;
+moduleExports.getValue = getValue;
+moduleExports.enableChecks = true;
+
+});
+
+// file: src/common/base64.js
+define("cordova/base64", function(require, exports, module) {
+
+var base64 = exports;
+
+base64.fromArrayBuffer = function (arrayBuffer) {
+ var array = new Uint8Array(arrayBuffer);
+ return uint8ToBase64(array);
+};
+
+base64.toArrayBuffer = function (str) {
+ var decodedStr = atob(str);
+ var arrayBuffer = new ArrayBuffer(decodedStr.length);
+ var array = new Uint8Array(arrayBuffer);
+ for (var i = 0, len = decodedStr.length; i < len; i++) {
+ array[i] = decodedStr.charCodeAt(i);
+ }
+ return arrayBuffer;
+};
+
+// ------------------------------------------------------------------------------
+
+/* This code is based on the performance tests at http://jsperf.com/b64tests
+ * This 12-bit-at-a-time algorithm was the best performing version on all
+ * platforms tested.
+ */
+
+var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+var b64_12bit;
+
+var b64_12bitTable = function () {
+ b64_12bit = [];
+ for (var i = 0; i < 64; i++) {
+ for (var j = 0; j < 64; j++) {
+ b64_12bit[i * 64 + j] = b64_6bit[i] + b64_6bit[j];
+ }
+ }
+ b64_12bitTable = function () { return b64_12bit; };
+ return b64_12bit;
+};
+
+function uint8ToBase64 (rawData) {
+ var numBytes = rawData.byteLength;
+ var output = '';
+ var segment;
+ var table = b64_12bitTable();
+ for (var i = 0; i < numBytes - 2; i += 3) {
+ segment = (rawData[i] << 16) + (rawData[i + 1] << 8) + rawData[i + 2];
+ output += table[segment >> 12];
+ output += table[segment & 0xfff];
+ }
+ if (numBytes - i === 2) {
+ segment = (rawData[i] << 16) + (rawData[i + 1] << 8);
+ output += table[segment >> 12];
+ output += b64_6bit[(segment & 0xfff) >> 6];
+ output += '=';
+ } else if (numBytes - i === 1) {
+ segment = (rawData[i] << 16);
+ output += table[segment >> 12];
+ output += '==';
+ }
+ return output;
+}
+
+});
+
+// file: src/common/builder.js
+define("cordova/builder", function(require, exports, module) {
+
+var utils = require('cordova/utils');
+
+function each (objects, func, context) {
+ for (var prop in objects) {
+ if (Object.prototype.hasOwnProperty.call(objects, prop)) {
+ func.apply(context, [objects[prop], prop]);
+ }
+ }
+}
+
+function clobber (obj, key, value) {
+ var needsProperty = false;
+ try {
+ obj[key] = value;
+ } catch (e) {
+ needsProperty = true;
+ }
+ // Getters can only be overridden by getters.
+ if (needsProperty || obj[key] !== value) {
+ utils.defineGetter(obj, key, function () {
+ return value;
+ });
+ }
+}
+
+function assignOrWrapInDeprecateGetter (obj, key, value, message) {
+ if (message) {
+ utils.defineGetter(obj, key, function () {
+ console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
+ return value;
+ });
+ } else {
+ clobber(obj, key, value);
+ }
+}
+
+function include (parent, objects, clobber, merge) {
+ each(objects, function (obj, key) {
+ try {
+ var result = obj.path ? require(obj.path) : {};
+
+ if (clobber) {
+ // Clobber if it doesn't exist.
+ if (typeof parent[key] === 'undefined') {
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ } else if (typeof obj.path !== 'undefined') {
+ // If merging, merge properties onto parent, otherwise, clobber.
+ if (merge) {
+ recursiveMerge(parent[key], result);
+ } else {
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ }
+ }
+ result = parent[key];
+ } else {
+ // Overwrite if not currently defined.
+ if (typeof parent[key] === 'undefined') {
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ } else {
+ // Set result to what already exists, so we can build children into it if they exist.
+ result = parent[key];
+ }
+ }
+
+ if (obj.children) {
+ include(result, obj.children, clobber, merge);
+ }
+ } catch (e) {
+ utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"');
+ }
+ });
+}
+
+/**
+ * Merge properties from one object onto another recursively. Properties from
+ * the src object will overwrite existing target property.
+ *
+ * @param target Object to merge properties into.
+ * @param src Object to merge properties from.
+ */
+function recursiveMerge (target, src) {
+ for (var prop in src) {
+ if (Object.prototype.hasOwnProperty.call(src, prop)) {
+ if (target.prototype && target.prototype.constructor === target) {
+ // If the target object is a constructor override off prototype.
+ clobber(target.prototype, prop, src[prop]);
+ } else {
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
+ } else {
+ clobber(target, prop, src[prop]);
+ }
+ }
+ }
+ }
+}
+
+exports.buildIntoButDoNotClobber = function (objects, target) {
+ include(target, objects, false, false);
+};
+exports.buildIntoAndClobber = function (objects, target) {
+ include(target, objects, true, false);
+};
+exports.buildIntoAndMerge = function (objects, target) {
+ include(target, objects, true, true);
+};
+exports.recursiveMerge = recursiveMerge;
+exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
+
+});
+
+// file: src/common/channel.js
+define("cordova/channel", function(require, exports, module) {
+
+var utils = require('cordova/utils');
+var nextGuid = 1;
+
+/**
+ * Custom pub-sub "channel" that can have functions subscribed to it
+ * This object is used to define and control firing of events for
+ * cordova initialization, as well as for custom events thereafter.
+ *
+ * The order of events during page load and Cordova startup is as follows:
+ *
+ * onDOMContentLoaded* Internal event that is received when the web page is loaded and parsed.
+ * onNativeReady* Internal event that indicates the Cordova native side is ready.
+ * onCordovaReady* Internal event fired when all Cordova JavaScript objects have been created.
+ * onDeviceReady* User event fired to indicate that Cordova is ready
+ * onResume User event fired to indicate a start/resume lifecycle event
+ * onPause User event fired to indicate a pause lifecycle event
+ *
+ * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
+ * All listeners that subscribe after the event is fired will be executed right away.
+ *
+ * The only Cordova events that user code should register for are:
+ * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript
+ * pause App has moved to background
+ * resume App has returned to foreground
+ *
+ * Listeners can be registered as:
+ * document.addEventListener("deviceready", myDeviceReadyListener, false);
+ * document.addEventListener("resume", myResumeListener, false);
+ * document.addEventListener("pause", myPauseListener, false);
+ *
+ * The DOM lifecycle events should be used for saving and restoring state
+ * window.onload
+ * window.onunload
+ *
+ */
+
+/**
+ * Channel
+ * @constructor
+ * @param type String the channel name
+ */
+var Channel = function (type, sticky) {
+ this.type = type;
+ // Map of guid -> function.
+ this.handlers = {};
+ // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired.
+ this.state = sticky ? 1 : 0;
+ // Used in sticky mode to remember args passed to fire().
+ this.fireArgs = null;
+ // Used by onHasSubscribersChange to know if there are any listeners.
+ this.numHandlers = 0;
+ // Function that is called when the first listener is subscribed, or when
+ // the last listener is unsubscribed.
+ this.onHasSubscribersChange = null;
+};
+var channel = {
+ /**
+ * Calls the provided function only after all of the channels specified
+ * have been fired. All channels must be sticky channels.
+ */
+ join: function (h, c) {
+ var len = c.length;
+ var i = len;
+ var f = function () {
+ if (!(--i)) h();
+ };
+ for (var j = 0; j < len; j++) {
+ if (c[j].state === 0) {
+ throw Error('Can only use join with sticky channels.');
+ }
+ c[j].subscribe(f);
+ }
+ if (!len) h();
+ },
+
+ create: function (type) {
+ return (channel[type] = new Channel(type, false));
+ },
+ createSticky: function (type) {
+ return (channel[type] = new Channel(type, true));
+ },
+
+ /**
+ * cordova Channels that must fire before "deviceready" is fired.
+ */
+ deviceReadyChannelsArray: [],
+ deviceReadyChannelsMap: {},
+
+ /**
+ * Indicate that a feature needs to be initialized before it is ready to be used.
+ * This holds up Cordova's "deviceready" event until the feature has been initialized
+ * and Cordova.initComplete(feature) is called.
+ *
+ * @param feature {String} The unique feature name
+ */
+ waitForInitialization: function (feature) {
+ if (feature) {
+ var c = channel[feature] || this.createSticky(feature);
+ this.deviceReadyChannelsMap[feature] = c;
+ this.deviceReadyChannelsArray.push(c);
+ }
+ },
+
+ /**
+ * Indicate that initialization code has completed and the feature is ready to be used.
+ *
+ * @param feature {String} The unique feature name
+ */
+ initializationComplete: function (feature) {
+ var c = this.deviceReadyChannelsMap[feature];
+ if (c) {
+ c.fire();
+ }
+ }
+};
+
+function checkSubscriptionArgument (argument) {
+ if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
+ throw new Error(
+ 'Must provide a function or an EventListener object ' +
+ 'implementing the handleEvent interface.'
+ );
+ }
+}
+
+/**
+ * Subscribes the given function to the channel. Any time that
+ * Channel.fire is called so too will the function.
+ * Optionally specify an execution context for the function
+ * and a guid that can be used to stop subscribing to the channel.
+ * Returns the guid.
+ */
+Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) {
+ checkSubscriptionArgument(eventListenerOrFunction);
+ var handleEvent, guid;
+
+ if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
+ // Received an EventListener object implementing the handleEvent interface
+ handleEvent = eventListenerOrFunction.handleEvent;
+ eventListener = eventListenerOrFunction;
+ } else {
+ // Received a function to handle event
+ handleEvent = eventListenerOrFunction;
+ }
+
+ if (this.state === 2) {
+ handleEvent.apply(eventListener || this, this.fireArgs);
+ return;
+ }
+
+ guid = eventListenerOrFunction.observer_guid;
+ if (typeof eventListener === 'object') {
+ handleEvent = utils.close(eventListener, handleEvent);
+ }
+
+ if (!guid) {
+ // First time any channel has seen this subscriber
+ guid = '' + nextGuid++;
+ }
+ handleEvent.observer_guid = guid;
+ eventListenerOrFunction.observer_guid = guid;
+
+ // Don't add the same handler more than once.
+ if (!this.handlers[guid]) {
+ this.handlers[guid] = handleEvent;
+ this.numHandlers++;
+ if (this.numHandlers === 1) {
+ this.onHasSubscribersChange && this.onHasSubscribersChange();
+ }
+ }
+};
+
+/**
+ * Unsubscribes the function with the given guid from the channel.
+ */
+Channel.prototype.unsubscribe = function (eventListenerOrFunction) {
+ checkSubscriptionArgument(eventListenerOrFunction);
+ var handleEvent, guid, handler;
+
+ if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
+ // Received an EventListener object implementing the handleEvent interface
+ handleEvent = eventListenerOrFunction.handleEvent;
+ } else {
+ // Received a function to handle event
+ handleEvent = eventListenerOrFunction;
+ }
+
+ guid = handleEvent.observer_guid;
+ handler = this.handlers[guid];
+ if (handler) {
+ delete this.handlers[guid];
+ this.numHandlers--;
+ if (this.numHandlers === 0) {
+ this.onHasSubscribersChange && this.onHasSubscribersChange();
+ }
+ }
+};
+
+/**
+ * Calls all functions subscribed to this channel.
+ */
+Channel.prototype.fire = function (e) {
+ var fireArgs = Array.prototype.slice.call(arguments);
+ // Apply stickiness.
+ if (this.state === 1) {
+ this.state = 2;
+ this.fireArgs = fireArgs;
+ }
+ if (this.numHandlers) {
+ // Copy the values first so that it is safe to modify it from within
+ // callbacks.
+ var toCall = [];
+ for (var item in this.handlers) {
+ toCall.push(this.handlers[item]);
+ }
+ for (var i = 0; i < toCall.length; ++i) {
+ toCall[i].apply(this, fireArgs);
+ }
+ if (this.state === 2 && this.numHandlers) {
+ this.numHandlers = 0;
+ this.handlers = {};
+ this.onHasSubscribersChange && this.onHasSubscribersChange();
+ }
+ }
+};
+
+// defining them here so they are ready super fast!
+// DOM event that is received when the web page is loaded and parsed.
+channel.createSticky('onDOMContentLoaded');
+
+// Event to indicate the Cordova native side is ready.
+channel.createSticky('onNativeReady');
+
+// Event to indicate that all Cordova JavaScript objects have been created
+// and it's time to run plugin constructors.
+channel.createSticky('onCordovaReady');
+
+// Event to indicate that all automatically loaded JS plugins are loaded and ready.
+// FIXME remove this
+channel.createSticky('onPluginsReady');
+
+// Event to indicate that Cordova is ready
+channel.createSticky('onDeviceReady');
+
+// Event to indicate a resume lifecycle event
+channel.create('onResume');
+
+// Event to indicate a pause lifecycle event
+channel.create('onPause');
+
+// Channels that must fire before "deviceready" is fired.
+channel.waitForInitialization('onCordovaReady');
+channel.waitForInitialization('onDOMContentLoaded');
+
+module.exports = channel;
+
+});
+
+// file: ../../cordova-js-src/exec.js
+define("cordova/exec", function(require, exports, module) {
+
+/**
+ * Execute a cordova command. It is up to the native side whether this action
+ * is synchronous or asynchronous. The native side can return:
+ * Synchronous: PluginResult object as a JSON string
+ * Asynchronous: Empty string ""
+ * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
+ * depending upon the result of the action.
+ *
+ * @param {Function} success The success callback
+ * @param {Function} fail The fail callback
+ * @param {String} service The name of the service to use
+ * @param {String} action Action to be run in cordova
+ * @param {String[]} [args] Zero or more arguments to pass to the method
+ */
+var cordova = require('cordova');
+var nativeApiProvider = require('cordova/android/nativeapiprovider');
+var utils = require('cordova/utils');
+var base64 = require('cordova/base64');
+var channel = require('cordova/channel');
+var jsToNativeModes = {
+ PROMPT: 0,
+ JS_OBJECT: 1
+};
+var nativeToJsModes = {
+ // Polls for messages using the JS->Native bridge.
+ POLLING: 0,
+ // For LOAD_URL to be viable, it would need to have a work-around for
+ // the bug where the soft-keyboard gets dismissed when a message is sent.
+ LOAD_URL: 1,
+ // For the ONLINE_EVENT to be viable, it would need to intercept all event
+ // listeners (both through addEventListener and window.ononline) as well
+ // as set the navigator property itself.
+ ONLINE_EVENT: 2,
+ EVAL_BRIDGE: 3
+};
+var jsToNativeBridgeMode; // Set lazily.
+var nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE;
+var pollEnabled = false;
+var bridgeSecret = -1;
+
+var messagesFromNative = [];
+var isProcessing = false;
+var resolvedPromise = typeof Promise === 'undefined' ? null : Promise.resolve();
+var nextTick = resolvedPromise ? function (fn) { resolvedPromise.then(fn); } : function (fn) { setTimeout(fn); };
+
+function androidExec (success, fail, service, action, args) {
+ if (bridgeSecret < 0) {
+ // If we ever catch this firing, we'll need to queue up exec()s
+ // and fire them once we get a secret. For now, I don't think
+ // it's possible for exec() to be called since plugins are parsed but
+ // not run until until after onNativeReady.
+ throw new Error('exec() called without bridgeSecret');
+ }
+ // Set default bridge modes if they have not already been set.
+ // By default, we use the failsafe, since addJavascriptInterface breaks too often
+ if (jsToNativeBridgeMode === undefined) {
+ androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
+ }
+
+ // If args is not provided, default to an empty array
+ args = args || [];
+
+ // Process any ArrayBuffers in the args into a string.
+ for (var i = 0; i < args.length; i++) {
+ if (utils.typeName(args[i]) === 'ArrayBuffer') {
+ args[i] = base64.fromArrayBuffer(args[i]);
+ }
+ }
+
+ var callbackId = service + cordova.callbackId++;
+ var argsJson = JSON.stringify(args);
+ if (success || fail) {
+ cordova.callbacks[callbackId] = { success: success, fail: fail };
+ }
+
+ var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);
+ // If argsJson was received by Java as null, try again with the PROMPT bridge mode.
+ // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2. See CB-2666.
+ if (jsToNativeBridgeMode === jsToNativeModes.JS_OBJECT && msgs === '@Null arguments.') {
+ androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
+ androidExec(success, fail, service, action, args);
+ androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
+ } else if (msgs) {
+ messagesFromNative.push(msgs);
+ // Always process async to avoid exceptions messing up stack.
+ nextTick(processMessages);
+ }
+}
+
+androidExec.init = function () {
+ bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
+ channel.onNativeReady.fire();
+};
+
+function pollOnceFromOnlineEvent () {
+ pollOnce(true);
+}
+
+function pollOnce (opt_fromOnlineEvent) {
+ if (bridgeSecret < 0) {
+ // This can happen when the NativeToJsMessageQueue resets the online state on page transitions.
+ // We know there's nothing to retrieve, so no need to poll.
+ return;
+ }
+ var msgs = nativeApiProvider.get().retrieveJsMessages(bridgeSecret, !!opt_fromOnlineEvent);
+ if (msgs) {
+ messagesFromNative.push(msgs);
+ // Process sync since we know we're already top-of-stack.
+ processMessages();
+ }
+}
+
+function pollingTimerFunc () {
+ if (pollEnabled) {
+ pollOnce();
+ setTimeout(pollingTimerFunc, 50);
+ }
+}
+
+function hookOnlineApis () {
+ function proxyEvent (e) {
+ cordova.fireWindowEvent(e.type);
+ }
+ // The network module takes care of firing online and offline events.
+ // It currently fires them only on document though, so we bridge them
+ // to window here (while first listening for exec()-releated online/offline
+ // events).
+ window.addEventListener('online', pollOnceFromOnlineEvent, false);
+ window.addEventListener('offline', pollOnceFromOnlineEvent, false);
+ cordova.addWindowEventHandler('online');
+ cordova.addWindowEventHandler('offline');
+ document.addEventListener('online', proxyEvent, false);
+ document.addEventListener('offline', proxyEvent, false);
+}
+
+hookOnlineApis();
+
+androidExec.jsToNativeModes = jsToNativeModes;
+androidExec.nativeToJsModes = nativeToJsModes;
+
+androidExec.setJsToNativeBridgeMode = function (mode) {
+ if (mode === jsToNativeModes.JS_OBJECT && !window._cordovaNative) {
+ mode = jsToNativeModes.PROMPT;
+ }
+ nativeApiProvider.setPreferPrompt(mode === jsToNativeModes.PROMPT);
+ jsToNativeBridgeMode = mode;
+};
+
+androidExec.setNativeToJsBridgeMode = function (mode) {
+ if (mode === nativeToJsBridgeMode) {
+ return;
+ }
+ if (nativeToJsBridgeMode === nativeToJsModes.POLLING) {
+ pollEnabled = false;
+ }
+
+ nativeToJsBridgeMode = mode;
+ // Tell the native side to switch modes.
+ // Otherwise, it will be set by androidExec.init()
+ if (bridgeSecret >= 0) {
+ nativeApiProvider.get().setNativeToJsBridgeMode(bridgeSecret, mode);
+ }
+
+ if (mode === nativeToJsModes.POLLING) {
+ pollEnabled = true;
+ setTimeout(pollingTimerFunc, 1);
+ }
+};
+
+function buildPayload (payload, message) {
+ var payloadKind = message.charAt(0);
+ if (payloadKind === 's') {
+ payload.push(message.slice(1));
+ } else if (payloadKind === 't') {
+ payload.push(true);
+ } else if (payloadKind === 'f') {
+ payload.push(false);
+ } else if (payloadKind === 'N') {
+ payload.push(null);
+ } else if (payloadKind === 'n') {
+ payload.push(+message.slice(1));
+ } else if (payloadKind === 'A') {
+ var data = message.slice(1);
+ payload.push(base64.toArrayBuffer(data));
+ } else if (payloadKind === 'S') {
+ payload.push(window.atob(message.slice(1)));
+ } else if (payloadKind === 'M') {
+ var multipartMessages = message.slice(1);
+ while (multipartMessages !== '') {
+ var spaceIdx = multipartMessages.indexOf(' ');
+ var msgLen = +multipartMessages.slice(0, spaceIdx);
+ var multipartMessage = multipartMessages.substr(spaceIdx + 1, msgLen);
+ multipartMessages = multipartMessages.slice(spaceIdx + msgLen + 1);
+ buildPayload(payload, multipartMessage);
+ }
+ } else {
+ payload.push(JSON.parse(message));
+ }
+}
+
+// Processes a single message, as encoded by NativeToJsMessageQueue.java.
+function processMessage (message) {
+ var firstChar = message.charAt(0);
+ if (firstChar === 'J') {
+ // This is deprecated on the .java side. It doesn't work with CSP enabled.
+ // eslint-disable-next-line no-eval
+ eval(message.slice(1));
+ } else if (firstChar === 'S' || firstChar === 'F') {
+ var success = firstChar === 'S';
+ var keepCallback = message.charAt(1) === '1';
+ var spaceIdx = message.indexOf(' ', 2);
+ var status = +message.slice(2, spaceIdx);
+ var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1);
+ var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx);
+ var payloadMessage = message.slice(nextSpaceIdx + 1);
+ var payload = [];
+ buildPayload(payload, payloadMessage);
+ cordova.callbackFromNative(callbackId, success, status, payload, keepCallback);
+ } else {
+ console.log('processMessage failed: invalid message: ' + JSON.stringify(message));
+ }
+}
+
+function processMessages () {
+ // Check for the reentrant case.
+ if (isProcessing) {
+ return;
+ }
+ if (messagesFromNative.length === 0) {
+ return;
+ }
+ isProcessing = true;
+ try {
+ var msg = popMessageFromQueue();
+ // The Java side can send a * message to indicate that it
+ // still has messages waiting to be retrieved.
+ if (msg === '*' && messagesFromNative.length === 0) {
+ nextTick(pollOnce);
+ return;
+ }
+ processMessage(msg);
+ } finally {
+ isProcessing = false;
+ if (messagesFromNative.length > 0) {
+ nextTick(processMessages);
+ }
+ }
+}
+
+function popMessageFromQueue () {
+ var messageBatch = messagesFromNative.shift();
+ if (messageBatch === '*') {
+ return '*';
+ }
+
+ var spaceIdx = messageBatch.indexOf(' ');
+ var msgLen = +messageBatch.slice(0, spaceIdx);
+ var message = messageBatch.substr(spaceIdx + 1, msgLen);
+ messageBatch = messageBatch.slice(spaceIdx + msgLen + 1);
+ if (messageBatch) {
+ messagesFromNative.unshift(messageBatch);
+ }
+ return message;
+}
+
+module.exports = androidExec;
+
+});
+
+// file: src/common/exec/proxy.js
+define("cordova/exec/proxy", function(require, exports, module) {
+
+// internal map of proxy function
+var CommandProxyMap = {};
+
+module.exports = {
+
+ // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
+ add: function (id, proxyObj) {
+ console.log('adding proxy for ' + id);
+ CommandProxyMap[id] = proxyObj;
+ return proxyObj;
+ },
+
+ // cordova.commandProxy.remove("Accelerometer");
+ remove: function (id) {
+ var proxy = CommandProxyMap[id];
+ delete CommandProxyMap[id];
+ CommandProxyMap[id] = null;
+ return proxy;
+ },
+
+ get: function (service, action) {
+ return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
+ }
+};
+
+});
+
+// file: src/common/init.js
+define("cordova/init", function(require, exports, module) {
+
+var channel = require('cordova/channel');
+var cordova = require('cordova');
+var modulemapper = require('cordova/modulemapper');
+var platform = require('cordova/platform');
+var pluginloader = require('cordova/pluginloader');
+
+var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
+
+function logUnfiredChannels (arr) {
+ for (var i = 0; i < arr.length; ++i) {
+ if (arr[i].state !== 2) {
+ console.log('Channel not fired: ' + arr[i].type);
+ }
+ }
+}
+
+window.setTimeout(function () {
+ if (channel.onDeviceReady.state !== 2) {
+ console.log('deviceready has not fired after 5 seconds.');
+ logUnfiredChannels(platformInitChannelsArray);
+ logUnfiredChannels(channel.deviceReadyChannelsArray);
+ }
+}, 5000);
+
+if (!window.console) {
+ window.console = {
+ log: function () {}
+ };
+}
+if (!window.console.warn) {
+ window.console.warn = function (msg) {
+ this.log('warn: ' + msg);
+ };
+}
+
+// Register pause, resume and deviceready channels as events on document.
+channel.onPause = cordova.addDocumentEventHandler('pause');
+channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onActivated = cordova.addDocumentEventHandler('activated');
+channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
+
+// Listen for DOMContentLoaded and notify our channel subscribers.
+if (document.readyState === 'complete' || document.readyState === 'interactive') {
+ channel.onDOMContentLoaded.fire();
+} else {
+ document.addEventListener('DOMContentLoaded', function () {
+ channel.onDOMContentLoaded.fire();
+ }, false);
+}
+
+// _nativeReady is global variable that the native side can set
+// to signify that the native code is ready. It is a global since
+// it may be called before any cordova JS is ready.
+if (window._nativeReady) {
+ channel.onNativeReady.fire();
+}
+
+modulemapper.clobbers('cordova', 'cordova');
+modulemapper.clobbers('cordova/exec', 'cordova.exec');
+modulemapper.clobbers('cordova/exec', 'Cordova.exec');
+
+// Call the platform-specific initialization.
+platform.bootstrap && platform.bootstrap();
+
+// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
+// The delay allows the attached modules to be defined before the plugin loader looks for them.
+setTimeout(function () {
+ pluginloader.load(function () {
+ channel.onPluginsReady.fire();
+ });
+}, 0);
+
+/**
+ * Create all cordova objects once native side is ready.
+ */
+channel.join(function () {
+ modulemapper.mapModules(window);
+
+ platform.initialize && platform.initialize();
+
+ // Fire event to notify that all objects are created
+ channel.onCordovaReady.fire();
+
+ // Fire onDeviceReady event once page has fully loaded, all
+ // constructors have run and cordova info has been received from native
+ // side.
+ channel.join(function () {
+ require('cordova').fireDocumentEvent('deviceready');
+ }, channel.deviceReadyChannelsArray);
+}, platformInitChannelsArray);
+
+});
+
+// file: src/common/modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder');
+var moduleMap = define.moduleMap;
+var symbolList;
+var deprecationMap;
+
+exports.reset = function () {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.runs = function (moduleName) {
+ addEntry('r', moduleName, null);
+};
+
+function prepareNamespace (symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ return symbolPath.split('.').reduce(function (cur, part) {
+ return (cur[part] = cur[part] || {});
+ }, context);
+}
+
+exports.mapModules = function (context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var module = require(moduleName);
+ //
+ if (strategy === 'r') {
+ continue;
+ }
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy === 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
+ if (!(symbolPath in origSymbols)) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function (context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.reset();
+
+});
+
+// file: ../../cordova-js-src/platform.js
+define("cordova/platform", function(require, exports, module) {
+
+// The last resume event that was received that had the result of a plugin call.
+var lastResumeEvent = null;
+
+module.exports = {
+ id: 'android',
+ bootstrap: function () {
+ var channel = require('cordova/channel');
+ var cordova = require('cordova');
+ var exec = require('cordova/exec');
+ var modulemapper = require('cordova/modulemapper');
+
+ // Get the shared secret needed to use the bridge.
+ exec.init();
+
+ // TODO: Extract this as a proper plugin.
+ modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app');
+
+ var APP_PLUGIN_NAME = Number(cordova.platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App';
+
+ // Inject a listener for the backbutton on the document.
+ var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
+ backButtonChannel.onHasSubscribersChange = function () {
+ // If we just attached the first handler or detached the last handler,
+ // let native know we need to override the back button.
+ exec(null, null, APP_PLUGIN_NAME, 'overrideBackbutton', [this.numHandlers === 1]);
+ };
+
+ // Add hardware MENU and SEARCH button handlers
+ cordova.addDocumentEventHandler('menubutton');
+ cordova.addDocumentEventHandler('searchbutton');
+
+ function bindButtonChannel (buttonName) {
+ // generic button bind used for volumeup/volumedown buttons
+ var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button');
+ volumeButtonChannel.onHasSubscribersChange = function () {
+ exec(null, null, APP_PLUGIN_NAME, 'overrideButton', [buttonName, this.numHandlers === 1]);
+ };
+ }
+ // Inject a listener for the volume buttons on the document.
+ bindButtonChannel('volumeup');
+ bindButtonChannel('volumedown');
+
+ // The resume event is not "sticky", but it is possible that the event
+ // will contain the result of a plugin call. We need to ensure that the
+ // plugin result is delivered even after the event is fired (CB-10498)
+ var cordovaAddEventListener = document.addEventListener;
+
+ document.addEventListener = function (evt, handler, capture) {
+ cordovaAddEventListener(evt, handler, capture);
+
+ if (evt === 'resume' && lastResumeEvent) {
+ handler(lastResumeEvent);
+ }
+ };
+
+ // Let native code know we are all done on the JS side.
+ // Native code will then un-hide the WebView.
+ channel.onCordovaReady.subscribe(function () {
+ exec(onMessageFromNative, null, APP_PLUGIN_NAME, 'messageChannel', []);
+ exec(null, null, APP_PLUGIN_NAME, 'show', []);
+ });
+ }
+};
+
+function onMessageFromNative (msg) {
+ var cordova = require('cordova');
+ var action = msg.action;
+
+ switch (action) {
+ // pause and resume are Android app life cycle events
+ case 'backbutton':
+ case 'menubutton':
+ case 'searchbutton':
+ case 'pause':
+ case 'volumedownbutton':
+ case 'volumeupbutton':
+ cordova.fireDocumentEvent(action);
+ break;
+ case 'resume':
+ if (arguments.length > 1 && msg.pendingResult) {
+ if (arguments.length === 2) {
+ msg.pendingResult.result = arguments[1];
+ } else {
+ // The plugin returned a multipart message
+ var res = [];
+ for (var i = 1; i < arguments.length; i++) {
+ res.push(arguments[i]);
+ }
+ msg.pendingResult.result = res;
+ }
+
+ // Save the plugin result so that it can be delivered to the js
+ // even if they miss the initial firing of the event
+ lastResumeEvent = msg;
+ }
+ cordova.fireDocumentEvent(action, msg);
+ break;
+ default:
+ throw new Error('Unknown event action ' + action);
+ }
+}
+
+});
+
+// file: ../../cordova-js-src/plugin/android/app.js
+define("cordova/plugin/android/app", function(require, exports, module) {
+
+var exec = require('cordova/exec');
+var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App';
+
+module.exports = {
+ /**
+ * Clear the resource cache.
+ */
+ clearCache: function () {
+ exec(null, null, APP_PLUGIN_NAME, 'clearCache', []);
+ },
+
+ /**
+ * Load the url into the webview or into new browser instance.
+ *
+ * @param url The URL to load
+ * @param props Properties that can be passed in to the activity:
+ * wait: int => wait msec before loading URL
+ * loadingDialog: "Title,Message" => display a native loading dialog
+ * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error
+ * clearHistory: boolean => clear webview history (default=false)
+ * openExternal: boolean => open in a new browser (default=false)
+ *
+ * Example:
+ * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
+ */
+ loadUrl: function (url, props) {
+ exec(null, null, APP_PLUGIN_NAME, 'loadUrl', [url, props]);
+ },
+
+ /**
+ * Cancel loadUrl that is waiting to be loaded.
+ */
+ cancelLoadUrl: function () {
+ exec(null, null, APP_PLUGIN_NAME, 'cancelLoadUrl', []);
+ },
+
+ /**
+ * Clear web history in this web view.
+ * Instead of BACK button loading the previous web page, it will exit the app.
+ */
+ clearHistory: function () {
+ exec(null, null, APP_PLUGIN_NAME, 'clearHistory', []);
+ },
+
+ /**
+ * Go to previous page displayed.
+ * This is the same as pressing the backbutton on Android device.
+ */
+ backHistory: function () {
+ exec(null, null, APP_PLUGIN_NAME, 'backHistory', []);
+ },
+
+ /**
+ * Override the default behavior of the Android back button.
+ * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
+ *
+ * Note: The user should not have to call this method. Instead, when the user
+ * registers for the "backbutton" event, this is automatically done.
+ *
+ * @param override T=override, F=cancel override
+ */
+ overrideBackbutton: function (override) {
+ exec(null, null, APP_PLUGIN_NAME, 'overrideBackbutton', [override]);
+ },
+
+ /**
+ * Override the default behavior of the Android volume button.
+ * If overridden, when the volume button is pressed, the "volume[up|down]button"
+ * JavaScript event will be fired.
+ *
+ * Note: The user should not have to call this method. Instead, when the user
+ * registers for the "volume[up|down]button" event, this is automatically done.
+ *
+ * @param button volumeup, volumedown
+ * @param override T=override, F=cancel override
+ */
+ overrideButton: function (button, override) {
+ exec(null, null, APP_PLUGIN_NAME, 'overrideButton', [button, override]);
+ },
+
+ /**
+ * Exit and terminate the application.
+ */
+ exitApp: function () {
+ return exec(null, null, APP_PLUGIN_NAME, 'exitApp', []);
+ }
+};
+
+});
+
+// file: src/common/pluginloader.js
+define("cordova/pluginloader", function(require, exports, module) {
+
+var modulemapper = require('cordova/modulemapper');
+
+// Helper function to inject a
+
+
+