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..e8658dc
--- /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 || alphabet) 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 || alphabet) 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..a960fa6
--- /dev/null
+++ b/node_modules/big-integer/BigInteger.min.js
@@ -0,0 +1 @@
+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_INT0)return Math.floor(n);return Math.ceil(n)}function add(a,b){var l_a=a.length,l_b=b.length,r=new Array(l_a),carry=0,base=BASE,sum,i;for(i=0;i=base?1:0;r[i]=sum-carry*base}while(i0)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){var l=a.length,r=new Array(l),base=BASE,sum,i;for(i=0;i0){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){var a_l=a.length,b_l=b.length,r=new Array(a_l),borrow=0,base=BASE,i,difference;for(i=0;i=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){var l=a.length,r=new Array(l),carry=-b,base=BASE,i,difference;for(i=0;i=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;i0){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}function useKaratsuba(l1,l2){return-.012*l1-.012*l2+15e-6*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 =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)}carry=0;borrow=0;l=divisor.length;for(i=0;ib_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 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){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}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-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}yDivMod=divModAny(yRem,highestPower2);yDigit=yDivMod[1].toJSNumber();if(ySign){yDigit=highestPower2-1-yDigit}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){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=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"&&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"}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||alphabet)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||alphabet)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}for(var i=0;i<1e3;i++){Integer[i]=parseValue(i);if(i>0)Integer[-i]=parseValue(-i)}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}();if(typeof module!=="undefined"&&module.hasOwnProperty("exports")){module.exports=bigInt}if(typeof define==="function"&&define.amd){define(function(){return bigInt})}
\ No newline at end of file
diff --git a/node_modules/big-integer/LICENSE b/node_modules/big-integer/LICENSE
new file mode 100644
index 0000000..cf1ab25
--- /dev/null
+++ b/node_modules/big-integer/LICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+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 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.
+
+For more information, please refer to
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..742570a
--- /dev/null
+++ b/node_modules/big-integer/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "big-integer",
+ "version": "1.6.52",
+ "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": "^5.3.2",
+ "uglify-js": "^3.17.4"
+ },
+ "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..bb8e6cf
--- /dev/null
+++ b/node_modules/big-integer/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": false,
+ "baseUrl": "./",
+ "moduleResolution": "node",
+ "allowJs": true,
+ "typeRoots": [
+ "./"
+ ],
+ "types": [],
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "BigInteger.d.ts",
+ "spec/tsDefinitions.ts"
+ ]
+}
diff --git a/node_modules/bplist-parser/.npmignore b/node_modules/bplist-parser/.npmignore
new file mode 100644
index 0000000..a9b46ea
--- /dev/null
+++ b/node_modules/bplist-parser/.npmignore
@@ -0,0 +1,8 @@
+/build/*
+node_modules
+*.node
+*.sh
+*.swp
+.lock*
+npm-debug.log
+.idea
diff --git a/node_modules/bplist-parser/README.md b/node_modules/bplist-parser/README.md
new file mode 100644
index 0000000..37e5e1c
--- /dev/null
+++ b/node_modules/bplist-parser/README.md
@@ -0,0 +1,47 @@
+bplist-parser
+=============
+
+Binary Mac OS X Plist (property list) parser.
+
+## Installation
+
+```bash
+$ npm install bplist-parser
+```
+
+## Quick Examples
+
+```javascript
+var bplist = require('bplist-parser');
+
+bplist.parseFile('myPlist.bplist', function(err, obj) {
+ if (err) throw err;
+
+ 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..f8335bc
--- /dev/null
+++ b/node_modules/bplist-parser/bplistParser.js
@@ -0,0 +1,357 @@
+'use strict';
+
+// adapted from http://code.google.com/p/plist/source/browse/trunk/src/com/dd/plist/BinaryPropertyListParser.java
+
+var fs = require('fs');
+var bigInt = require("big-integer");
+var 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.
+var EPOCH = 978307200000;
+
+// UID object definition
+var UID = exports.UID = function(id) {
+ this.UID = id;
+}
+
+var parseFile = exports.parseFile = function (fileNameOrBuffer, callback) {
+ function tryParseBuffer(buffer) {
+ var err = null;
+ var result;
+ try {
+ result = parseBuffer(buffer);
+ } catch (ex) {
+ err = ex;
+ }
+ callback(err, result);
+ }
+
+ if (Buffer.isBuffer(fileNameOrBuffer)) {
+ return tryParseBuffer(fileNameOrBuffer);
+ } else {
+ fs.readFile(fileNameOrBuffer, function (err, data) {
+ if (err) { return callback(err); }
+ tryParseBuffer(data);
+ });
+ }
+};
+
+var parseBuffer = exports.parseBuffer = function (buffer) {
+ var result = {};
+
+ // check header
+ var 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
+ var trailer = buffer.slice(buffer.length - 32, buffer.length);
+ // 6 null bytes (index 0 to 5)
+ var offsetSize = trailer.readUInt8(6);
+ if (debug) {
+ console.log("offsetSize: " + offsetSize);
+ }
+ var objectRefSize = trailer.readUInt8(7);
+ if (debug) {
+ console.log("objectRefSize: " + objectRefSize);
+ }
+ var numObjects = readUInt64BE(trailer, 8);
+ if (debug) {
+ console.log("numObjects: " + numObjects);
+ }
+ var topObject = readUInt64BE(trailer, 16);
+ if (debug) {
+ console.log("topObject: " + topObject);
+ }
+ var offsetTableOffset = readUInt64BE(trailer, 24);
+ if (debug) {
+ console.log("offsetTableOffset: " + offsetTableOffset);
+ }
+
+ if (numObjects > exports.maxObjectCount) {
+ throw new Error("maxObjectCount exceeded");
+ }
+
+ // Handle offset table
+ var offsetTable = [];
+
+ for (var i = 0; i < numObjects; i++) {
+ var 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) {
+ var offset = offsetTable[tableOffset];
+ var type = buffer[offset];
+ var objType = (type & 0xF0) >> 4; //First 4 bits
+ var 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) {
+ var str = '';
+ var i;
+ for (i = 0; i < buffer.length; i++) {
+ if (buffer[i] != 0x00) {
+ break;
+ }
+ }
+ for (; i < buffer.length; i++) {
+ var part = '00' + buffer[i].toString(16);
+ str += part.substr(part.length - 2);
+ }
+ return str;
+ }
+
+ function parseInteger() {
+ var length = Math.pow(2, objInfo);
+ if (length > 4) {
+ var data = buffer.slice(offset + 1, offset + 1 + length);
+ var str = bufferToHexString(data);
+ return bigInt(str, 16);
+ } if (length < exports.maxObjectSize) {
+ return readUInt(buffer.slice(offset + 1, offset + 1 + length));
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseUID() {
+ var length = objInfo + 1;
+ if (length < exports.maxObjectSize) {
+ return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length)));
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseReal() {
+ var length = Math.pow(2, objInfo);
+ if (length < exports.maxObjectSize) {
+ var realBuffer = buffer.slice(offset + 1, offset + 1 + length);
+ if (length === 4) {
+ return realBuffer.readFloatBE(0);
+ }
+ else 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...");
+ }
+ var dateBuffer = buffer.slice(offset + 1, offset + 9);
+ return new Date(EPOCH + (1000 * dateBuffer.readDoubleBE(0)));
+ }
+
+ function parseData() {
+ var dataoffset = 1;
+ var length = objInfo;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var 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);
+ } else {
+ 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;
+ var enc = "utf8";
+ var length = objInfo;
+ var stroffset = 1;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.err("UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var intLength = Math.pow(2, intInfo);
+ var 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) {
+ var plistString = new Buffer(buffer.slice(offset + stroffset, offset + stroffset + length));
+ if (isUtf16) {
+ plistString = swapBytes(plistString);
+ enc = "ucs2";
+ }
+ return plistString.toString(enc);
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseArray() {
+ var length = objInfo;
+ var arrayoffset = 1;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var 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!");
+ }
+ var array = [];
+ for (var i = 0; i < length; i++) {
+ var objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize));
+ array[i] = parseObject(objRef);
+ }
+ return array;
+ }
+
+ function parseDictionary() {
+ var length = objInfo;
+ var dictoffset = 1;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var 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);
+ }
+ var dict = {};
+ for (var i = 0; i < length; i++) {
+ var keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize));
+ var valRef = readUInt(buffer.slice(offset + dictoffset + (length * objectRefSize) + i * objectRefSize, offset + dictoffset + (length * objectRefSize) + (i + 1) * objectRefSize));
+ var key = parseObject(keyRef);
+ var 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;
+
+ var l = 0;
+ for (var 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) {
+ var data = buffer.slice(start, start + 8);
+ return data.readUInt32BE(4, 8);
+}
+
+function swapBytes(buffer) {
+ var len = buffer.length;
+ for (var i = 0; i < len; i += 2) {
+ var 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..2dae784
--- /dev/null
+++ b/node_modules/bplist-parser/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "bplist-parser",
+ "version": "0.1.1",
+ "description": "Binary plist parser.",
+ "main": "bplistParser.js",
+ "scripts": {
+ "test": "./node_modules/nodeunit/bin/nodeunit test"
+ },
+ "keywords": [
+ "bplist",
+ "plist",
+ "parser"
+ ],
+ "author": "Joe Ferner ",
+ "license": "MIT",
+ "devDependencies": {
+ "nodeunit": "~0.9.1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nearinfinity/node-bplist-parser.git"
+ },
+ "dependencies": {
+ "big-integer": "^1.6.7"
+ }
+}
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..67e7bfa
--- /dev/null
+++ b/node_modules/bplist-parser/test/parseTest.js
@@ -0,0 +1,159 @@
+'use strict';
+
+// tests are adapted from https://github.com/TooTallNate/node-plist
+
+var path = require('path');
+var nodeunit = require('nodeunit');
+var bplist = require('../');
+
+module.exports = {
+ 'iTunes Small': function (test) {
+ var file = path.join(__dirname, "iTunes-small.bplist");
+ var startTime1 = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime1) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['Application Version'], "9.0.3");
+ test.equal(dict['Library Persistent ID'], "6F81D37F95101437");
+ test.done();
+ });
+ },
+
+ 'sample1': function (test) {
+ var file = path.join(__dirname, "sample1.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['CFBundleIdentifier'], 'com.apple.dictionary.MySample');
+ test.done();
+ });
+ },
+
+ 'sample2': function (test) {
+ var file = path.join(__dirname, "sample2.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+ var dict = dicts[0];
+ test.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");
+ test.done();
+ });
+ },
+
+ 'airplay': function (test) {
+ var file = path.join(__dirname, "airplay.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.equal(dict['duration'], 5555.0495000000001);
+ test.equal(dict['position'], 4.6269989039999997);
+ test.done();
+ });
+ },
+
+ 'utf16': function (test) {
+ var file = path.join(__dirname, "utf16.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.equal(dict['CFBundleName'], 'sellStuff');
+ test.equal(dict['CFBundleShortVersionString'], '2.6.1');
+ test.equal(dict['NSHumanReadableCopyright'], '©2008-2012, sellStuff, Inc.');
+ test.done();
+ });
+ },
+
+ 'utf16chinese': function (test) {
+ var file = path.join(__dirname, "utf16_chinese.plist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.equal(dict['CFBundleName'], '天翼阅读');
+ test.equal(dict['CFBundleDisplayName'], '天翼阅读');
+ test.done();
+ });
+ },
+
+
+
+ 'uid': function (test) {
+ var file = path.join(__dirname, "uid.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.deepEqual(dict['$objects'][1]['NS.keys'], [{UID:2}, {UID:3}, {UID:4}]);
+ test.deepEqual(dict['$objects'][1]['NS.objects'], [{UID: 5}, {UID:6}, {UID:7}]);
+ test.deepEqual(dict['$top']['root'], {UID:1});
+ test.done();
+ });
+ },
+
+ 'int64': function (test) {
+ var file = path.join(__dirname, "int64.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['zero'], '0');
+ test.equal(dict['int64item'], '12345678901234567890');
+ test.done();
+ });
+ }
+};
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/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-common/.eslintignore b/node_modules/cordova-common/.eslintignore
new file mode 100644
index 0000000..d606f61
--- /dev/null
+++ b/node_modules/cordova-common/.eslintignore
@@ -0,0 +1 @@
+spec/fixtures/*
diff --git a/node_modules/cordova-common/.eslintrc.yml b/node_modules/cordova-common/.eslintrc.yml
new file mode 100644
index 0000000..92aaf67
--- /dev/null
+++ b/node_modules/cordova-common/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+ indent:
+ - error
+ - 4
+ camelcase: off
+ no-unused-vars:
+ - error
+ - args: after-used
diff --git a/node_modules/cordova-common/.github/ISSUE_TEMPLATE.md b/node_modules/cordova-common/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..3220c25
--- /dev/null
+++ b/node_modules/cordova-common/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,42 @@
+
+
+### Issue Type
+
+
+- [ ] Bug Report
+- [ ] Feature Request
+- [ ] Support Question
+
+## Description
+
+## Information
+
+
+### Command or Code
+
+
+### Environment, Platform, Device
+
+
+
+
+### Version information
+
+
+
+
+## Checklist
+
+
+- [ ] I searched for already existing GitHub issues about this
+- [ ] I updated all Cordova tooling to their most recent version
+- [ ] I included all the necessary information above
diff --git a/node_modules/cordova-common/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/node_modules/cordova-common/.github/ISSUE_TEMPLATE/BUG_REPORT.md
new file mode 100644
index 0000000..bd8a3ac
--- /dev/null
+++ b/node_modules/cordova-common/.github/ISSUE_TEMPLATE/BUG_REPORT.md
@@ -0,0 +1,50 @@
+---
+name: 🐛 Bug Report
+about: If something isn't working as expected.
+
+---
+
+# Bug Report
+
+## Problem
+
+### What is expected to happen?
+
+
+
+### What does actually happen?
+
+
+
+## Information
+
+
+
+
+### Command or Code
+
+
+
+
+### Environment, Platform, Device
+
+
+
+
+### Version information
+
+
+
+
+## Checklist
+
+
+- [ ] I searched for existing GitHub issues
+- [ ] I updated all Cordova tooling to most recent version
+- [ ] I included all the necessary information above
diff --git a/node_modules/cordova-common/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/node_modules/cordova-common/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
new file mode 100644
index 0000000..381fc8a
--- /dev/null
+++ b/node_modules/cordova-common/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
@@ -0,0 +1,29 @@
+---
+name: 🚀 Feature Request
+about: A suggestion for a new functionality
+
+---
+
+# Feature Request
+
+## Motivation Behind Feature
+
+
+
+
+## Feature Description
+
+
+
+
+## Alternatives or Workarounds
+
+
+
diff --git a/node_modules/cordova-common/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md b/node_modules/cordova-common/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md
new file mode 100644
index 0000000..516c6e6
--- /dev/null
+++ b/node_modules/cordova-common/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md
@@ -0,0 +1,27 @@
+---
+name: 💬 Support Question
+about: If you have a question, please check out our Slack or StackOverflow!
+
+---
+
+
+
+Apache Cordova uses GitHub Issues as a feature request and bug tracker _only_.
+For usage and support questions, please check out the resources below. Thanks!
+
+---
+
+You can get answers to your usage and support questions about **Apache Cordova** on:
+
+* Slack Community Chat: https://cordova.slack.com (you can sign-up at http://slack.cordova.io/)
+* StackOverflow: https://stackoverflow.com/questions/tagged/cordova using the tag `cordova`
+
+---
+
+If you are using a tool that uses Cordova internally, like e.g. Ionic, check their support channels:
+
+* **Ionic Framework**
+ * [Ionic Community Forum](https://forum.ionicframework.com/)
+ * [Ionic Worldwide Slack](https://ionicworldwide.herokuapp.com/)
+* **PhoneGap**
+ * [PhoneGap Developer Community](https://forums.adobe.com/community/phonegap)
diff --git a/node_modules/cordova-common/.github/PULL_REQUEST_TEMPLATE.md b/node_modules/cordova-common/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..712b2ff
--- /dev/null
+++ b/node_modules/cordova-common/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,35 @@
+
+
+### Platforms affected
+
+
+
+### Motivation and Context
+
+
+
+
+
+### Description
+
+
+
+
+### Testing
+
+
+
+
+### Checklist
+
+- [ ] I've run the tests to see all new and existing tests pass
+- [ ] I added automated test coverage as appropriate for this change
+- [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
+- [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
+- [ ] I've updated the documentation if necessary
diff --git a/node_modules/cordova-common/.ratignore b/node_modules/cordova-common/.ratignore
new file mode 100644
index 0000000..6ad2449
--- /dev/null
+++ b/node_modules/cordova-common/.ratignore
@@ -0,0 +1,5 @@
+fixtures
+coverage
+jasmine.json
+appveyor.yml
+package-lock.json
diff --git a/node_modules/cordova-common/.travis.yml b/node_modules/cordova-common/.travis.yml
new file mode 100644
index 0000000..2361f5d
--- /dev/null
+++ b/node_modules/cordova-common/.travis.yml
@@ -0,0 +1,22 @@
+language: node_js
+sudo: false
+
+git:
+ depth: 10
+
+node_js:
+ - 6
+ - 8
+ - 10
+ - 12
+
+install:
+ - npm install
+ - npm install -g codecov
+
+script:
+ - npm test
+ - npm run cover
+
+after_script:
+ - codecov
diff --git a/node_modules/cordova-common/README.md b/node_modules/cordova-common/README.md
new file mode 100644
index 0000000..422c98b
--- /dev/null
+++ b/node_modules/cordova-common/README.md
@@ -0,0 +1,155 @@
+
+
+[](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-common/branch/master)
+[](https://travis-ci.org/apache/cordova-common)
+[](https://nodei.co/npm/cordova-common/)
+
+# cordova-common
+Exposes shared functionality used by [cordova-lib](https://github.com/apache/cordova-lib/) and Cordova platforms.
+## Exposed APIs
+
+### `events`
+
+Represents special instance of NodeJS EventEmitter which is intended to be used to post events to cordova-lib and cordova-cli
+
+Usage:
+```js
+var events = require('cordova-common').events;
+events.emit('warn', 'Some warning message')
+```
+
+There are the following events supported by cordova-cli: `verbose`, `log`, `info`, `warn`, `error`.
+
+### `CordovaError`
+
+An error class used by Cordova to throw cordova-specific errors. The CordovaError class is inherited from Error, so CordovaError instances is also valid Error instances (`instanceof` check succeeds).
+
+Usage:
+
+```js
+var CordovaError = require('cordova-common').CordovaError;
+throw new CordovaError('Some error message', SOME_ERR_CODE);
+```
+
+See [CordovaError](src/CordovaError/CordovaError.js) for supported error codes.
+
+### `ConfigParser`
+
+Exposes functionality to deal with cordova project `config.xml` files. For ConfigParser API reference check [ConfigParser Readme](src/ConfigParser/README.md).
+
+Usage:
+```js
+var ConfigParser = require('cordova-common').ConfigParser;
+var appConfig = new ConfigParser('path/to/cordova-app/config.xml');
+console.log(appconfig.name() + ':' + appConfig.version());
+```
+
+### `PluginInfoProvider` and `PluginInfo`
+
+`PluginInfo` is a wrapper for cordova plugins' `plugin.xml` files. This class may be instantiated directly or via `PluginInfoProvider`. The difference is that `PluginInfoProvider` caches `PluginInfo` instances based on plugin source directory.
+
+Usage:
+```js
+var PluginInfo: require('cordova-common').PluginInfo;
+var PluginInfoProvider: require('cordova-common').PluginInfoProvider;
+
+// The following instances are equal
+var plugin1 = new PluginInfo('path/to/plugin_directory');
+var plugin2 = new PluginInfoProvider().get('path/to/plugin_directory');
+
+console.log('The plugin ' + plugin1.id + ' has version ' + plugin1.version)
+```
+
+### `ActionStack`
+
+Utility module for dealing with sequential tasks. Provides a set of tasks that are needed to be done and reverts all tasks that are already completed if one of those tasks fail to complete. Used internally by cordova-lib and platform's plugin installation routines.
+
+Usage:
+```js
+var ActionStack = require('cordova-common').ActionStack;
+var stack = new ActionStack()
+
+var action1 = stack.createAction(task1, [], task1_reverter, []);
+var action2 = stack.createAction(task2, [], task2_reverter, []);
+
+stack.push(action1);
+stack.push(action2);
+
+stack.process()
+.then(function() {
+ // all actions succeded
+})
+.catch(function(error){
+ // One of actions failed with error
+})
+```
+
+### `superspawn`
+
+Module for spawning child processes with some advanced logic.
+
+Usage:
+```js
+var superspawn = require('cordova-common').superspawn;
+superspawn.spawn('adb', ['devices'])
+.progress(function(data){
+ if (data.stderr)
+ console.error('"adb devices" raised an error: ' + data.stderr);
+})
+.then(function(devices){
+ // Do something...
+})
+```
+
+### `xmlHelpers`
+
+A set of utility methods for dealing with XML files.
+
+Usage:
+```js
+var xml = require('cordova-common').xmlHelpers;
+
+var xmlDoc1 = xml.parseElementtreeSync('some/xml/file');
+var xmlDoc2 = xml.parseElementtreeSync('another/xml/file');
+
+xml.mergeXml(doc1, doc2); // doc2 now contains all the nodes from doc1
+```
+
+### Other APIs
+
+The APIs listed below are also exposed but are intended to be only used internally by cordova plugin installation routines.
+
+```
+PlatformJson
+ConfigChanges
+ConfigKeeper
+ConfigFile
+mungeUtil
+```
+
+## Setup
+* Clone this repository onto your local machine
+ `git clone https://github.com/apache/cordova-common.git`
+* Navigate to cordova-common directory, install dependencies and npm-link
+ `cd cordova-common && npm install && npm link`
+* Navigate to cordova-lib directory and link cordova-common
+ `cd && npm link cordova-common && npm install`
diff --git a/node_modules/cordova-common/RELEASENOTES.md b/node_modules/cordova-common/RELEASENOTES.md
new file mode 100644
index 0000000..139eec2
--- /dev/null
+++ b/node_modules/cordova-common/RELEASENOTES.md
@@ -0,0 +1,175 @@
+
+# Cordova-common Release Notes
+
+### 3.2.1 (Oct 28, 2019)
+
+* [GH-78](https://github.com/apache/cordova-common/pull/78) (windows) Add `.jsproj` as file extension for XML files ([GH-62](https://github.com/apache/cordova-common/pull/62))
+* [GH-89](https://github.com/apache/cordova-common/pull/89) revert: ([GH-24](https://github.com/apache/cordova-common/pull/24)) [CB-14108](https://issues.apache.org/jira/browse/CB-14108) fix incorrect count in `config_munge`
+* [GH-82](https://github.com/apache/cordova-common/pull/82) General cleanup with eslint updates
+* [GH-86](https://github.com/apache/cordova-common/pull/86) eslint cleanup fixes: `operator-linebreak`
+* [GH-81](https://github.com/apache/cordova-common/pull/81) remove `no-throw-literal` lint exception not needed
+* [GH-83](https://github.com/apache/cordova-common/pull/83) Fix ESLint violations where applicable
+* [GH-80](https://github.com/apache/cordova-common/pull/80) Update to jasmine 3.4 & fix resulting spec failures
+* [GH-79](https://github.com/apache/cordova-common/pull/79) Promise handling cleanup in specs
+* [GH-77](https://github.com/apache/cordova-common/pull/77) Do not ignore AppVeyor failures on Node.js 12
+
+### 3.2.0 (Jun 12, 2019)
+* (ios) plist document not indented with tabs ([#69](https://github.com/apache/cordova-common/pull/69))
+* Update fs-extra to v8 ([#70](https://github.com/apache/cordova-common/pull/70))
+* Add example usage of podspec declarations ([#67](https://github.com/apache/cordova-common/pull/67))
+* implement setPreference and setPlatformPreference ([#63](https://github.com/apache/cordova-common/pull/63))
+* Catch leaked exceptions in superspawn and convert them to rejections ([#66](https://github.com/apache/cordova-common/pull/66))
+
+### 3.1.0 (Dec 24, 2018)
+* Update Cordova events into a real singleton class ([#60](https://github.com/apache/cordova-common/pull/60))
+* Refactor CordovaLogger to singleton class ([#53](https://github.com/apache/cordova-common/pull/53))
+
+### 3.0.0 (Nov 05, 2018)
+* [CB-14166](https://issues.apache.org/jira/browse/CB-14166) Use `cross-spawn` for platform-independent spawning
+* add `PluginInfo.getPodSpecs` method
+* [CB-13496](https://issues.apache.org/jira/browse/CB-13496) Fix greedy regex in plist-helpers
+* [CB-14108](https://issues.apache.org/jira/browse/CB-14108) fix incorrect count in config_munge in ios.json and android.json
+* [CB-13685](https://issues.apache.org/jira/browse/CB-13685) **Android**: Update ConfigParser for Adaptive Icons
+* [CB-10071](https://issues.apache.org/jira/browse/CB-10071) Add BridgingHeader type attributes for header-file
+* [CB-12016](https://issues.apache.org/jira/browse/CB-12016) Removed cordova-registry-mapper dependency
+* [CB-14099](https://issues.apache.org/jira/browse/CB-14099) **osx**: Fixed Resolve Config Path for OSX
+* [CB-14140](https://issues.apache.org/jira/browse/CB-14140) Replace shelljs calls with fs-extra & which
+
+### 2.2.2 (May 30, 2018)
+* [CB-13979](https://issues.apache.org/jira/browse/CB-13979) More consistency for `config.xml` lookups
+* [CB-14064](https://issues.apache.org/jira/browse/CB-14064) Remove Node 4 from CI matrix
+* [CB-14088](https://issues.apache.org/jira/browse/CB-14088) Update dependencies
+* [CB-11691](https://issues.apache.org/jira/browse/CB-11691) Fix for modifying binary plists
+* [CB-13770](https://issues.apache.org/jira/browse/CB-13770) Warn when or not found
+* [CB-13471](https://issues.apache.org/jira/browse/CB-13471) Fix tests and path issues for **Windows**
+* [CB-13471](https://issues.apache.org/jira/browse/CB-13471) added unit test for config file provider
+* [CB-13744](https://issues.apache.org/jira/browse/CB-13744) Recognize storyboards as XML files
+* [CB-13674](https://issues.apache.org/jira/browse/CB-13674) Incremented package version to -dev
+
+### 2.2.1 (Dec 14, 2017)
+* [CB-13674](https://issues.apache.org/jira/browse/CB-13674): updated dependencies
+
+### 2.2.0 (Nov 22, 2017)
+* [CB-13471](https://issues.apache.org/jira/browse/CB-13471) File Provider fix belongs in cordova-common
+* [CB-11244](https://issues.apache.org/jira/browse/CB-11244) Spot fix for upcoming `cordova-android@7` changes. https://github.com/apache/cordova-android/pull/389
+
+### 2.1.1 (Oct 04, 2017)
+* [CB-13145](https://issues.apache.org/jira/browse/CB-13145) added `getFrameworks` to unit tests
+* [CB-13145](https://issues.apache.org/jira/browse/CB-13145) added variable replacing to framework tag
+
+### 2.1.0 (August 30, 2017)
+* [CB-13145](https://issues.apache.org/jira/browse/CB-13145) added variable replacing to `framework` tag
+* [CB-13211](https://issues.apache.org/jira/browse/CB-13211) Add `allows-arbitrary-loads-for-media` attribute parsing for `getAccesses`
+* [CB-11968](https://issues.apache.org/jira/browse/CB-11968) Added support for `` in `config.xml`
+* [CB-12895](https://issues.apache.org/jira/browse/CB-12895) set up `eslint` and removed `jshint`
+* [CB-12785](https://issues.apache.org/jira/browse/CB-12785) added `.gitignore`, `travis`, and `appveyor` support
+* [CB-12250](https://issues.apache.org/jira/browse/CB-12250) & [CB-12409](https://issues.apache.org/jira/browse/CB-12409) *iOS*: Fix bug with escaping properties from `plist` file
+* [CB-12762](https://issues.apache.org/jira/browse/CB-12762) updated `common`, `fetch`, and `serve` `pkgJson` to point `pkgJson` repo items to github mirrors
+* [CB-12766](https://issues.apache.org/jira/browse/CB-12766) Consistently write `JSON` with 2 spaces indentation
+
+### 2.0.3 (May 02, 2017)
+* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Add option to get `resource-file` from `root`
+* [CB-11908](https://issues.apache.org/jira/browse/CB-11908) Add tests for `edit-config` in `config.xml`
+* [CB-12665](https://issues.apache.org/jira/browse/CB-12665) removed `enginestrict` since it is deprecated
+
+### 2.0.2 (Apr 14, 2017)
+* [CB-11233](https://issues.apache.org/jira/browse/CB-11233) - Support installing frameworks into 'Embedded Binaries' section of the Xcode project
+* [CB-10438](https://issues.apache.org/jira/browse/CB-10438) - Install correct dependency version. Removed shell.remove, added pkg.json to dependency tests 1-3, and updated install.js (.replace) to fix tests in uninstall.spec.js and update to workw with jasmine 2.0
+* [CB-11120](https://issues.apache.org/jira/browse/CB-11120) - Allow short/display name in config.xml
+* [CB-11346](https://issues.apache.org/jira/browse/CB-11346) - Remove known platforms check
+* [CB-11977](https://issues.apache.org/jira/browse/CB-11977) - updated engines and enginescript for common, fetch, and serve
+
+### 2.0.1 (Mar 09, 2017)
+* [CB-12557](https://issues.apache.org/jira/browse/CB-12557) add both stdout and stderr properties to the error object passed to superspawn reject handler.
+
+### 2.0.0 (Jan 17, 2017)
+* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Add `resource-file` parsing to `config.xml`
+* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated `jshint` and updated tests to work with `jasmine@2` instead of `jasmine-node`
+* [CB-12163](https://issues.apache.org/jira/browse/CB-12163) Add reference attrib to `resource-file` for **Windows**
+* Move windows-specific logic to `cordova-windows`
+* [CB-12189](https://issues.apache.org/jira/browse/CB-12189) Add implementation attribute to framework
+
+### 1.5.1 (Oct 12, 2016)
+* [CB-12002](https://issues.apache.org/jira/browse/CB-12002) Add `getAllowIntents()` to `ConfigParser`
+* [CB-11998](https://issues.apache.org/jira/browse/CB-11998) `cordova platform add` error with `cordova-common@1.5.0`
+
+### 1.5.0 (Oct 06, 2016)
+* [CB-11776](https://issues.apache.org/jira/browse/CB-11776) Add test case for different `edit-config` targets
+* [CB-11908](https://issues.apache.org/jira/browse/CB-11908) Add `edit-config` to `config.xml`
+* [CB-11936](https://issues.apache.org/jira/browse/CB-11936) Support four new **App Transport Security (ATS)** keys
+* update `config.xml` location if it is a **Android Studio** project.
+* use `array` methods and `object.keys` for iterating. avoiding `for-in` loops
+* [CB-11517](https://issues.apache.org/jira/browse/CB-11517) Allow `.folder` matches
+* [CB-11776](https://issues.apache.org/jira/browse/CB-11776) check `edit-config` target exists
+
+### 1.4.1 (Aug 09, 2016)
+* Add general purpose `ConfigParser.getAttribute` API
+* [CB-11653](https://issues.apache.org/jira/browse/CB-11653) moved `findProjectRoot` from `cordova-lib` to `cordova-common`
+* [CB-11636](https://issues.apache.org/jira/browse/CB-11636) Handle attributes with quotes correctly
+* [CB-11645](https://issues.apache.org/jira/browse/CB-11645) added check to see if `getEditConfig` exists before trying to use it
+* [CB-9825](https://issues.apache.org/jira/browse/CB-9825) framework tag spec parsing
+
+### 1.4.0 (Jul 12, 2016)
+* [CB-11023](https://issues.apache.org/jira/browse/CB-11023) Add edit-config functionality
+
+### 1.3.0 (May 12, 2016)
+* [CB-11259](https://issues.apache.org/jira/browse/CB-11259): Improving prepare and build logging
+* [CB-11194](https://issues.apache.org/jira/browse/CB-11194) Improve cordova load time
+* [CB-1117](https://issues.apache.org/jira/browse/CB-1117) Add `FileUpdater` module to `cordova-common`.
+* [CB-11131](https://issues.apache.org/jira/browse/CB-11131) Fix `TypeError: message.toUpperCase` is not a function in `CordovaLogger`
+
+### 1.2.0 (Apr 18, 2016)
+* [CB-11022](https://issues.apache.org/jira/browse/CB-11022) Save modulesMetadata to both www and platform_www when necessary
+* [CB-10833](https://issues.apache.org/jira/browse/CB-10833) Deduplicate common logic for plugin installation/uninstallation
+* [CB-10822](https://issues.apache.org/jira/browse/CB-10822) Manage plugins/modules metadata using PlatformJson
+* [CB-10940](https://issues.apache.org/jira/browse/CB-10940) Can't add Android platform from path
+* [CB-10965](https://issues.apache.org/jira/browse/CB-10965) xml helper allows multiple instances to be merge in config.xml
+
+### 1.1.1 (Mar 18, 2016)
+* [CB-10694](https://issues.apache.org/jira/browse/CB-10694) Update test to reflect merging of [CB-9264](https://issues.apache.org/jira/browse/CB-9264) fix
+* [CB-10694](https://issues.apache.org/jira/browse/CB-10694) Platform-specific configuration preferences don't override global settings
+* [CB-9264](https://issues.apache.org/jira/browse/CB-9264) Duplicate entries in `config.xml`
+* [CB-10791](https://issues.apache.org/jira/browse/CB-10791) Add `adjustLoggerLevel` to `cordova-common.CordovaLogger`
+* [CB-10662](https://issues.apache.org/jira/browse/CB-10662) Add tests for `ConfigParser.getStaticResources`
+* [CB-10622](https://issues.apache.org/jira/browse/CB-10622) fix target attribute being ignored for images in `config.xml`.
+* [CB-10583](https://issues.apache.org/jira/browse/CB-10583) Protect plugin preferences from adding extra Array properties.
+
+### 1.1.0 (Feb 16, 2016)
+* [CB-10482](https://issues.apache.org/jira/browse/CB-10482) Remove references to windows8 from cordova-lib/cli
+* [CB-10430](https://issues.apache.org/jira/browse/CB-10430) Adds forwardEvents method to easily connect two EventEmitters
+* [CB-10176](https://issues.apache.org/jira/browse/CB-10176) Adds CordovaLogger class, based on logger module from cordova-cli
+* [CB-10052](https://issues.apache.org/jira/browse/CB-10052) Expose child process' io streams via promise progress notification
+* [CB-10497](https://issues.apache.org/jira/browse/CB-10497) Prefer .bat over .cmd on windows platform
+* [CB-9984](https://issues.apache.org/jira/browse/CB-9984) Bumps plist version and fixes failing cordova-common test
+
+### 1.0.0 (Oct 29, 2015)
+
+* [CB-9890](https://issues.apache.org/jira/browse/CB-9890) Documents cordova-common
+* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Correct cordova-lib -> cordova-common in README
+* Pick ConfigParser changes from apache@0c3614e
+* [CB-9743](https://issues.apache.org/jira/browse/CB-9743) Removes system frameworks handling from ConfigChanges
+* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Cleans out code which has been moved to `cordova-common`
+* Pick ConfigParser changes from apache@ddb027b
+* Picking CordovaError changes from apache@a3b1fca
+* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Adds tests and fixtures based on existing cordova-lib ones
+* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Initial implementation for cordova-common
+
diff --git a/node_modules/cordova-common/appveyor.yml b/node_modules/cordova-common/appveyor.yml
new file mode 100644
index 0000000..5267502
--- /dev/null
+++ b/node_modules/cordova-common/appveyor.yml
@@ -0,0 +1,22 @@
+# appveyor file
+# http://www.appveyor.com/docs/appveyor-yml
+
+shallow_clone: true
+
+environment:
+ matrix:
+ - nodejs_version: 6
+ - nodejs_version: 8
+ - nodejs_version: 10
+ - nodejs_version: 12
+
+install:
+ - ps: Install-Product node $env:nodejs_version
+ - npm install
+
+build: off
+
+test_script:
+ - node --version
+ - npm --version
+ - npm test
diff --git a/node_modules/cordova-common/cordova-common.js b/node_modules/cordova-common/cordova-common.js
new file mode 100644
index 0000000..801d510
--- /dev/null
+++ b/node_modules/cordova-common/cordova-common.js
@@ -0,0 +1,47 @@
+/**
+ 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 addProperty = require('./src/util/addProperty');
+
+module.exports = { };
+
+addProperty(module, 'events', './src/events');
+addProperty(module, 'superspawn', './src/superspawn');
+
+addProperty(module, 'ActionStack', './src/ActionStack');
+addProperty(module, 'CordovaError', './src/CordovaError/CordovaError');
+addProperty(module, 'CordovaLogger', './src/CordovaLogger');
+addProperty(module, 'CordovaCheck', './src/CordovaCheck');
+addProperty(module, 'CordovaExternalToolErrorContext', './src/CordovaError/CordovaExternalToolErrorContext');
+addProperty(module, 'PlatformJson', './src/PlatformJson');
+addProperty(module, 'ConfigParser', './src/ConfigParser/ConfigParser');
+addProperty(module, 'FileUpdater', './src/FileUpdater');
+
+addProperty(module, 'PluginInfo', './src/PluginInfo/PluginInfo');
+addProperty(module, 'PluginInfoProvider', './src/PluginInfo/PluginInfoProvider');
+
+addProperty(module, 'PluginManager', './src/PluginManager');
+
+addProperty(module, 'ConfigChanges', './src/ConfigChanges/ConfigChanges');
+addProperty(module, 'ConfigKeeper', './src/ConfigChanges/ConfigKeeper');
+addProperty(module, 'ConfigFile', './src/ConfigChanges/ConfigFile');
+addProperty(module, 'mungeUtil', './src/ConfigChanges/munge-util');
+
+addProperty(module, 'xmlHelpers', './src/util/xml-helpers');
+
diff --git a/node_modules/cordova-common/package.json b/node_modules/cordova-common/package.json
new file mode 100644
index 0000000..fb0b0e0
--- /dev/null
+++ b/node_modules/cordova-common/package.json
@@ -0,0 +1,56 @@
+{
+ "author": "Apache Software Foundation",
+ "name": "cordova-common",
+ "description": "Apache Cordova tools and platforms shared routines",
+ "license": "Apache-2.0",
+ "version": "3.2.1",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/apache/cordova-common"
+ },
+ "bugs": {
+ "url": "https://issues.apache.org/jira/browse/CB",
+ "email": "dev@cordova.apache.org"
+ },
+ "main": "cordova-common.js",
+ "engines": {
+ "node": ">=6.0.0"
+ },
+ "scripts": {
+ "test": "npm run eslint && npm run jasmine",
+ "eslint": "eslint src spec",
+ "jasmine": "jasmine JASMINE_CONFIG_PATH=spec/support/jasmine.json",
+ "cover": "istanbul cover --root src --print detail jasmine"
+ },
+ "dependencies": {
+ "ansi": "^0.3.1",
+ "bplist-parser": "^0.1.0",
+ "cross-spawn": "^6.0.5",
+ "elementtree": "0.1.7",
+ "endent": "^1.1.1",
+ "fs-extra": "^8.0.0",
+ "glob": "^7.1.2",
+ "minimatch": "^3.0.0",
+ "plist": "^3.0.1",
+ "q": "^1.4.1",
+ "strip-bom": "^3.0.0",
+ "underscore": "^1.8.3",
+ "which": "^1.3.0"
+ },
+ "devDependencies": {
+ "eslint": "^5.0.0",
+ "eslint-config-semistandard": "^14.0.0",
+ "eslint-config-standard": "^13.0.1",
+ "eslint-plugin-import": "^2.14.0",
+ "eslint-plugin-node": "^8.0.0",
+ "eslint-plugin-promise": "^4.0.0",
+ "eslint-plugin-standard": "^4.0.0",
+ "istanbul": "^0.4.5",
+ "jasmine": "^3.4.0",
+ "jasmine-spec-reporter": "^4.2.1",
+ "osenv": "^0.1.3",
+ "promise-matchers": "^0.9.6",
+ "rewire": "^4.0.1"
+ },
+ "contributors": []
+}
diff --git a/node_modules/cordova-common/src/ActionStack.js b/node_modules/cordova-common/src/ActionStack.js
new file mode 100644
index 0000000..6983c5c
--- /dev/null
+++ b/node_modules/cordova-common/src/ActionStack.js
@@ -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.
+*/
+
+/* jshint quotmark:false */
+
+var events = require('./events');
+var Q = require('q');
+
+function ActionStack () {
+ this.stack = [];
+ this.completed = [];
+}
+
+ActionStack.prototype = {
+ createAction: function (handler, action_params, reverter, revert_params) {
+ return {
+ handler: {
+ run: handler,
+ params: action_params
+ },
+ reverter: {
+ run: reverter,
+ params: revert_params
+ }
+ };
+ },
+ push: function (tx) {
+ this.stack.push(tx);
+ },
+ // Returns a promise.
+ process: function (platform) {
+ events.emit('verbose', 'Beginning processing of action stack for ' + platform + ' project...');
+
+ while (this.stack.length) {
+ var action = this.stack.shift();
+ var handler = action.handler.run;
+ var action_params = action.handler.params;
+
+ try {
+ handler.apply(null, action_params);
+ } catch (e) {
+ events.emit('warn', 'Error during processing of action! Attempting to revert...');
+ this.stack.unshift(action);
+ var issue = 'Uh oh!\n';
+ // revert completed tasks
+ while (this.completed.length) {
+ var undo = this.completed.shift();
+ var revert = undo.reverter.run;
+ var revert_params = undo.reverter.params;
+
+ try {
+ revert.apply(null, revert_params);
+ } catch (err) {
+ events.emit('warn', 'Error during reversion of action! We probably really messed up your project now, sorry! D:');
+ issue += 'A reversion action failed: ' + err.message + '\n';
+ }
+ }
+ e.message = issue + e.message;
+ return Q.reject(e);
+ }
+ this.completed.push(action);
+ }
+ events.emit('verbose', 'Action stack processing complete.');
+
+ return Q();
+ }
+};
+
+module.exports = ActionStack;
diff --git a/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js b/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
new file mode 100644
index 0000000..27c2d9e
--- /dev/null
+++ b/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
@@ -0,0 +1,426 @@
+/**
+ 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.
+*/
+
+/*
+ * This module deals with shared configuration / dependency "stuff". That is:
+ * - XML configuration files such as config.xml, AndroidManifest.xml or WMAppManifest.xml.
+ * - plist files in iOS
+ * Essentially, any type of shared resources that we need to handle with awareness
+ * of how potentially multiple plugins depend on a single shared resource, should be
+ * handled in this module.
+ *
+ * The implementation uses an object as a hash table, with "leaves" of the table tracking
+ * reference counts.
+ */
+
+var path = require('path');
+var et = require('elementtree');
+var ConfigKeeper = require('./ConfigKeeper');
+var events = require('../events');
+
+var mungeutil = require('./munge-util');
+var xml_helpers = require('../util/xml-helpers');
+
+exports.PlatformMunger = PlatformMunger;
+
+exports.process = function (plugins_dir, project_dir, platform, platformJson, pluginInfoProvider) {
+ var munger = new PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider);
+ munger.process(plugins_dir);
+ munger.save_all();
+};
+
+/******************************************************************************
+* PlatformMunger class
+*
+* Can deal with config file of a single project.
+* Parsed config files are cached in a ConfigKeeper object.
+******************************************************************************/
+function PlatformMunger (platform, project_dir, platformJson, pluginInfoProvider) {
+ this.platform = platform;
+ this.project_dir = project_dir;
+ this.config_keeper = new ConfigKeeper(project_dir);
+ this.platformJson = platformJson;
+ this.pluginInfoProvider = pluginInfoProvider;
+}
+
+// Write out all unsaved files.
+PlatformMunger.prototype.save_all = PlatformMunger_save_all;
+function PlatformMunger_save_all () {
+ this.config_keeper.save_all();
+ this.platformJson.save();
+}
+
+// Apply a munge object to a single config file.
+// The remove parameter tells whether to add the change or remove it.
+PlatformMunger.prototype.apply_file_munge = PlatformMunger_apply_file_munge;
+function PlatformMunger_apply_file_munge (file, munge, remove) {
+ var self = this;
+
+ for (var selector in munge.parents) {
+ for (var xml_child in munge.parents[selector]) {
+ // this xml child is new, graft it (only if config file exists)
+ var config_file = self.config_keeper.get(self.project_dir, self.platform, file);
+ if (config_file.exists) {
+ if (remove) config_file.prune_child(selector, munge.parents[selector][xml_child]);
+ else config_file.graft_child(selector, munge.parents[selector][xml_child]);
+ } else {
+ events.emit('warn', 'config file ' + file + ' requested for changes not found at ' + config_file.filepath + ', ignoring');
+ }
+ }
+ }
+}
+
+PlatformMunger.prototype.remove_plugin_changes = remove_plugin_changes;
+function remove_plugin_changes (pluginInfo, is_top_level) {
+ var self = this;
+ var platform_config = self.platformJson.root;
+ var plugin_vars = is_top_level
+ ? platform_config.installed_plugins[pluginInfo.id]
+ : platform_config.dependent_plugins[pluginInfo.id];
+ var edit_config_changes = null;
+ if (pluginInfo.getEditConfigs) {
+ edit_config_changes = pluginInfo.getEditConfigs(self.platform);
+ }
+
+ // get config munge, aka how did this plugin change various config files
+ var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
+ // global munge looks at all plugins' changes to config files
+ var global_munge = platform_config.config_munge;
+ var munge = mungeutil.decrement_munge(global_munge, config_munge);
+
+ for (var file in munge.files) {
+ self.apply_file_munge(file, munge.files[file], /* remove = */ true);
+ }
+
+ // Remove from installed_plugins
+ self.platformJson.removePlugin(pluginInfo.id, is_top_level);
+ return self;
+}
+
+PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
+function add_plugin_changes (pluginInfo, plugin_vars, is_top_level, should_increment, plugin_force) {
+ var self = this;
+ var platform_config = self.platformJson.root;
+
+ var edit_config_changes = null;
+ if (pluginInfo.getEditConfigs) {
+ edit_config_changes = pluginInfo.getEditConfigs(self.platform);
+ }
+
+ var config_munge;
+
+ if (!edit_config_changes || edit_config_changes.length === 0) {
+ // get config munge, aka how should this plugin change various config files
+ config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
+ } else {
+ var isConflictingInfo = is_conflicting(edit_config_changes, platform_config.config_munge, self, plugin_force);
+
+ if (isConflictingInfo.conflictWithConfigxml) {
+ throw new Error(pluginInfo.id +
+ ' cannot be added. changes in this plugin conflicts with changes in config.xml. Conflicts must be resolved before plugin can be added.');
+ }
+ if (plugin_force) {
+ events.emit('warn', '--force is used. edit-config will overwrite conflicts if any. Conflicting plugins may not work as expected.');
+
+ // remove conflicting munges
+ var conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.conflictingMunge);
+ for (var conflict_file in conflict_munge.files) {
+ self.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
+ }
+
+ // force add new munges
+ config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
+ } else if (isConflictingInfo.conflictFound) {
+ throw new Error('There was a conflict trying to modify attributes with in plugin ' + pluginInfo.id +
+ '. The conflicting plugin, ' + isConflictingInfo.conflictingPlugin + ', already modified the same attributes. The conflict must be resolved before ' +
+ pluginInfo.id + ' can be added. You may use --force to add the plugin and overwrite the conflicting attributes.');
+ } else {
+ // no conflicts, will handle edit-config
+ config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
+ }
+ }
+
+ self = munge_helper(should_increment, self, platform_config, config_munge);
+
+ // Move to installed/dependent_plugins
+ self.platformJson.addPlugin(pluginInfo.id, plugin_vars || {}, is_top_level);
+ return self;
+}
+
+// Handle edit-config changes from config.xml
+PlatformMunger.prototype.add_config_changes = add_config_changes;
+function add_config_changes (config, should_increment) {
+ var self = this;
+ var platform_config = self.platformJson.root;
+
+ var config_munge;
+ var changes = [];
+
+ if (config.getEditConfigs) {
+ var edit_config_changes = config.getEditConfigs(self.platform);
+ if (edit_config_changes) {
+ changes = changes.concat(edit_config_changes);
+ }
+ }
+
+ if (config.getConfigFiles) {
+ var config_files_changes = config.getConfigFiles(self.platform);
+ if (config_files_changes) {
+ changes = changes.concat(config_files_changes);
+ }
+ }
+
+ if (changes && changes.length > 0) {
+ var isConflictingInfo = is_conflicting(changes, platform_config.config_munge, self, true /* always force overwrite other edit-config */);
+ if (isConflictingInfo.conflictFound) {
+ var conflict_munge;
+ var conflict_file;
+
+ if (Object.keys(isConflictingInfo.configxmlMunge.files).length !== 0) {
+ // silently remove conflicting config.xml munges so new munges can be added
+ conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.configxmlMunge);
+ for (conflict_file in conflict_munge.files) {
+ self.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
+ }
+ }
+ if (Object.keys(isConflictingInfo.conflictingMunge.files).length !== 0) {
+ events.emit('warn', 'Conflict found, edit-config changes from config.xml will overwrite plugin.xml changes');
+
+ // remove conflicting plugin.xml munges
+ conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.conflictingMunge);
+ for (conflict_file in conflict_munge.files) {
+ self.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
+ }
+ }
+ }
+ }
+
+ // Add config.xml edit-config and config-file munges
+ config_munge = self.generate_config_xml_munge(config, changes, 'config.xml');
+ self = munge_helper(should_increment, self, platform_config, config_munge);
+
+ // Move to installed/dependent_plugins
+ return self;
+}
+
+function munge_helper (should_increment, self, platform_config, config_munge) {
+ // global munge looks at all changes to config files
+
+ // TODO: The should_increment param is only used by cordova-cli and is going away soon.
+ // If should_increment is set to false, avoid modifying the global_munge (use clone)
+ // and apply the entire config_munge because it's already a proper subset of the global_munge.
+ var munge, global_munge;
+ if (should_increment) {
+ global_munge = platform_config.config_munge;
+ munge = mungeutil.increment_munge(global_munge, config_munge);
+ } else {
+ global_munge = mungeutil.clone_munge(platform_config.config_munge);
+ munge = config_munge;
+ }
+
+ for (var file in munge.files) {
+ self.apply_file_munge(file, munge.files[file]);
+ }
+
+ return self;
+}
+
+// Load the global munge from platform json and apply all of it.
+// Used by cordova prepare to re-generate some config file from platform
+// defaults and the global munge.
+PlatformMunger.prototype.reapply_global_munge = reapply_global_munge;
+function reapply_global_munge () {
+ var self = this;
+
+ var platform_config = self.platformJson.root;
+ var global_munge = platform_config.config_munge;
+ for (var file in global_munge.files) {
+ self.apply_file_munge(file, global_munge.files[file]);
+ }
+
+ return self;
+}
+
+// generate_plugin_config_munge
+// Generate the munge object from config.xml
+PlatformMunger.prototype.generate_config_xml_munge = generate_config_xml_munge;
+function generate_config_xml_munge (config, config_changes, type) {
+ var munge = { files: {} };
+ var id;
+
+ if (!config_changes) {
+ return munge;
+ }
+
+ if (type === 'config.xml') {
+ id = type;
+ } else {
+ id = config.id;
+ }
+
+ config_changes.forEach(function (change) {
+ change.xmls.forEach(function (xml) {
+ // 1. stringify each xml
+ var stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
+ // 2. add into munge
+ if (change.mode) {
+ mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, id: id });
+ } else {
+ mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
+ }
+ });
+ });
+ return munge;
+}
+
+// generate_plugin_config_munge
+// Generate the munge object from plugin.xml + vars
+PlatformMunger.prototype.generate_plugin_config_munge = generate_plugin_config_munge;
+function generate_plugin_config_munge (pluginInfo, vars, edit_config_changes) {
+ var self = this;
+
+ vars = vars || {};
+ var munge = { files: {} };
+ var changes = pluginInfo.getConfigFiles(self.platform);
+
+ if (edit_config_changes) {
+ Array.prototype.push.apply(changes, edit_config_changes);
+ }
+
+ changes.forEach(function (change) {
+ change.xmls.forEach(function (xml) {
+ // 1. stringify each xml
+ var stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
+ // interp vars
+ if (vars) {
+ Object.keys(vars).forEach(function (key) {
+ var regExp = new RegExp('\\$' + key, 'g');
+ stringified = stringified.replace(regExp, vars[key]);
+ });
+ }
+ // 2. add into munge
+ if (change.mode) {
+ if (change.mode !== 'remove') {
+ mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, plugin: pluginInfo.id });
+ }
+ } else {
+ mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
+ }
+ });
+ });
+ return munge;
+}
+
+function is_conflicting (editchanges, config_munge, self, force) {
+ var files = config_munge.files;
+ var conflictFound = false;
+ var conflictWithConfigxml = false;
+ var conflictingMunge = { files: {} };
+ var configxmlMunge = { files: {} };
+ var conflictingParent;
+ var conflictingPlugin;
+
+ editchanges.forEach(function (editchange) {
+ if (files[editchange.file]) {
+ var parents = files[editchange.file].parents;
+ var target = parents[editchange.target];
+
+ // Check if the edit target will resolve to an existing target
+ if (!target || target.length === 0) {
+ var file_xml = self.config_keeper.get(self.project_dir, self.platform, editchange.file).data;
+ var resolveEditTarget = xml_helpers.resolveParent(file_xml, editchange.target);
+ var resolveTarget;
+
+ if (resolveEditTarget) {
+ for (var parent in parents) {
+ resolveTarget = xml_helpers.resolveParent(file_xml, parent);
+ if (resolveEditTarget === resolveTarget) {
+ conflictingParent = parent;
+ target = parents[parent];
+ break;
+ }
+ }
+ }
+ } else {
+ conflictingParent = editchange.target;
+ }
+
+ if (target && target.length !== 0) {
+ // conflict has been found
+ conflictFound = true;
+
+ if (editchange.id === 'config.xml') {
+ if (target[0].id === 'config.xml') {
+ // Keep track of config.xml/config.xml edit-config conflicts
+ mungeutil.deep_add(configxmlMunge, editchange.file, conflictingParent, target[0]);
+ } else {
+ // Keep track of config.xml x plugin.xml edit-config conflicts
+ mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]);
+ }
+ } else {
+ if (target[0].id === 'config.xml') {
+ // plugin.xml cannot overwrite config.xml changes even if --force is used
+ conflictWithConfigxml = true;
+ return;
+ }
+
+ if (force) {
+ // Need to find all conflicts when --force is used, track conflicting munges
+ mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]);
+ } else {
+ // plugin cannot overwrite other plugin changes without --force
+ conflictingPlugin = target[0].plugin;
+ }
+ }
+ }
+ }
+ });
+
+ return { conflictFound: conflictFound,
+ conflictingPlugin: conflictingPlugin,
+ conflictingMunge: conflictingMunge,
+ configxmlMunge: configxmlMunge,
+ conflictWithConfigxml: conflictWithConfigxml
+ };
+}
+
+// Go over the prepare queue and apply the config munges for each plugin
+// that has been (un)installed.
+PlatformMunger.prototype.process = PlatformMunger_process;
+function PlatformMunger_process (plugins_dir) {
+ var self = this;
+ var platform_config = self.platformJson.root;
+
+ // Uninstallation first
+ platform_config.prepare_queue.uninstalled.forEach(function (u) {
+ var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
+ self.remove_plugin_changes(pluginInfo, u.topLevel);
+ });
+
+ // Now handle installation
+ platform_config.prepare_queue.installed.forEach(function (u) {
+ var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
+ self.add_plugin_changes(pluginInfo, u.vars, u.topLevel, true, u.force);
+ });
+
+ // Empty out installed/ uninstalled queues.
+ platform_config.prepare_queue.uninstalled = [];
+ platform_config.prepare_queue.installed = [];
+}
+/** ** END of PlatformMunger ****/
diff --git a/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js b/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
new file mode 100644
index 0000000..b346978
--- /dev/null
+++ b/node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
@@ -0,0 +1,265 @@
+/*
+ * 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 modules = {};
+var addProperty = require('../util/addProperty');
+
+// Use delay loading to ensure plist and other node modules to not get loaded
+// on Android, Windows platforms
+addProperty(module, 'bplist', 'bplist-parser', modules);
+addProperty(module, 'et', 'elementtree', modules);
+addProperty(module, 'glob', 'glob', modules);
+addProperty(module, 'plist', 'plist', modules);
+addProperty(module, 'plist_helpers', '../util/plist-helpers', modules);
+addProperty(module, 'xml_helpers', '../util/xml-helpers', modules);
+
+/******************************************************************************
+* ConfigFile class
+*
+* Can load and keep various types of config files. Provides some functionality
+* specific to some file types such as grafting XML children. In most cases it
+* should be instantiated by ConfigKeeper.
+*
+* For plugin.xml files use as:
+* plugin_config = self.config_keeper.get(plugin_dir, '', 'plugin.xml');
+*
+* TODO: Consider moving it out to a separate file and maybe partially with
+* overrides in platform handlers.
+******************************************************************************/
+function ConfigFile (project_dir, platform, file_tag) {
+ this.project_dir = project_dir;
+ this.platform = platform;
+ this.file_tag = file_tag;
+ this.is_changed = false;
+
+ this.load();
+}
+
+// ConfigFile.load()
+ConfigFile.prototype.load = ConfigFile_load;
+function ConfigFile_load () {
+ var self = this;
+
+ // config file may be in a place not exactly specified in the target
+ var filepath = self.filepath = resolveConfigFilePath(self.project_dir, self.platform, self.file_tag);
+
+ if (!filepath || !fs.existsSync(filepath)) {
+ self.exists = false;
+ return;
+ }
+ self.exists = true;
+ self.mtime = fs.statSync(self.filepath).mtime;
+
+ var ext = path.extname(filepath);
+ // Windows8 uses an appxmanifest, and wp8 will likely use
+ // the same in a future release
+ if (ext === '.xml' || ext === '.appxmanifest' || ext === '.storyboard' || ext === '.jsproj') {
+ self.type = 'xml';
+ self.data = modules.xml_helpers.parseElementtreeSync(filepath);
+ } else {
+ // plist file
+ self.type = 'plist';
+ // TODO: isBinaryPlist() reads the file and then parse re-reads it again.
+ // We always write out text plist, not binary.
+ // Do we still need to support binary plist?
+ // If yes, use plist.parseStringSync() and read the file once.
+ self.data = isBinaryPlist(filepath)
+ ? modules.bplist.parseBuffer(fs.readFileSync(filepath))[0]
+ : modules.plist.parse(fs.readFileSync(filepath, 'utf8'));
+ }
+}
+
+ConfigFile.prototype.save = function ConfigFile_save () {
+ var self = this;
+ if (self.type === 'xml') {
+ fs.writeFileSync(self.filepath, self.data.write({ indent: 4 }), 'utf-8');
+ } else {
+ // plist
+ var regExp = /[ \t\r\n]+?<\/string>/g;
+ fs.writeFileSync(self.filepath, modules.plist.build(self.data, { indent: '\t', offset: -1 }).replace(regExp, ' '));
+ }
+ self.is_changed = false;
+};
+
+ConfigFile.prototype.graft_child = function ConfigFile_graft_child (selector, xml_child) {
+ var self = this;
+ var filepath = self.filepath;
+ var result;
+ if (self.type === 'xml') {
+ var xml_to_graft = [modules.et.XML(xml_child.xml)];
+ switch (xml_child.mode) {
+ case 'merge':
+ result = modules.xml_helpers.graftXMLMerge(self.data, xml_to_graft, selector, xml_child);
+ break;
+ case 'overwrite':
+ result = modules.xml_helpers.graftXMLOverwrite(self.data, xml_to_graft, selector, xml_child);
+ break;
+ case 'remove':
+ result = modules.xml_helpers.pruneXMLRemove(self.data, selector, xml_to_graft);
+ break;
+ default:
+ result = modules.xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after);
+ }
+ if (!result) {
+ throw new Error('Unable to graft xml at selector "' + selector + '" from "' + filepath + '" during config install');
+ }
+ } else {
+ // plist file
+ result = modules.plist_helpers.graftPLIST(self.data, xml_child.xml, selector);
+ if (!result) {
+ throw new Error('Unable to graft plist "' + filepath + '" during config install');
+ }
+ }
+ self.is_changed = true;
+};
+
+ConfigFile.prototype.prune_child = function ConfigFile_prune_child (selector, xml_child) {
+ var self = this;
+ var filepath = self.filepath;
+ var result;
+ if (self.type === 'xml') {
+ var xml_to_graft = [modules.et.XML(xml_child.xml)];
+ switch (xml_child.mode) {
+ case 'merge':
+ case 'overwrite':
+ result = modules.xml_helpers.pruneXMLRestore(self.data, selector, xml_child);
+ break;
+ case 'remove':
+ result = modules.xml_helpers.pruneXMLRemove(self.data, selector, xml_to_graft);
+ break;
+ default:
+ result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector);
+ }
+ } else {
+ // plist file
+ result = modules.plist_helpers.prunePLIST(self.data, xml_child.xml, selector);
+ }
+ if (!result) {
+ var err_msg = 'Pruning at selector "' + selector + '" from "' + filepath + '" went bad.';
+ throw new Error(err_msg);
+ }
+ self.is_changed = true;
+};
+
+// Some config-file target attributes are not qualified with a full leading directory, or contain wildcards.
+// Resolve to a real path in this function.
+// TODO: getIOSProjectname is slow because of glob, try to avoid calling it several times per project.
+function resolveConfigFilePath (project_dir, platform, file) {
+ var filepath = path.join(project_dir, file);
+ var matches;
+
+ file = path.normalize(file);
+
+ if (file.includes('*')) {
+ // handle wildcards in targets using glob.
+ matches = modules.glob.sync(path.join(project_dir, '**', file));
+ if (matches.length) filepath = matches[0];
+
+ // [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
+ if (matches.length > 1 && file.includes('-Info.plist')) {
+ var plistName = getIOSProjectname(project_dir) + '-Info.plist';
+ for (var i = 0; i < matches.length; i++) {
+ if (matches[i].includes(plistName)) {
+ filepath = matches[i];
+ break;
+ }
+ }
+ }
+ return filepath;
+ }
+
+ // XXX this checks for android studio projects
+ // only if none of the options above are satisfied does this get called
+ // TODO: Move this out of cordova-common and into the platforms somehow
+ if (platform === 'android' && !fs.existsSync(filepath)) {
+ var config_file;
+
+ if (file === 'AndroidManifest.xml') {
+ filepath = path.join(project_dir, 'app', 'src', 'main', 'AndroidManifest.xml');
+ } else if (file.endsWith('config.xml')) {
+ filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'xml', 'config.xml');
+ } else if (file.endsWith('strings.xml')) {
+ // Plugins really shouldn't mess with strings.xml, since it's able to be localized
+ filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'values', 'strings.xml');
+ } else if (file.includes(path.join('res', 'values'))) {
+ config_file = path.basename(file);
+ filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'values', config_file);
+ } else if (file.includes(path.join('res', 'xml'))) {
+ // Catch-all for all other stored XML configuration in legacy plugins
+ config_file = path.basename(file);
+ filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'xml', config_file);
+ }
+ return filepath;
+ }
+
+ // special-case config.xml target that is just "config.xml" for other platforms. This should
+ // be resolved to the real location of the file.
+ // TODO: Move this out of cordova-common into platforms
+ if (file === 'config.xml') {
+ if (platform === 'ubuntu') {
+ filepath = path.join(project_dir, 'config.xml');
+ } else if (platform === 'ios' || platform === 'osx') {
+ filepath = path.join(
+ project_dir,
+ module.exports.getIOSProjectname(project_dir),
+ 'config.xml'
+ );
+ } else {
+ matches = modules.glob.sync(path.join(project_dir, '**', 'config.xml'));
+ if (matches.length) filepath = matches[0];
+ }
+ return filepath;
+ }
+
+ // None of the special cases matched, returning project_dir/file.
+ return filepath;
+}
+
+// Find out the real name of an iOS or OSX project
+// TODO: glob is slow, need a better way or caching, or avoid using more than once.
+function getIOSProjectname (project_dir) {
+ var matches = modules.glob.sync(path.join(project_dir, '*.xcodeproj'));
+ var iospath;
+ if (matches.length === 1) {
+ iospath = path.basename(matches[0], '.xcodeproj');
+ } else {
+ var msg;
+ if (matches.length === 0) {
+ msg = 'Does not appear to be an xcode project, no xcode project file in ' + project_dir;
+ } else {
+ msg = 'There are multiple *.xcodeproj dirs in ' + project_dir;
+ }
+ throw new Error(msg);
+ }
+ return iospath;
+}
+
+// determine if a plist file is binary
+function isBinaryPlist (filename) {
+ // I wish there was a synchronous way to read only the first 6 bytes of a
+ // file. This is wasteful :/
+ var buf = '' + fs.readFileSync(filename, 'utf8');
+ // binary plists start with a magic header, "bplist"
+ return buf.substring(0, 6) === 'bplist';
+}
+
+module.exports = ConfigFile;
+module.exports.isBinaryPlist = isBinaryPlist;
+module.exports.getIOSProjectname = getIOSProjectname;
+module.exports.resolveConfigFilePath = resolveConfigFilePath;
diff --git a/node_modules/cordova-common/src/ConfigChanges/ConfigKeeper.js b/node_modules/cordova-common/src/ConfigChanges/ConfigKeeper.js
new file mode 100644
index 0000000..0ef0435
--- /dev/null
+++ b/node_modules/cordova-common/src/ConfigChanges/ConfigKeeper.js
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+*/
+/* jshint sub:true */
+
+var path = require('path');
+var ConfigFile = require('./ConfigFile');
+
+/******************************************************************************
+* ConfigKeeper class
+*
+* Used to load and store config files to avoid re-parsing and writing them out
+* multiple times.
+*
+* The config files are referred to by a fake path constructed as
+* project_dir/platform/file
+* where file is the name used for the file in config munges.
+******************************************************************************/
+function ConfigKeeper (project_dir, plugins_dir) {
+ this.project_dir = project_dir;
+ this.plugins_dir = plugins_dir;
+ this._cached = {};
+}
+
+ConfigKeeper.prototype.get = function ConfigKeeper_get (project_dir, platform, file) {
+ var self = this;
+
+ // This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
+ // https://issues.apache.org/jira/browse/CB-6414
+ if (file === 'config.xml' && platform === 'android') {
+ file = 'res/xml/config.xml';
+ }
+ var fake_path = path.join(project_dir, platform, file);
+
+ if (self._cached[fake_path]) {
+ return self._cached[fake_path];
+ }
+ // File was not cached, need to load.
+ var config_file = new ConfigFile(project_dir, platform, file);
+ self._cached[fake_path] = config_file;
+ return config_file;
+};
+
+ConfigKeeper.prototype.save_all = function ConfigKeeper_save_all () {
+ var self = this;
+ Object.keys(self._cached).forEach(function (fake_path) {
+ var config_file = self._cached[fake_path];
+ if (config_file.is_changed) config_file.save();
+ });
+};
+
+module.exports = ConfigKeeper;
diff --git a/node_modules/cordova-common/src/ConfigChanges/munge-util.js b/node_modules/cordova-common/src/ConfigChanges/munge-util.js
new file mode 100644
index 0000000..62648d8
--- /dev/null
+++ b/node_modules/cordova-common/src/ConfigChanges/munge-util.js
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ *
+*/
+/* jshint sub:true */
+
+var _ = require('underscore');
+
+// add the count of [key1][key2]...[keyN] to obj
+// return true if it didn't exist before
+exports.deep_add = function deep_add (obj, keys /* or key1, key2 .... */) {
+ if (!Array.isArray(keys)) {
+ keys = Array.prototype.slice.call(arguments, 1);
+ }
+
+ return exports.process_munge(obj, true/* createParents */, function (parentArray, k) {
+ var found = _.find(parentArray, function (element) {
+ return element.xml === k.xml;
+ });
+ if (found) {
+ found.after = found.after || k.after;
+ found.count += k.count;
+ } else {
+ parentArray.push(k);
+ }
+ return !found;
+ }, keys);
+};
+
+// decrement the count of [key1][key2]...[keyN] from obj and remove if it reaches 0
+// return true if it was removed or not found
+exports.deep_remove = function deep_remove (obj, keys /* or key1, key2 .... */) {
+ if (!Array.isArray(keys)) {
+ keys = Array.prototype.slice.call(arguments, 1);
+ }
+
+ var result = exports.process_munge(obj, false/* createParents */, function (parentArray, k) {
+ var index = -1;
+ var found = _.find(parentArray, function (element) {
+ index++;
+ return element.xml === k.xml;
+ });
+ if (found) {
+ if (parentArray[index].oldAttrib) {
+ k.oldAttrib = _.extend({}, parentArray[index].oldAttrib);
+ }
+ found.count -= k.count;
+ if (found.count > 0) {
+ return false;
+ } else {
+ parentArray.splice(index, 1);
+ }
+ }
+ return undefined;
+ }, keys);
+
+ return typeof result === 'undefined' ? true : result;
+};
+
+// search for [key1][key2]...[keyN]
+// return the object or undefined if not found
+exports.deep_find = function deep_find (obj, keys /* or key1, key2 .... */) {
+ if (!Array.isArray(keys)) {
+ keys = Array.prototype.slice.call(arguments, 1);
+ }
+
+ return exports.process_munge(obj, false/* createParents? */, function (parentArray, k) {
+ return _.find(parentArray, function (element) {
+ return element.xml === (k.xml || k);
+ });
+ }, keys);
+};
+
+// Execute func passing it the parent array and the xmlChild key.
+// When createParents is true, add the file and parent items they are missing
+// When createParents is false, stop and return undefined if the file and/or parent items are missing
+
+exports.process_munge = function process_munge (obj, createParents, func, keys /* or key1, key2 .... */) {
+ if (!Array.isArray(keys)) {
+ keys = Array.prototype.slice.call(arguments, 1);
+ }
+ var k = keys[0];
+ if (keys.length === 1) {
+ return func(obj, k);
+ } else if (keys.length === 2) {
+ if (!obj.parents[k] && !createParents) {
+ return undefined;
+ }
+ obj.parents[k] = obj.parents[k] || [];
+ return exports.process_munge(obj.parents[k], createParents, func, keys.slice(1));
+ } else if (keys.length === 3) {
+ if (!obj.files[k] && !createParents) {
+ return undefined;
+ }
+ obj.files[k] = obj.files[k] || { parents: {} };
+ return exports.process_munge(obj.files[k], createParents, func, keys.slice(1));
+ } else {
+ throw new Error('Invalid key format. Must contain at most 3 elements (file, parent, xmlChild).');
+ }
+};
+
+// All values from munge are added to base as
+// base[file][selector][child] += munge[file][selector][child]
+// Returns a munge object containing values that exist in munge
+// but not in base.
+exports.increment_munge = function increment_munge (base, munge) {
+ var diff = { files: {} };
+
+ for (var file in munge.files) {
+ for (var selector in munge.files[file].parents) {
+ for (var xml_child in munge.files[file].parents[selector]) {
+ var val = munge.files[file].parents[selector][xml_child];
+ // if node not in base, add it to diff and base
+ // else increment it's value in base without adding to diff
+ var newlyAdded = exports.deep_add(base, [file, selector, val]);
+ if (newlyAdded) {
+ exports.deep_add(diff, file, selector, val);
+ }
+ }
+ }
+ }
+ return diff;
+};
+
+// Update the base munge object as
+// base[file][selector][child] -= munge[file][selector][child]
+// nodes that reached zero value are removed from base and added to the returned munge
+// object.
+exports.decrement_munge = function decrement_munge (base, munge) {
+ var zeroed = { files: {} };
+
+ for (var file in munge.files) {
+ for (var selector in munge.files[file].parents) {
+ for (var xml_child in munge.files[file].parents[selector]) {
+ var val = munge.files[file].parents[selector][xml_child];
+ // if node not in base, add it to diff and base
+ // else increment it's value in base without adding to diff
+ var removed = exports.deep_remove(base, [file, selector, val]);
+ if (removed) {
+ exports.deep_add(zeroed, file, selector, val);
+ }
+ }
+ }
+ }
+ return zeroed;
+};
+
+// For better readability where used
+exports.clone_munge = function clone_munge (munge) {
+ return exports.increment_munge({}, munge);
+};
diff --git a/node_modules/cordova-common/src/ConfigParser/ConfigParser.js b/node_modules/cordova-common/src/ConfigParser/ConfigParser.js
new file mode 100644
index 0000000..dc1b66d
--- /dev/null
+++ b/node_modules/cordova-common/src/ConfigParser/ConfigParser.js
@@ -0,0 +1,630 @@
+/**
+ 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 et = require('elementtree');
+var xml = require('../util/xml-helpers');
+var CordovaError = require('../CordovaError/CordovaError');
+var fs = require('fs-extra');
+var events = require('../events');
+
+/** Wraps a config.xml file */
+function ConfigParser (path) {
+ this.path = path;
+ try {
+ this.doc = xml.parseElementtreeSync(path);
+ this.cdvNamespacePrefix = getCordovaNamespacePrefix(this.doc);
+ et.register_namespace(this.cdvNamespacePrefix, 'http://cordova.apache.org/ns/1.0');
+ } catch (e) {
+ events.emit('error', 'Parsing ' + path + ' failed');
+ throw e;
+ }
+ var r = this.doc.getroot();
+ if (r.tag !== 'widget') {
+ throw new CordovaError(path + ' has incorrect root node name (expected "widget", was "' + r.tag + '")');
+ }
+}
+
+function getNodeTextSafe (el) {
+ return el && el.text && el.text.trim();
+}
+
+function findOrCreate (doc, name) {
+ var ret = doc.find(name);
+ if (!ret) {
+ ret = new et.Element(name);
+ doc.getroot().append(ret);
+ }
+ return ret;
+}
+
+function getCordovaNamespacePrefix (doc) {
+ var rootAtribs = Object.getOwnPropertyNames(doc.getroot().attrib);
+ var prefix = 'cdv';
+ for (var j = 0; j < rootAtribs.length; j++) {
+ if (rootAtribs[j].startsWith('xmlns:') &&
+ doc.getroot().attrib[rootAtribs[j]] === 'http://cordova.apache.org/ns/1.0') {
+ var strings = rootAtribs[j].split(':');
+ prefix = strings[1];
+ break;
+ }
+ }
+ return prefix;
+}
+
+/**
+ * Finds the value of an element's attribute
+ * @param {String} attributeName Name of the attribute to search for
+ * @param {Array} elems An array of ElementTree nodes
+ * @return {String}
+ */
+function findElementAttributeValue (attributeName, elems) {
+ elems = Array.isArray(elems) ? elems : [elems];
+
+ var value = elems.filter(function (elem) {
+ return elem.attrib.name.toLowerCase() === attributeName.toLowerCase();
+ }).map(function (filteredElems) {
+ return filteredElems.attrib.value;
+ }).pop();
+
+ return value || '';
+}
+
+function removeChildren (el, selector) {
+ const matches = el.findall(selector);
+ matches.forEach(child => el.remove(child));
+}
+
+ConfigParser.prototype = {
+ getAttribute: function (attr) {
+ return this.doc.getroot().attrib[attr];
+ },
+
+ packageName: function () {
+ return this.getAttribute('id');
+ },
+ setPackageName: function (id) {
+ this.doc.getroot().attrib['id'] = id;
+ },
+ android_packageName: function () {
+ return this.getAttribute('android-packageName');
+ },
+ android_activityName: function () {
+ return this.getAttribute('android-activityName');
+ },
+ ios_CFBundleIdentifier: function () {
+ return this.getAttribute('ios-CFBundleIdentifier');
+ },
+ name: function () {
+ return getNodeTextSafe(this.doc.find('name'));
+ },
+ setName: function (name) {
+ var el = findOrCreate(this.doc, 'name');
+ el.text = name;
+ },
+ shortName: function () {
+ return this.doc.find('name').attrib['short'] || this.name();
+ },
+ setShortName: function (shortname) {
+ var el = findOrCreate(this.doc, 'name');
+ if (!el.text) {
+ el.text = shortname;
+ }
+ el.attrib['short'] = shortname;
+ },
+ description: function () {
+ return getNodeTextSafe(this.doc.find('description'));
+ },
+ setDescription: function (text) {
+ var el = findOrCreate(this.doc, 'description');
+ el.text = text;
+ },
+ version: function () {
+ return this.getAttribute('version');
+ },
+ windows_packageVersion: function () {
+ return this.getAttribute('windows-packageVersion');
+ },
+ android_versionCode: function () {
+ return this.getAttribute('android-versionCode');
+ },
+ ios_CFBundleVersion: function () {
+ return this.getAttribute('ios-CFBundleVersion');
+ },
+ setVersion: function (value) {
+ this.doc.getroot().attrib['version'] = value;
+ },
+ author: function () {
+ return getNodeTextSafe(this.doc.find('author'));
+ },
+ getGlobalPreference: function (name) {
+ return findElementAttributeValue(name, this.doc.findall('preference'));
+ },
+ setGlobalPreference: function (name, value) {
+ var pref = this.doc.find('preference[@name="' + name + '"]');
+ if (!pref) {
+ pref = new et.Element('preference');
+ pref.attrib.name = name;
+ this.doc.getroot().append(pref);
+ }
+ pref.attrib.value = value;
+ },
+ getPlatformPreference: function (name, platform) {
+ return findElementAttributeValue(name, this.doc.findall('./platform[@name="' + platform + '"]/preference'));
+ },
+ setPlatformPreference: function (name, platform, value) {
+ const platformEl = this.doc.find('./platform[@name="' + platform + '"]');
+ if (!platformEl) {
+ throw new CordovaError('platform does not exist (received platform: ' + platform + ')');
+ }
+ const elems = this.doc.findall('./platform[@name="' + platform + '"]/preference');
+ let pref = elems.filter(function (elem) {
+ return elem.attrib.name.toLowerCase() === name.toLowerCase();
+ }).pop();
+
+ if (!pref) {
+ pref = new et.Element('preference');
+ pref.attrib.name = name;
+ platformEl.append(pref);
+ }
+ pref.attrib.value = value;
+ },
+ getPreference: function (name, platform) {
+ var platformPreference = '';
+
+ if (platform) {
+ platformPreference = this.getPlatformPreference(name, platform);
+ }
+
+ return platformPreference || this.getGlobalPreference(name);
+ },
+ setPreference: function (name, platform, value) {
+ if (!value) {
+ value = platform;
+ platform = undefined;
+ }
+
+ if (platform) {
+ this.setPlatformPreference(name, platform, value);
+ } else {
+ this.setGlobalPreference(name, value);
+ }
+ },
+ /**
+ * Returns all resources for the platform specified.
+ * @param {String} platform The platform.
+ * @param {string} resourceName Type of static resources to return.
+ * "icon" and "splash" currently supported.
+ * @return {Array} Resources for the platform specified.
+ */
+ getStaticResources: function (platform, resourceName) {
+ var ret = [];
+ var staticResources = [];
+ if (platform) { // platform specific icons
+ this.doc.findall('./platform[@name="' + platform + '"]/' + resourceName).forEach(function (elt) {
+ elt.platform = platform; // mark as platform specific resource
+ staticResources.push(elt);
+ });
+ }
+ // root level resources
+ staticResources = staticResources.concat(this.doc.findall(resourceName));
+ // parse resource elements
+ var that = this;
+ staticResources.forEach(function (elt) {
+ var res = {};
+ res.src = elt.attrib.src;
+ res.target = elt.attrib.target || undefined;
+ res.density = elt.attrib['density'] || elt.attrib[that.cdvNamespacePrefix + ':density'] || elt.attrib['gap:density'];
+ res.platform = elt.platform || null; // null means icon represents default icon (shared between platforms)
+ res.width = +elt.attrib.width || undefined;
+ res.height = +elt.attrib.height || undefined;
+ res.background = elt.attrib.background || undefined;
+ res.foreground = elt.attrib.foreground || undefined;
+
+ // default icon
+ if (!res.width && !res.height && !res.density) {
+ ret.defaultResource = res;
+ }
+ ret.push(res);
+ });
+
+ /**
+ * Returns resource with specified width and/or height.
+ * @param {number} width Width of resource.
+ * @param {number} height Height of resource.
+ * @return {Resource} Resource object or null if not found.
+ */
+ ret.getBySize = function (width, height) {
+ return ret.filter(function (res) {
+ if (!res.width && !res.height) {
+ return false;
+ }
+ return ((!res.width || (width === res.width)) &&
+ (!res.height || (height === res.height)));
+ })[0] || null;
+ };
+
+ /**
+ * Returns resource with specified density.
+ * @param {string} density Density of resource.
+ * @return {Resource} Resource object or null if not found.
+ */
+ ret.getByDensity = function (density) {
+ return ret.filter(function (res) {
+ return res.density === density;
+ })[0] || null;
+ };
+
+ /** Returns default icons */
+ ret.getDefault = function () {
+ return ret.defaultResource;
+ };
+
+ return ret;
+ },
+
+ /**
+ * Returns all icons for specific platform.
+ * @param {string} platform Platform name
+ * @return {Resource[]} Array of icon objects.
+ */
+ getIcons: function (platform) {
+ return this.getStaticResources(platform, 'icon');
+ },
+
+ /**
+ * Returns all splash images for specific platform.
+ * @param {string} platform Platform name
+ * @return {Resource[]} Array of Splash objects.
+ */
+ getSplashScreens: function (platform) {
+ return this.getStaticResources(platform, 'splash');
+ },
+
+ /**
+ * Returns all resource-files for a specific platform.
+ * @param {string} platform Platform name
+ * @param {boolean} includeGlobal Whether to return resource-files at the
+ * root level.
+ * @return {Resource[]} Array of resource file objects.
+ */
+ getFileResources: function (platform, includeGlobal) {
+ var fileResources = [];
+
+ if (platform) { // platform specific resources
+ fileResources = this.doc.findall('./platform[@name="' + platform + '"]/resource-file').map(function (tag) {
+ return {
+ platform: platform,
+ src: tag.attrib.src,
+ target: tag.attrib.target,
+ versions: tag.attrib.versions,
+ deviceTarget: tag.attrib['device-target'],
+ arch: tag.attrib.arch
+ };
+ });
+ }
+
+ if (includeGlobal) {
+ this.doc.findall('resource-file').forEach(function (tag) {
+ fileResources.push({
+ platform: platform || null,
+ src: tag.attrib.src,
+ target: tag.attrib.target,
+ versions: tag.attrib.versions,
+ deviceTarget: tag.attrib['device-target'],
+ arch: tag.attrib.arch
+ });
+ });
+ }
+
+ return fileResources;
+ },
+
+ /**
+ * Returns all hook scripts for the hook type specified.
+ * @param {String} hook The hook type.
+ * @param {Array} platforms Platforms to look for scripts into (root scripts will be included as well).
+ * @return {Array} Script elements.
+ */
+ getHookScripts: function (hook, platforms) {
+ var self = this;
+ var scriptElements = self.doc.findall('./hook');
+
+ if (platforms) {
+ platforms.forEach(function (platform) {
+ scriptElements = scriptElements.concat(self.doc.findall('./platform[@name="' + platform + '"]/hook'));
+ });
+ }
+
+ function filterScriptByHookType (el) {
+ return el.attrib.src && el.attrib.type && el.attrib.type.toLowerCase() === hook;
+ }
+
+ return scriptElements.filter(filterScriptByHookType);
+ },
+ /**
+ * Returns a list of plugin (IDs).
+ *
+ * This function also returns any plugin's that
+ * were defined using the legacy tags.
+ * @return {string[]} Array of plugin IDs
+ */
+ getPluginIdList: function () {
+ var plugins = this.doc.findall('plugin');
+ var result = plugins.map(function (plugin) {
+ return plugin.attrib.name;
+ });
+ var features = this.doc.findall('feature');
+ features.forEach(function (element) {
+ var idTag = element.find('./param[@name="id"]');
+ if (idTag) {
+ result.push(idTag.attrib.value);
+ }
+ });
+ return result;
+ },
+ getPlugins: function () {
+ return this.getPluginIdList().map(function (pluginId) {
+ return this.getPlugin(pluginId);
+ }, this);
+ },
+ /**
+ * Adds a plugin element. Does not check for duplicates.
+ * @name addPlugin
+ * @function
+ * @param {object} attributes name and spec are supported
+ * @param {Array|object} variables name, value or arbitary object
+ */
+ addPlugin: function (attributes, variables) {
+ if (!attributes && !attributes.name) return;
+ var el = new et.Element('plugin');
+ el.attrib.name = attributes.name;
+ if (attributes.spec) {
+ el.attrib.spec = attributes.spec;
+ }
+
+ // support arbitrary object as variables source
+ if (variables && typeof variables === 'object' && !Array.isArray(variables)) {
+ variables = Object.keys(variables)
+ .map(function (variableName) {
+ return { name: variableName, value: variables[variableName] };
+ });
+ }
+
+ if (variables) {
+ variables.forEach(function (variable) {
+ el.append(new et.Element('variable', { name: variable.name, value: variable.value }));
+ });
+ }
+ this.doc.getroot().append(el);
+ },
+ /**
+ * Retrives the plugin with the given id or null if not found.
+ *
+ * This function also returns any plugin's that
+ * were defined using the legacy tags.
+ * @name getPlugin
+ * @function
+ * @param {String} id
+ * @returns {object} plugin including any variables
+ */
+ getPlugin: function (id) {
+ if (!id) {
+ return undefined;
+ }
+ var pluginElement = this.doc.find('./plugin/[@name="' + id + '"]');
+ if (pluginElement === null) {
+ var legacyFeature = this.doc.find('./feature/param[@name="id"][@value="' + id + '"]/..');
+ if (legacyFeature) {
+ events.emit('log', 'Found deprecated feature entry for ' + id + ' in config.xml.');
+ return featureToPlugin(legacyFeature);
+ }
+ return undefined;
+ }
+ var plugin = {};
+
+ plugin.name = pluginElement.attrib.name;
+ plugin.spec = pluginElement.attrib.spec || pluginElement.attrib.src || pluginElement.attrib.version;
+ plugin.variables = {};
+ var variableElements = pluginElement.findall('variable');
+ variableElements.forEach(function (varElement) {
+ var name = varElement.attrib.name;
+ var value = varElement.attrib.value;
+ if (name) {
+ plugin.variables[name] = value;
+ }
+ });
+ return plugin;
+ },
+ /**
+ * Remove the plugin entry with give name (id).
+ *
+ * This function also operates on any plugin's that
+ * were defined using the legacy tags.
+ * @name removePlugin
+ * @function
+ * @param id name of the plugin
+ */
+ removePlugin: function (id) {
+ if (!id) return;
+ const root = this.doc.getroot();
+ removeChildren(root, `./plugin/[@name="${id}"]`);
+ removeChildren(root, `./feature/param[@name="id"][@value="${id}"]/..`);
+ },
+
+ // Add any element to the root
+ addElement: function (name, attributes) {
+ var el = et.Element(name);
+ for (var a in attributes) {
+ el.attrib[a] = attributes[a];
+ }
+ this.doc.getroot().append(el);
+ },
+
+ /**
+ * Adds an engine. Does not check for duplicates.
+ * @param {String} name the engine name
+ * @param {String} spec engine source location or version (optional)
+ */
+ addEngine: function (name, spec) {
+ if (!name) return;
+ var el = et.Element('engine');
+ el.attrib.name = name;
+ if (spec) {
+ el.attrib.spec = spec;
+ }
+ this.doc.getroot().append(el);
+ },
+ /**
+ * Removes all the engines with given name
+ * @param {String} name the engine name.
+ */
+ removeEngine: function (name) {
+ removeChildren(this.doc.getroot(), `./engine/[@name="${name}"]`);
+ },
+ getEngines: function () {
+ var engines = this.doc.findall('./engine');
+ return engines.map(function (engine) {
+ var spec = engine.attrib.spec || engine.attrib.version;
+ return {
+ name: engine.attrib.name,
+ spec: spec || null
+ };
+ });
+ },
+ /* Get all the access tags */
+ getAccesses: function () {
+ var accesses = this.doc.findall('./access');
+ return accesses.map(function (access) {
+ var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
+ var requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */
+ var requires_certificate_transparency = access.attrib['requires-certificate-transparency']; /* Boolean */
+ var allows_arbitrary_loads_in_web_content = access.attrib['allows-arbitrary-loads-in-web-content']; /* Boolean */
+ var allows_arbitrary_loads_in_media = access.attrib['allows-arbitrary-loads-in-media']; /* Boolean (DEPRECATED) */
+ var allows_arbitrary_loads_for_media = access.attrib['allows-arbitrary-loads-for-media']; /* Boolean */
+ var allows_local_networking = access.attrib['allows-local-networking']; /* Boolean */
+
+ return {
+ origin: access.attrib.origin,
+ minimum_tls_version: minimum_tls_version,
+ requires_forward_secrecy: requires_forward_secrecy,
+ requires_certificate_transparency: requires_certificate_transparency,
+ allows_arbitrary_loads_in_web_content: allows_arbitrary_loads_in_web_content,
+ allows_arbitrary_loads_in_media: allows_arbitrary_loads_in_media,
+ allows_arbitrary_loads_for_media: allows_arbitrary_loads_for_media,
+ allows_local_networking: allows_local_networking
+ };
+ });
+ },
+ /* Get all the allow-navigation tags */
+ getAllowNavigations: function () {
+ var allow_navigations = this.doc.findall('./allow-navigation');
+ return allow_navigations.map(function (allow_navigation) {
+ var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
+ var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
+ var requires_certificate_transparency = allow_navigation.attrib['requires-certificate-transparency']; /* Boolean */
+
+ return {
+ href: allow_navigation.attrib.href,
+ minimum_tls_version: minimum_tls_version,
+ requires_forward_secrecy: requires_forward_secrecy,
+ requires_certificate_transparency: requires_certificate_transparency
+ };
+ });
+ },
+ /* Get all the allow-intent tags */
+ getAllowIntents: function () {
+ var allow_intents = this.doc.findall('./allow-intent');
+ return allow_intents.map(function (allow_intent) {
+ return {
+ href: allow_intent.attrib.href
+ };
+ });
+ },
+ /* Get all edit-config tags */
+ getEditConfigs: function (platform) {
+ var platform_edit_configs = this.doc.findall('./platform[@name="' + platform + '"]/edit-config');
+ var edit_configs = this.doc.findall('edit-config').concat(platform_edit_configs);
+
+ return edit_configs.map(function (tag) {
+ var editConfig =
+ {
+ file: tag.attrib['file'],
+ target: tag.attrib['target'],
+ mode: tag.attrib['mode'],
+ id: 'config.xml',
+ xmls: tag.getchildren()
+ };
+ return editConfig;
+ });
+ },
+
+ /* Get all config-file tags */
+ getConfigFiles: function (platform) {
+ var platform_config_files = this.doc.findall('./platform[@name="' + platform + '"]/config-file');
+ var config_files = this.doc.findall('config-file').concat(platform_config_files);
+
+ return config_files.map(function (tag) {
+ var configFile =
+ {
+ target: tag.attrib['target'],
+ parent: tag.attrib['parent'],
+ after: tag.attrib['after'],
+ xmls: tag.getchildren(),
+ // To support demuxing via versions
+ versions: tag.attrib['versions'],
+ deviceTarget: tag.attrib['device-target']
+ };
+ return configFile;
+ });
+ },
+
+ write: function () {
+ fs.writeFileSync(this.path, this.doc.write({ indent: 4 }), 'utf-8');
+ }
+};
+
+function featureToPlugin (featureElement) {
+ var plugin = {};
+ plugin.variables = [];
+ var pluginVersion,
+ pluginSrc;
+
+ var nodes = featureElement.findall('param');
+ nodes.forEach(function (element) {
+ var n = element.attrib.name;
+ var v = element.attrib.value;
+ if (n === 'id') {
+ plugin.name = v;
+ } else if (n === 'version') {
+ pluginVersion = v;
+ } else if (n === 'url' || n === 'installPath') {
+ pluginSrc = v;
+ } else {
+ plugin.variables[n] = v;
+ }
+ });
+
+ var spec = pluginSrc || pluginVersion;
+ if (spec) {
+ plugin.spec = spec;
+ }
+
+ return plugin;
+}
+module.exports = ConfigParser;
diff --git a/node_modules/cordova-common/src/CordovaCheck.js b/node_modules/cordova-common/src/CordovaCheck.js
new file mode 100644
index 0000000..5b20ade
--- /dev/null
+++ b/node_modules/cordova-common/src/CordovaCheck.js
@@ -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.
+*/
+
+var fs = require('fs-extra');
+var path = require('path');
+
+function isRootDir (dir) {
+ if (fs.existsSync(path.join(dir, 'www'))) {
+ if (fs.existsSync(path.join(dir, 'config.xml'))) {
+ // For sure is.
+ if (fs.existsSync(path.join(dir, 'platforms'))) {
+ return 2;
+ } else {
+ return 1;
+ }
+ }
+ // Might be (or may be under platforms/).
+ if (fs.existsSync(path.join(dir, 'www', 'config.xml'))) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+// Runs up the directory chain looking for a .cordova directory.
+// IF it is found we are in a Cordova project.
+// Omit argument to use CWD.
+function isCordova (dir) {
+ if (!dir) {
+ // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly (CB-5687).
+ var pwd = process.env.PWD;
+ var cwd = process.cwd();
+ if (pwd && pwd !== cwd && pwd !== 'undefined') {
+ return isCordova(pwd) || isCordova(cwd);
+ }
+ return isCordova(cwd);
+ }
+ var bestReturnValueSoFar = false;
+ for (var i = 0; i < 1000; ++i) {
+ var result = isRootDir(dir);
+ if (result === 2) {
+ return dir;
+ }
+ if (result === 1) {
+ bestReturnValueSoFar = dir;
+ }
+ var parentDir = path.normalize(path.join(dir, '..'));
+ // Detect fs root.
+ if (parentDir === dir) {
+ return bestReturnValueSoFar;
+ }
+ dir = parentDir;
+ }
+ console.error('Hit an unhandled case in CordovaCheck.isCordova');
+ return false;
+}
+
+module.exports = {
+ findProjectRoot: isCordova
+};
diff --git a/node_modules/cordova-common/src/CordovaError/CordovaError.js b/node_modules/cordova-common/src/CordovaError/CordovaError.js
new file mode 100644
index 0000000..34230a7
--- /dev/null
+++ b/node_modules/cordova-common/src/CordovaError/CordovaError.js
@@ -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.
+*/
+
+var EOL = require('os').EOL;
+
+/**
+ * A derived exception class. See usage example in cli.js
+ * Based on:
+ * stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/8460753#8460753
+ * @param {String} message Error message
+ * @param {Number} [code=0] Error code
+ * @param {CordovaExternalToolErrorContext} [context] External tool error context object
+ * @constructor
+ */
+function CordovaError (message, code, context) {
+ Error.captureStackTrace(this, this.constructor);
+ this.name = this.constructor.name;
+ this.message = message;
+ this.code = code || CordovaError.UNKNOWN_ERROR;
+ this.context = context;
+}
+
+// FIXME __proto__ property has been deprecated as of ECMAScript 3.1
+// eslint-disable-next-line no-proto
+CordovaError.prototype.__proto__ = Error.prototype;
+
+// TODO: Extend error codes according the projects specifics
+CordovaError.UNKNOWN_ERROR = 0;
+CordovaError.EXTERNAL_TOOL_ERROR = 1;
+
+/**
+ * Translates instance's error code number into error code name, e.g. 0 -> UNKNOWN_ERROR
+ * @returns {string} Error code string name
+ */
+CordovaError.prototype.getErrorCodeName = function () {
+ for (const key of Object.keys(CordovaError)) {
+ if (CordovaError[key] === this.code) {
+ return key;
+ }
+ }
+};
+
+/**
+ * Converts CordovaError instance to string representation
+ * @param {Boolean} [isVerbose] Set up verbose mode. Used to provide more
+ * details including information about error code name and context
+ * @return {String} Stringified error representation
+ */
+CordovaError.prototype.toString = function (isVerbose) {
+ var message = '';
+ var codePrefix = '';
+
+ if (this.code !== CordovaError.UNKNOWN_ERROR) {
+ codePrefix = 'code: ' + this.code + (isVerbose ? (' (' + this.getErrorCodeName() + ')') : '') + ' ';
+ }
+
+ if (this.code === CordovaError.EXTERNAL_TOOL_ERROR) {
+ if (typeof this.context !== 'undefined') {
+ if (isVerbose) {
+ message = codePrefix + EOL + this.context.toString(isVerbose) + '\n failed with an error: ' +
+ this.message + EOL + 'Stack trace: ' + this.stack;
+ } else {
+ message = codePrefix + '\'' + this.context.toString(isVerbose) + '\' ' + this.message;
+ }
+ } else {
+ message = 'External tool failed with an error: ' + this.message;
+ }
+ } else {
+ message = isVerbose ? codePrefix + this.stack : codePrefix + this.message;
+ }
+
+ return message;
+};
+
+module.exports = CordovaError;
diff --git a/node_modules/cordova-common/src/CordovaError/CordovaExternalToolErrorContext.js b/node_modules/cordova-common/src/CordovaError/CordovaExternalToolErrorContext.js
new file mode 100644
index 0000000..30699b4
--- /dev/null
+++ b/node_modules/cordova-common/src/CordovaError/CordovaExternalToolErrorContext.js
@@ -0,0 +1,48 @@
+/**
+ 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.
+ */
+
+/* jshint proto:true */
+
+var path = require('path');
+
+/**
+ * @param {String} cmd Command full path
+ * @param {String[]} args Command args
+ * @param {String} [cwd] Command working directory
+ * @constructor
+ */
+function CordovaExternalToolErrorContext (cmd, args, cwd) {
+ this.cmd = cmd;
+ // Helper field for readability
+ this.cmdShortName = path.basename(cmd);
+ this.args = args;
+ this.cwd = cwd;
+}
+
+CordovaExternalToolErrorContext.prototype.toString = function (isVerbose) {
+ if (isVerbose) {
+ return 'External tool \'' + this.cmdShortName + '\'' +
+ '\nCommand full path: ' + this.cmd + '\nCommand args: ' + this.args +
+ (typeof this.cwd !== 'undefined' ? '\nCommand cwd: ' + this.cwd : '');
+ }
+
+ return this.cmdShortName;
+};
+
+module.exports = CordovaExternalToolErrorContext;
diff --git a/node_modules/cordova-common/src/CordovaLogger.js b/node_modules/cordova-common/src/CordovaLogger.js
new file mode 100644
index 0000000..85cd3a9
--- /dev/null
+++ b/node_modules/cordova-common/src/CordovaLogger.js
@@ -0,0 +1,228 @@
+/*
+ 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 ansi = require('ansi');
+const EventEmitter = require('events').EventEmitter;
+const EOL = require('os').EOL;
+const formatError = require('./util/formatError');
+
+const INSTANCE_KEY = Symbol.for('org.apache.cordova.common.CordovaLogger');
+
+/**
+ * @typedef {'verbose'|'normal'|'warn'|'info'|'error'|'results'} CordovaLoggerLevel
+ */
+
+/**
+ * Implements logging facility that anybody could use.
+ *
+ * Should not be instantiated directly! `CordovaLogger.get()` method should be
+ * used instead to acquire the logger instance.
+ */
+class CordovaLogger {
+ // Encapsulate the default logging level values with constants:
+ static get VERBOSE () { return 'verbose'; }
+
+ static get NORMAL () { return 'normal'; }
+
+ static get WARN () { return 'warn'; }
+
+ static get INFO () { return 'info'; }
+
+ static get ERROR () { return 'error'; }
+
+ static get RESULTS () { return 'results'; }
+
+ /**
+ * Static method to create new or acquire existing instance.
+ *
+ * @returns {CordovaLogger} Logger instance
+ */
+ static get () {
+ // This singleton instance pattern is based on the ideas from
+ // https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
+ if (Object.getOwnPropertySymbols(global).indexOf(INSTANCE_KEY) === -1) {
+ global[INSTANCE_KEY] = new CordovaLogger();
+ }
+ return global[INSTANCE_KEY];
+ }
+
+ constructor () {
+ /** @private */
+ this.levels = {};
+ /** @private */
+ this.colors = {};
+ /** @private */
+ this.stdout = process.stdout;
+ /** @private */
+ this.stderr = process.stderr;
+
+ /** @private */
+ this.stdoutCursor = ansi(this.stdout);
+ /** @private */
+ this.stderrCursor = ansi(this.stderr);
+
+ this.addLevel(CordovaLogger.VERBOSE, 1000, 'grey');
+ this.addLevel(CordovaLogger.NORMAL, 2000);
+ this.addLevel(CordovaLogger.WARN, 2000, 'yellow');
+ this.addLevel(CordovaLogger.INFO, 3000, 'blue');
+ this.addLevel(CordovaLogger.ERROR, 5000, 'red');
+ this.addLevel(CordovaLogger.RESULTS, 10000);
+
+ this.setLevel(CordovaLogger.NORMAL);
+ }
+
+ /**
+ * Emits log message to process' stdout/stderr depending on message's
+ * severity and current log level. If severity is less than current
+ * logger's level, then the message is ignored.
+ *
+ * @param {CordovaLoggerLevel} logLevel - The message's log level. The
+ * logger should have corresponding level added (via logger.addLevel),
+ * otherwise `CordovaLogger.NORMAL` level will be used.
+ *
+ * @param {string} message - The message, that should be logged to
+ * process's stdio.
+ *
+ * @returns {CordovaLogger} Return the current instance, to allow chaining.
+ */
+ log (logLevel, message) {
+ // if there is no such logLevel defined, or provided level has
+ // less severity than active level, then just ignore this call and return
+ if (!this.levels[logLevel] || this.levels[logLevel] < this.levels[this.logLevel]) {
+ // return instance to allow to chain calls
+ return this;
+ }
+
+ var isVerbose = this.logLevel === CordovaLogger.VERBOSE;
+ var cursor = this.stdoutCursor;
+
+ if (message instanceof Error || logLevel === CordovaLogger.ERROR) {
+ message = formatError(message, isVerbose);
+ cursor = this.stderrCursor;
+ }
+
+ var color = this.colors[logLevel];
+ if (color) {
+ cursor.bold().fg[color]();
+ }
+
+ cursor.write(message).reset().write(EOL);
+
+ return this;
+ }
+
+ /**
+ * Adds a new level to logger instance.
+ *
+ * This method also creates a shortcut method to log events with the level
+ * provided.
+ * (i.e. after adding new level 'debug', the method `logger.debug(message)`
+ * will exist, equal to `logger.log('debug', message)`)
+ *
+ * @param {CordovaLoggerLevel} level - A log level name. The levels with
+ * the following names are added by default to every instance: 'verbose',
+ * 'normal', 'warn', 'info', 'error', 'results'.
+ *
+ * @param {number} severity - A number that represents level's severity.
+ *
+ * @param {string} color - A valid color name, that will be used to log
+ * messages with this level. Any CSS color code or RGB value is allowed
+ * (according to ansi documentation:
+ * https://github.com/TooTallNate/ansi.js#features).
+ *
+ * @returns {CordovaLogger} Return the current instance, to allow chaining.
+ */
+ addLevel (level, severity, color) {
+ this.levels[level] = severity;
+
+ if (color) {
+ this.colors[level] = color;
+ }
+
+ // Define own method with corresponding name
+ if (!this[level]) {
+ Object.defineProperty(this, level, {
+ get () { return this.log.bind(this, level); }
+ });
+ }
+
+ return this;
+ }
+
+ /**
+ * Sets the current logger level to provided value.
+ *
+ * If logger doesn't have level with this name, `CordovaLogger.NORMAL` will
+ * be used.
+ *
+ * @param {CordovaLoggerLevel} logLevel - Level name. The level with this
+ * name should be added to logger before.
+ *
+ * @returns {CordovaLogger} Current instance, to allow chaining.
+ */
+ setLevel (logLevel) {
+ this.logLevel = this.levels[logLevel] ? logLevel : CordovaLogger.NORMAL;
+
+ return this;
+ }
+
+ /**
+ * Adjusts the current logger level according to the passed options.
+ *
+ * @param {Object|Array} opts - An object or args array with
+ * options.
+ *
+ * @returns {CordovaLogger} Current instance, to allow chaining.
+ */
+ adjustLevel (opts) {
+ if (opts.verbose || (Array.isArray(opts) && opts.includes('--verbose'))) {
+ this.setLevel('verbose');
+ } else if (opts.silent || (Array.isArray(opts) && opts.includes('--silent'))) {
+ this.setLevel('error');
+ }
+
+ return this;
+ }
+
+ /**
+ * Attaches logger to EventEmitter instance provided.
+ *
+ * @param {EventEmitter} eventEmitter - An EventEmitter instance to attach
+ * the logger to.
+ *
+ * @returns {CordovaLogger} Current instance, to allow chaining.
+ */
+ subscribe (eventEmitter) {
+ if (!(eventEmitter instanceof EventEmitter)) {
+ throw new Error('Subscribe method only accepts an EventEmitter instance as argument');
+ }
+
+ eventEmitter.on('verbose', this.verbose)
+ .on('log', this.normal)
+ .on('info', this.info)
+ .on('warn', this.warn)
+ .on('warning', this.warn)
+ // Set up event handlers for logging and results emitted as events.
+ .on('results', this.results);
+
+ return this;
+ }
+}
+
+module.exports = CordovaLogger;
diff --git a/node_modules/cordova-common/src/FileUpdater.js b/node_modules/cordova-common/src/FileUpdater.js
new file mode 100644
index 0000000..6f384b5
--- /dev/null
+++ b/node_modules/cordova-common/src/FileUpdater.js
@@ -0,0 +1,402 @@
+/**
+ 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 fs = require('fs-extra');
+var path = require('path');
+var minimatch = require('minimatch');
+
+/**
+ * Logging callback used in the FileUpdater methods.
+ * @callback loggingCallback
+ * @param {string} message A message describing a single file update operation.
+ */
+
+/**
+ * Updates a target file or directory with a source file or directory. (Directory updates are
+ * not recursive.) Stats for target and source items must be passed in. This is an internal
+ * helper function used by other methods in this module.
+ *
+ * @param {?string} sourcePath Source file or directory to be used to update the
+ * destination. If the source is null, then the destination is deleted if it exists.
+ * @param {?fs.Stats} sourceStats An instance of fs.Stats for the source path, or null if
+ * the source does not exist.
+ * @param {string} targetPath Required destination file or directory to be updated. If it does
+ * not exist, it will be created.
+ * @param {?fs.Stats} targetStats An instance of fs.Stats for the target path, or null if
+ * the target does not exist.
+ * @param {Object} [options] Optional additional parameters for the update.
+ * @param {string} [options.rootDir] Optional root directory (such as a project) to which target
+ * and source path parameters are relative; may be omitted if the paths are absolute. The
+ * rootDir is always omitted from any logged paths, to make the logs easier to read.
+ * @param {boolean} [options.all] If true, all files are copied regardless of last-modified times.
+ * Otherwise, a file is copied if the source's last-modified time is greather than or
+ * equal to the target's last-modified time, or if the file sizes are different.
+ * @param {loggingCallback} [log] Optional logging callback that takes a string message
+ * describing any file operations that are performed.
+ * @return {boolean} true if any changes were made, or false if the force flag is not set
+ * and everything was up to date
+ */
+function updatePathWithStats (sourcePath, sourceStats, targetPath, targetStats, options, log) {
+ var updated = false;
+
+ var rootDir = (options && options.rootDir) || '';
+ var copyAll = (options && options.all) || false;
+
+ var targetFullPath = path.join(rootDir || '', targetPath);
+
+ if (sourceStats) {
+ var sourceFullPath = path.join(rootDir || '', sourcePath);
+
+ if (targetStats && (targetStats.isDirectory() !== sourceStats.isDirectory())) {
+ // The target exists. But if the directory status doesn't match the source, delete it.
+ log('delete ' + targetPath);
+ fs.removeSync(targetFullPath);
+ targetStats = null;
+ updated = true;
+ }
+
+ if (!targetStats) {
+ if (sourceStats.isDirectory()) {
+ // The target directory does not exist, so it should be created.
+ log('mkdir ' + targetPath);
+ fs.ensureDirSync(targetFullPath);
+ updated = true;
+ } else if (sourceStats.isFile()) {
+ // The target file does not exist, so it should be copied from the source.
+ log('copy ' + sourcePath + ' ' + targetPath + (copyAll ? '' : ' (new file)'));
+ fs.copySync(sourceFullPath, targetFullPath);
+ updated = true;
+ }
+ } else if (sourceStats.isFile() && targetStats.isFile()) {
+ // The source and target paths both exist and are files.
+ if (copyAll) {
+ // The caller specified all files should be copied.
+ log('copy ' + sourcePath + ' ' + targetPath);
+ fs.copySync(sourceFullPath, targetFullPath);
+ updated = true;
+ } else {
+ // Copy if the source has been modified since it was copied to the target, or if
+ // the file sizes are different. (The latter catches most cases in which something
+ // was done to the file after copying.) Comparison is >= rather than > to allow
+ // for timestamps lacking sub-second precision in some filesystems.
+ if (sourceStats.mtime.getTime() >= targetStats.mtime.getTime() ||
+ sourceStats.size !== targetStats.size) {
+ log('copy ' + sourcePath + ' ' + targetPath + ' (updated file)');
+ fs.copySync(sourceFullPath, targetFullPath);
+ updated = true;
+ }
+ }
+ }
+ } else if (targetStats) {
+ // The target exists but the source is null, so the target should be deleted.
+ log('delete ' + targetPath + (copyAll ? '' : ' (no source)'));
+ fs.removeSync(targetFullPath);
+ updated = true;
+ }
+
+ return updated;
+}
+
+/**
+ * Helper for updatePath and updatePaths functions. Queries stats for source and target
+ * and ensures target directory exists before copying a file.
+ */
+function updatePathInternal (sourcePath, targetPath, options, log) {
+ var rootDir = (options && options.rootDir) || '';
+ var targetFullPath = path.join(rootDir, targetPath);
+ var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
+ var sourceStats = null;
+
+ if (sourcePath) {
+ // A non-null source path was specified. It should exist.
+ var sourceFullPath = path.join(rootDir, sourcePath);
+ if (!fs.existsSync(sourceFullPath)) {
+ throw new Error('Source path does not exist: ' + sourcePath);
+ }
+
+ sourceStats = fs.statSync(sourceFullPath);
+
+ // Create the target's parent directory if it doesn't exist.
+ var parentDir = path.dirname(targetFullPath);
+ if (!fs.existsSync(parentDir)) {
+ fs.ensureDirSync(parentDir);
+ }
+ }
+
+ return updatePathWithStats(sourcePath, sourceStats, targetPath, targetStats, options, log);
+}
+
+/**
+ * Updates a target file or directory with a source file or directory. (Directory updates are
+ * not recursive.)
+ *
+ * @param {?string} sourcePath Source file or directory to be used to update the
+ * destination. If the source is null, then the destination is deleted if it exists.
+ * @param {string} targetPath Required destination file or directory to be updated. If it does
+ * not exist, it will be created.
+ * @param {Object} [options] Optional additional parameters for the update.
+ * @param {string} [options.rootDir] Optional root directory (such as a project) to which target
+ * and source path parameters are relative; may be omitted if the paths are absolute. The
+ * rootDir is always omitted from any logged paths, to make the logs easier to read.
+ * @param {boolean} [options.all] If true, all files are copied regardless of last-modified times.
+ * Otherwise, a file is copied if the source's last-modified time is greather than or
+ * equal to the target's last-modified time, or if the file sizes are different.
+ * @param {loggingCallback} [log] Optional logging callback that takes a string message
+ * describing any file operations that are performed.
+ * @return {boolean} true if any changes were made, or false if the force flag is not set
+ * and everything was up to date
+ */
+function updatePath (sourcePath, targetPath, options, log) {
+ if (sourcePath !== null && typeof sourcePath !== 'string') {
+ throw new Error('A source path (or null) is required.');
+ }
+
+ if (!targetPath || typeof targetPath !== 'string') {
+ throw new Error('A target path is required.');
+ }
+
+ log = log || function () { };
+
+ return updatePathInternal(sourcePath, targetPath, options, log);
+}
+
+/**
+ * Updates files and directories based on a mapping from target paths to source paths. Targets
+ * with null sources in the map are deleted.
+ *
+ * @param {Object} pathMap A dictionary mapping from target paths to source paths.
+ * @param {Object} [options] Optional additional parameters for the update.
+ * @param {string} [options.rootDir] Optional root directory (such as a project) to which target
+ * and source path parameters are relative; may be omitted if the paths are absolute. The
+ * rootDir is always omitted from any logged paths, to make the logs easier to read.
+ * @param {boolean} [options.all] If true, all files are copied regardless of last-modified times.
+ * Otherwise, a file is copied if the source's last-modified time is greather than or
+ * equal to the target's last-modified time, or if the file sizes are different.
+ * @param {loggingCallback} [log] Optional logging callback that takes a string message
+ * describing any file operations that are performed.
+ * @return {boolean} true if any changes were made, or false if the force flag is not set
+ * and everything was up to date
+ */
+function updatePaths (pathMap, options, log) {
+ if (!pathMap || typeof pathMap !== 'object' || Array.isArray(pathMap)) {
+ throw new Error('An object mapping from target paths to source paths is required.');
+ }
+
+ log = log || function () { };
+
+ var updated = false;
+
+ // Iterate in sorted order to ensure directories are created before files under them.
+ Object.keys(pathMap).sort().forEach(function (targetPath) {
+ var sourcePath = pathMap[targetPath];
+ updated = updatePathInternal(sourcePath, targetPath, options, log) || updated;
+ });
+
+ return updated;
+}
+
+/**
+ * Updates a target directory with merged files and subdirectories from source directories.
+ *
+ * @param {string|string[]} sourceDirs Required source directory or array of source directories
+ * to be merged into the target. The directories are listed in order of precedence; files in
+ * directories later in the array supersede files in directories earlier in the array
+ * (regardless of timestamps).
+ * @param {string} targetDir Required destination directory to be updated. If it does not exist,
+ * it will be created. If it exists, newer files from source directories will be copied over,
+ * and files missing in the source directories will be deleted.
+ * @param {Object} [options] Optional additional parameters for the update.
+ * @param {string} [options.rootDir] Optional root directory (such as a project) to which target
+ * and source path parameters are relative; may be omitted if the paths are absolute. The
+ * rootDir is always omitted from any logged paths, to make the logs easier to read.
+ * @param {boolean} [options.all] If true, all files are copied regardless of last-modified times.
+ * Otherwise, a file is copied if the source's last-modified time is greather than or
+ * equal to the target's last-modified time, or if the file sizes are different.
+ * @param {string|string[]} [options.include] Optional glob string or array of glob strings that
+ * are tested against both target and source relative paths to determine if they are included
+ * in the merge-and-update. If unspecified, all items are included.
+ * @param {string|string[]} [options.exclude] Optional glob string or array of glob strings that
+ * are tested against both target and source relative paths to determine if they are excluded
+ * from the merge-and-update. Exclusions override inclusions. If unspecified, no items are
+ * excluded.
+ * @param {loggingCallback} [log] Optional logging callback that takes a string message
+ * describing any file operations that are performed.
+ * @return {boolean} true if any changes were made, or false if the force flag is not set
+ * and everything was up to date
+ */
+function mergeAndUpdateDir (sourceDirs, targetDir, options, log) {
+ if (sourceDirs && typeof sourceDirs === 'string') {
+ sourceDirs = [sourceDirs];
+ } else if (!Array.isArray(sourceDirs)) {
+ throw new Error('A source directory path or array of paths is required.');
+ }
+
+ if (!targetDir || typeof targetDir !== 'string') {
+ throw new Error('A target directory path is required.');
+ }
+
+ log = log || function () { };
+
+ var rootDir = (options && options.rootDir) || '';
+
+ var include = (options && options.include) || ['**'];
+ if (typeof include === 'string') {
+ include = [include];
+ } else if (!Array.isArray(include)) {
+ throw new Error('Include parameter must be a glob string or array of glob strings.');
+ }
+
+ var exclude = (options && options.exclude) || [];
+ if (typeof exclude === 'string') {
+ exclude = [exclude];
+ } else if (!Array.isArray(exclude)) {
+ throw new Error('Exclude parameter must be a glob string or array of glob strings.');
+ }
+
+ // Scan the files in each of the source directories.
+ var sourceMaps = sourceDirs.map(function (sourceDir) {
+ return path.join(rootDir, sourceDir);
+ }).map(function (sourcePath) {
+ if (!fs.existsSync(sourcePath)) {
+ throw new Error('Source directory does not exist: ' + sourcePath);
+ }
+ return mapDirectory(rootDir, path.relative(rootDir, sourcePath), include, exclude);
+ });
+
+ // Scan the files in the target directory, if it exists.
+ var targetMap = {};
+ var targetFullPath = path.join(rootDir, targetDir);
+ if (fs.existsSync(targetFullPath)) {
+ targetMap = mapDirectory(rootDir, targetDir, include, exclude);
+ }
+
+ var pathMap = mergePathMaps(sourceMaps, targetMap, targetDir);
+
+ var updated = false;
+
+ // Iterate in sorted order to ensure directories are created before files under them.
+ Object.keys(pathMap).sort().forEach(function (subPath) {
+ var entry = pathMap[subPath];
+ updated = updatePathWithStats(
+ entry.sourcePath,
+ entry.sourceStats,
+ entry.targetPath,
+ entry.targetStats,
+ options,
+ log) || updated;
+ });
+
+ return updated;
+}
+
+/**
+ * Creates a dictionary map of all files and directories under a path.
+ */
+function mapDirectory (rootDir, subDir, include, exclude) {
+ var dirMap = { '': { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
+ mapSubdirectory(rootDir, subDir, '', include, exclude, dirMap);
+ return dirMap;
+
+ function mapSubdirectory (rootDir, subDir, relativeDir, include, exclude, dirMap) {
+ var itemMapped = false;
+ var items = fs.readdirSync(path.join(rootDir, subDir, relativeDir));
+
+ items.forEach(function (item) {
+ var relativePath = path.join(relativeDir, item);
+ if (!matchGlobArray(relativePath, exclude)) {
+ // Stats obtained here (required at least to know where to recurse in directories)
+ // are saved for later, where the modified times may also be used. This minimizes
+ // the number of file I/O operations performed.
+ var fullPath = path.join(rootDir, subDir, relativePath);
+ var stats = fs.statSync(fullPath);
+
+ if (stats.isDirectory()) {
+ // Directories are included if either something under them is included or they
+ // match an include glob.
+ if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) ||
+ matchGlobArray(relativePath, include)) {
+ dirMap[relativePath] = { subDir: subDir, stats: stats };
+ itemMapped = true;
+ }
+ } else if (stats.isFile()) {
+ // Files are included only if they match an include glob.
+ if (matchGlobArray(relativePath, include)) {
+ dirMap[relativePath] = { subDir: subDir, stats: stats };
+ itemMapped = true;
+ }
+ }
+ }
+ });
+ return itemMapped;
+ }
+
+ function matchGlobArray (path, globs) {
+ return globs.some(function (elem) {
+ return minimatch(path, elem, { dot: true });
+ });
+ }
+}
+
+/**
+ * Merges together multiple source maps and a target map into a single mapping from
+ * relative paths to objects with target and source paths and stats.
+ */
+function mergePathMaps (sourceMaps, targetMap, targetDir) {
+ // Merge multiple source maps together, along with target path info.
+ // Entries in later source maps override those in earlier source maps.
+ // Target stats will be filled in below for targets that exist.
+ var pathMap = {};
+ sourceMaps.forEach(function (sourceMap) {
+ Object.keys(sourceMap).forEach(function (sourceSubPath) {
+ var sourceEntry = sourceMap[sourceSubPath];
+ pathMap[sourceSubPath] = {
+ targetPath: path.join(targetDir, sourceSubPath),
+ targetStats: null,
+ sourcePath: path.join(sourceEntry.subDir, sourceSubPath),
+ sourceStats: sourceEntry.stats
+ };
+ });
+ });
+
+ // Fill in target stats for targets that exist, and create entries
+ // for targets that don't have any corresponding sources.
+ Object.keys(targetMap).forEach(function (subPath) {
+ var entry = pathMap[subPath];
+ if (entry) {
+ entry.targetStats = targetMap[subPath].stats;
+ } else {
+ pathMap[subPath] = {
+ targetPath: path.join(targetDir, subPath),
+ targetStats: targetMap[subPath].stats,
+ sourcePath: null,
+ sourceStats: null
+ };
+ }
+ });
+
+ return pathMap;
+}
+
+module.exports = {
+ updatePath: updatePath,
+ updatePaths: updatePaths,
+ mergeAndUpdateDir: mergeAndUpdateDir
+};
diff --git a/node_modules/cordova-common/src/PlatformJson.js b/node_modules/cordova-common/src/PlatformJson.js
new file mode 100644
index 0000000..0a87983
--- /dev/null
+++ b/node_modules/cordova-common/src/PlatformJson.js
@@ -0,0 +1,262 @@
+/*
+ * 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 endent = require('endent');
+var mungeutil = require('./ConfigChanges/munge-util');
+
+function PlatformJson (filePath, platform, root) {
+ this.filePath = filePath;
+ this.platform = platform;
+ this.root = fix_munge(root || {});
+}
+
+PlatformJson.load = function (plugins_dir, platform) {
+ var filePath = path.join(plugins_dir, platform + '.json');
+ var root = null;
+ if (fs.existsSync(filePath)) {
+ root = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
+ }
+ return new PlatformJson(filePath, platform, root);
+};
+
+PlatformJson.prototype.save = function () {
+ fs.outputJsonSync(this.filePath, this.root, { spaces: 2 });
+};
+
+/**
+ * Indicates whether the specified plugin is installed as a top-level (not as
+ * dependency to others)
+ * @method function
+ * @param {String} pluginId A plugin id to check for.
+ * @return {Boolean} true if plugin installed as top-level, otherwise false.
+ */
+PlatformJson.prototype.isPluginTopLevel = function (pluginId) {
+ return this.root.installed_plugins[pluginId];
+};
+
+/**
+ * Indicates whether the specified plugin is installed as a dependency to other
+ * plugin.
+ * @method function
+ * @param {String} pluginId A plugin id to check for.
+ * @return {Boolean} true if plugin installed as a dependency, otherwise false.
+ */
+PlatformJson.prototype.isPluginDependent = function (pluginId) {
+ return this.root.dependent_plugins[pluginId];
+};
+
+/**
+ * Indicates whether plugin is installed either as top-level or as dependency.
+ * @method function
+ * @param {String} pluginId A plugin id to check for.
+ * @return {Boolean} true if plugin installed, otherwise false.
+ */
+PlatformJson.prototype.isPluginInstalled = function (pluginId) {
+ return this.isPluginTopLevel(pluginId) ||
+ this.isPluginDependent(pluginId);
+};
+
+PlatformJson.prototype.addPlugin = function (pluginId, variables, isTopLevel) {
+ var pluginsList = isTopLevel
+ ? this.root.installed_plugins
+ : this.root.dependent_plugins;
+
+ pluginsList[pluginId] = variables;
+
+ return this;
+};
+
+/**
+ * @chaining
+ * Generates and adds metadata for provided plugin into associated .json file
+ *
+ * @param {PluginInfo} pluginInfo A pluginInfo instance to add metadata from
+ * @returns {this} Current PlatformJson instance to allow calls chaining
+ */
+PlatformJson.prototype.addPluginMetadata = function (pluginInfo) {
+ var installedModules = this.root.modules || [];
+
+ var installedPaths = installedModules.map(function (installedModule) {
+ return installedModule.file;
+ });
+
+ var modulesToInstall = pluginInfo.getJsModules(this.platform)
+ .map(function (module) {
+ return new ModuleMetadata(pluginInfo.id, module);
+ })
+ .filter(function (metadata) {
+ // Filter out modules which are already added to metadata
+ return !installedPaths.includes(metadata.file);
+ });
+
+ this.root.modules = installedModules.concat(modulesToInstall);
+
+ this.root.plugin_metadata = this.root.plugin_metadata || {};
+ this.root.plugin_metadata[pluginInfo.id] = pluginInfo.version;
+
+ return this;
+};
+
+PlatformJson.prototype.removePlugin = function (pluginId, isTopLevel) {
+ var pluginsList = isTopLevel
+ ? this.root.installed_plugins
+ : this.root.dependent_plugins;
+
+ delete pluginsList[pluginId];
+
+ return this;
+};
+
+/**
+ * @chaining
+ * Removes metadata for provided plugin from associated file
+ *
+ * @param {PluginInfo} pluginInfo A PluginInfo instance to which modules' metadata
+ * we need to remove
+ *
+ * @returns {this} Current PlatformJson instance to allow calls chaining
+ */
+PlatformJson.prototype.removePluginMetadata = function (pluginInfo) {
+ var modulesToRemove = pluginInfo.getJsModules(this.platform)
+ .map(function (jsModule) {
+ return ['plugins', pluginInfo.id, jsModule.src].join('/');
+ });
+
+ var installedModules = this.root.modules || [];
+ this.root.modules = installedModules
+ .filter(function (installedModule) {
+ // Leave only those metadatas which 'file' is not in removed modules
+ return !modulesToRemove.includes(installedModule.file);
+ });
+
+ if (this.root.plugin_metadata) {
+ delete this.root.plugin_metadata[pluginInfo.id];
+ }
+
+ return this;
+};
+
+PlatformJson.prototype.addInstalledPluginToPrepareQueue = function (pluginDirName, vars, is_top_level, force) {
+ this.root.prepare_queue.installed.push({ plugin: pluginDirName, vars: vars, topLevel: is_top_level, force: force });
+};
+
+PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function (pluginId, is_top_level) {
+ this.root.prepare_queue.uninstalled.push({ plugin: pluginId, id: pluginId, topLevel: is_top_level });
+};
+
+/**
+ * Moves plugin, specified by id to top-level plugins. If plugin is top-level
+ * already, then does nothing.
+ * @method function
+ * @param {String} pluginId A plugin id to make top-level.
+ * @return {PlatformJson} PlatformJson instance.
+ */
+PlatformJson.prototype.makeTopLevel = function (pluginId) {
+ var plugin = this.root.dependent_plugins[pluginId];
+ if (plugin) {
+ delete this.root.dependent_plugins[pluginId];
+ this.root.installed_plugins[pluginId] = plugin;
+ }
+ return this;
+};
+
+/**
+ * Generates a metadata for all installed plugins and js modules. The resultant
+ * string is ready to be written to 'cordova_plugins.js'
+ *
+ * @returns {String} cordova_plugins.js contents
+ */
+PlatformJson.prototype.generateMetadata = function () {
+ const stringify = o => JSON.stringify(o, null, 2);
+ return endent`
+ cordova.define('cordova/plugin_list', function(require, exports, module) {
+ module.exports = ${stringify(this.root.modules)};
+ module.exports.metadata = ${stringify(this.root.plugin_metadata)};
+ });
+ `;
+};
+
+/**
+ * @chaining
+ * Generates and then saves metadata to specified file. Doesn't check if file exists.
+ *
+ * @param {String} destination File metadata will be written to
+ * @return {PlatformJson} PlatformJson instance
+ */
+PlatformJson.prototype.generateAndSaveMetadata = function (destination) {
+ fs.outputFileSync(destination, this.generateMetadata());
+
+ return this;
+};
+
+// convert a munge from the old format ([file][parent][xml] = count) to the current one
+function fix_munge (root) {
+ root.prepare_queue = root.prepare_queue || { installed: [], uninstalled: [] };
+ root.config_munge = root.config_munge || { files: {} };
+ root.installed_plugins = root.installed_plugins || {};
+ root.dependent_plugins = root.dependent_plugins || {};
+
+ var munge = root.config_munge;
+ if (!munge.files) {
+ var new_munge = { files: {} };
+ for (var file in munge) {
+ for (var selector in munge[file]) {
+ for (var xml_child in munge[file][selector]) {
+ var val = parseInt(munge[file][selector][xml_child]);
+ for (var i = 0; i < val; i++) {
+ mungeutil.deep_add(new_munge, [file, selector, { xml: xml_child, count: val }]);
+ }
+ }
+ }
+ }
+ root.config_munge = new_munge;
+ }
+
+ return root;
+}
+
+/**
+ * @constructor
+ * @class ModuleMetadata
+ *
+ * Creates a ModuleMetadata object that represents module entry in 'cordova_plugins.js'
+ * file at run time
+ *
+ * @param {String} pluginId Plugin id where this module installed from
+ * @param (JsModule|Object) jsModule A js-module entry from PluginInfo class to generate metadata for
+ */
+function ModuleMetadata (pluginId, jsModule) {
+ if (!pluginId) throw new TypeError('pluginId argument must be a valid plugin id');
+ if (!jsModule.src && !jsModule.name) throw new TypeError('jsModule argument must contain src or/and name properties');
+
+ this.id = pluginId + '.' + (jsModule.name || jsModule.src.match(/([^/]+)\.js/)[1]);
+ this.file = ['plugins', pluginId, jsModule.src].join('/');
+ this.pluginId = pluginId;
+
+ if (jsModule.clobbers && jsModule.clobbers.length > 0) {
+ this.clobbers = jsModule.clobbers.map(function (o) { return o.target; });
+ }
+ if (jsModule.merges && jsModule.merges.length > 0) {
+ this.merges = jsModule.merges.map(function (o) { return o.target; });
+ }
+ if (jsModule.runs) {
+ this.runs = true;
+ }
+}
+
+module.exports = PlatformJson;
diff --git a/node_modules/cordova-common/src/PluginInfo/PluginInfo.js b/node_modules/cordova-common/src/PluginInfo/PluginInfo.js
new file mode 100644
index 0000000..0130741
--- /dev/null
+++ b/node_modules/cordova-common/src/PluginInfo/PluginInfo.js
@@ -0,0 +1,494 @@
+/**
+ 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.
+*/
+
+/*
+A class for holidng the information currently stored in plugin.xml
+It should also be able to answer questions like whether the plugin
+is compatible with a given engine version.
+
+TODO (kamrik): refactor this to not use sync functions and return promises.
+*/
+
+var path = require('path');
+var fs = require('fs-extra');
+var xml_helpers = require('../util/xml-helpers');
+var CordovaError = require('../CordovaError/CordovaError');
+
+function PluginInfo (dirname) {
+ var self = this;
+
+ // METHODS
+ // Defined inside the constructor to avoid the "this" binding problems.
+
+ // tag
+ // Example:
+ // Used to require a variable to be specified via --variable when installing the plugin.
+ // returns { key : default | null}
+ self.getPreferences = getPreferences;
+ function getPreferences (platform) {
+ return _getTags(self._et, 'preference', platform, _parsePreference)
+ .reduce(function (preferences, pref) {
+ preferences[pref.preference] = pref.default;
+ return preferences;
+ }, {});
+ }
+
+ function _parsePreference (prefTag) {
+ var name = prefTag.attrib.name.toUpperCase();
+ var def = prefTag.attrib.default || null;
+ return { preference: name, default: def };
+ }
+
+ //
+ self.getAssets = getAssets;
+ function getAssets (platform) {
+ var assets = _getTags(self._et, 'asset', platform, _parseAsset);
+ return assets;
+ }
+
+ function _parseAsset (tag) {
+ var src = tag.attrib.src;
+ var target = tag.attrib.target;
+
+ if (!src || !target) {
+ var msg =
+ 'Malformed tag. Both "src" and "target" attributes' +
+ 'must be specified in\n' +
+ self.filepath
+ ;
+ throw new Error(msg);
+ }
+
+ var asset = {
+ itemType: 'asset',
+ src: src,
+ target: target
+ };
+ return asset;
+ }
+
+ //
+ // Example:
+ //
+ self.getDependencies = getDependencies;
+ function getDependencies (platform) {
+ var deps = _getTags(
+ self._et,
+ 'dependency',
+ platform,
+ _parseDependency
+ );
+ return deps;
+ }
+
+ function _parseDependency (tag) {
+ var dep =
+ { id: tag.attrib.id,
+ version: tag.attrib.version || '',
+ url: tag.attrib.url || '',
+ subdir: tag.attrib.subdir || '',
+ commit: tag.attrib.commit
+ };
+
+ dep.git_ref = dep.commit;
+
+ if (!dep.id) {
+ var msg =
+ ' tag is missing id attribute in ' +
+ self.filepath
+ ;
+ throw new CordovaError(msg);
+ }
+ return dep;
+ }
+
+ // tag
+ self.getConfigFiles = getConfigFiles;
+ function getConfigFiles (platform) {
+ var configFiles = _getTags(self._et, 'config-file', platform, _parseConfigFile);
+ return configFiles;
+ }
+
+ function _parseConfigFile (tag) {
+ var configFile =
+ { target: tag.attrib['target'],
+ parent: tag.attrib['parent'],
+ after: tag.attrib['after'],
+ xmls: tag.getchildren(),
+ // To support demuxing via versions
+ versions: tag.attrib['versions'],
+ deviceTarget: tag.attrib['device-target']
+ };
+ return configFile;
+ }
+
+ self.getEditConfigs = getEditConfigs;
+ function getEditConfigs (platform) {
+ var editConfigs = _getTags(self._et, 'edit-config', platform, _parseEditConfigs);
+ return editConfigs;
+ }
+
+ function _parseEditConfigs (tag) {
+ var editConfig =
+ { file: tag.attrib['file'],
+ target: tag.attrib['target'],
+ mode: tag.attrib['mode'],
+ xmls: tag.getchildren()
+ };
+ return editConfig;
+ }
+
+ // tags, both global and within a
+ // TODO (kamrik): Do we ever use under ? Example wanted.
+ self.getInfo = getInfo;
+ function getInfo (platform) {
+ var infos = _getTags(
+ self._et,
+ 'info',
+ platform,
+ function (elem) { return elem.text; }
+ );
+ // Filter out any undefined or empty strings.
+ infos = infos.filter(Boolean);
+ return infos;
+ }
+
+ //
+ // Examples:
+ //
+ //
+ self.getSourceFiles = getSourceFiles;
+ function getSourceFiles (platform) {
+ var sourceFiles = _getTagsInPlatform(self._et, 'source-file', platform, _parseSourceFile);
+ return sourceFiles;
+ }
+
+ function _parseSourceFile (tag) {
+ return {
+ itemType: 'source-file',
+ src: tag.attrib.src,
+ framework: isStrTrue(tag.attrib.framework),
+ weak: isStrTrue(tag.attrib.weak),
+ compilerFlags: tag.attrib['compiler-flags'],
+ targetDir: tag.attrib['target-dir']
+ };
+ }
+
+ //
+ // Example:
+ //
+ self.getHeaderFiles = getHeaderFiles;
+ function getHeaderFiles (platform) {
+ var headerFiles = _getTagsInPlatform(self._et, 'header-file', platform, function (tag) {
+ return {
+ itemType: 'header-file',
+ src: tag.attrib.src,
+ targetDir: tag.attrib['target-dir'],
+ type: tag.attrib['type']
+ };
+ });
+ return headerFiles;
+ }
+
+ //
+ // Example:
+ //
+ self.getResourceFiles = getResourceFiles;
+ function getResourceFiles (platform) {
+ var resourceFiles = _getTagsInPlatform(self._et, 'resource-file', platform, function (tag) {
+ return {
+ itemType: 'resource-file',
+ src: tag.attrib.src,
+ target: tag.attrib.target,
+ versions: tag.attrib.versions,
+ deviceTarget: tag.attrib['device-target'],
+ arch: tag.attrib.arch,
+ reference: tag.attrib.reference
+ };
+ });
+ return resourceFiles;
+ }
+
+ //
+ // Example:
+ //
+ self.getLibFiles = getLibFiles;
+ function getLibFiles (platform) {
+ var libFiles = _getTagsInPlatform(self._et, 'lib-file', platform, function (tag) {
+ return {
+ itemType: 'lib-file',
+ src: tag.attrib.src,
+ arch: tag.attrib.arch,
+ Include: tag.attrib.Include,
+ versions: tag.attrib.versions,
+ deviceTarget: tag.attrib['device-target'] || tag.attrib.target
+ };
+ });
+ return libFiles;
+ }
+
+ //
+ // Example:
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ self.getPodSpecs = getPodSpecs;
+ function getPodSpecs (platform) {
+ var podSpecs = _getTagsInPlatform(self._et, 'podspec', platform, function (tag) {
+ var declarations = null;
+ var sources = null;
+ var libraries = null;
+ var config = tag.find('config');
+ var pods = tag.find('pods');
+ if (config != null) {
+ sources = config.findall('source').map(function (t) {
+ return {
+ url: t.attrib.url
+ };
+ }).reduce(function (acc, val) {
+ return Object.assign({}, acc, { [val.url]: { source: val.url } });
+ }, {});
+ }
+ if (pods != null) {
+ declarations = Object.keys(pods.attrib).reduce(function (acc, key) {
+ return pods.attrib[key] === undefined ? acc : Object.assign({}, acc, { [key]: pods.attrib[key] });
+ }, {});
+ libraries = pods.findall('pod').map(function (t) {
+ return Object.keys(t.attrib).reduce(function (acc, key) {
+ return t.attrib[key] === undefined ? acc : Object.assign({}, acc, { [key]: t.attrib[key] });
+ }, {});
+ }).reduce(function (acc, val) {
+ return Object.assign({}, acc, { [val.name]: val });
+ }, {});
+ }
+ return {
+ declarations: declarations,
+ sources: sources,
+ libraries: libraries
+ };
+ });
+ return podSpecs;
+ }
+
+ //
+ // Example:
+ //
+ self.getHookScripts = getHookScripts;
+ function getHookScripts (hook, platforms) {
+ var scriptElements = self._et.findall('./hook');
+
+ if (platforms) {
+ platforms.forEach(function (platform) {
+ scriptElements = scriptElements.concat(self._et.findall('./platform[@name="' + platform + '"]/hook'));
+ });
+ }
+
+ function filterScriptByHookType (el) {
+ return el.attrib.src && el.attrib.type && el.attrib.type.toLowerCase() === hook;
+ }
+
+ return scriptElements.filter(filterScriptByHookType);
+ }
+
+ self.getJsModules = getJsModules;
+ function getJsModules (platform) {
+ var modules = _getTags(self._et, 'js-module', platform, _parseJsModule);
+ return modules;
+ }
+
+ function _parseJsModule (tag) {
+ var ret = {
+ itemType: 'js-module',
+ name: tag.attrib.name,
+ src: tag.attrib.src,
+ clobbers: tag.findall('clobbers').map(function (tag) { return { target: tag.attrib.target }; }),
+ merges: tag.findall('merges').map(function (tag) { return { target: tag.attrib.target }; }),
+ runs: tag.findall('runs').length > 0
+ };
+
+ return ret;
+ }
+
+ self.getEngines = function () {
+ return self._et.findall('engines/engine').map(function (n) {
+ return {
+ name: n.attrib.name,
+ version: n.attrib.version,
+ platform: n.attrib.platform,
+ scriptSrc: n.attrib.scriptSrc
+ };
+ });
+ };
+
+ self.getPlatforms = function () {
+ return self._et.findall('platform').map(function (n) {
+ return { name: n.attrib.name };
+ });
+ };
+
+ self.getPlatformsArray = function () {
+ return self._et.findall('platform').map(function (n) {
+ return n.attrib.name;
+ });
+ };
+
+ self.getFrameworks = function (platform, options) {
+ return _getTags(self._et, 'framework', platform, function (el) {
+ var src = el.attrib.src;
+ if (options) {
+ var vars = options.cli_variables || {};
+
+ if (Object.keys(vars).length === 0) {
+ // get variable defaults from plugin.xml for removal
+ vars = self.getPreferences(platform);
+ }
+ var regExp;
+ // Iterate over plugin variables.
+ // Replace them in framework src if they exist
+ Object.keys(vars).forEach(function (name) {
+ if (vars[name]) {
+ regExp = new RegExp('\\$' + name, 'g');
+ src = src.replace(regExp, vars[name]);
+ }
+ });
+ }
+ var ret = {
+ itemType: 'framework',
+ type: el.attrib.type,
+ parent: el.attrib.parent,
+ custom: isStrTrue(el.attrib.custom),
+ embed: isStrTrue(el.attrib.embed),
+ src: src,
+ spec: el.attrib.spec,
+ weak: isStrTrue(el.attrib.weak),
+ versions: el.attrib.versions,
+ targetDir: el.attrib['target-dir'],
+ deviceTarget: el.attrib['device-target'] || el.attrib.target,
+ arch: el.attrib.arch,
+ implementation: el.attrib.implementation
+ };
+ return ret;
+ });
+ };
+
+ self.getFilesAndFrameworks = getFilesAndFrameworks;
+ function getFilesAndFrameworks (platform, options) {
+ // Please avoid changing the order of the calls below, files will be
+ // installed in this order.
+ var items = [].concat(
+ self.getSourceFiles(platform),
+ self.getHeaderFiles(platform),
+ self.getResourceFiles(platform),
+ self.getFrameworks(platform, options),
+ self.getLibFiles(platform)
+ );
+ return items;
+ }
+ /// // End of PluginInfo methods /////
+
+ /// // PluginInfo Constructor logic /////
+ self.filepath = path.join(dirname, 'plugin.xml');
+ if (!fs.existsSync(self.filepath)) {
+ throw new CordovaError('Cannot find plugin.xml for plugin "' + path.basename(dirname) + '". Please try adding it again.');
+ }
+
+ self.dir = dirname;
+ var et = self._et = xml_helpers.parseElementtreeSync(self.filepath);
+ var pelem = et.getroot();
+ self.id = pelem.attrib.id;
+ self.version = pelem.attrib.version;
+
+ // Optional fields
+ self.name = pelem.findtext('name');
+ self.description = pelem.findtext('description');
+ self.license = pelem.findtext('license');
+ self.repo = pelem.findtext('repo');
+ self.issue = pelem.findtext('issue');
+ self.keywords = pelem.findtext('keywords');
+ self.info = pelem.findtext('info');
+ if (self.keywords) {
+ self.keywords = self.keywords.split(',').map(function (s) { return s.trim(); });
+ }
+ self.getKeywordsAndPlatforms = function () {
+ var ret = self.keywords || [];
+ return ret.concat('ecosystem:cordova').concat(addCordova(self.getPlatformsArray()));
+ };
+} // End of PluginInfo constructor.
+
+// Helper function used to prefix every element of an array with cordova-
+// Useful when we want to modify platforms to be cordova-platform
+function addCordova (someArray) {
+ var newArray = someArray.map(function (element) {
+ return 'cordova-' + element;
+ });
+ return newArray;
+}
+
+// Helper function used by most of the getSomething methods of PluginInfo.
+// Get all elements of a given name. Both in root and in platform sections
+// for the given platform. If transform is given and is a function, it is
+// applied to each element.
+function _getTags (pelem, tag, platform, transform) {
+ var platformTag = pelem.find('./platform[@name="' + platform + '"]');
+ var tagsInRoot = pelem.findall(tag);
+ tagsInRoot = tagsInRoot || [];
+ var tagsInPlatform = platformTag ? platformTag.findall(tag) : [];
+ var tags = tagsInRoot.concat(tagsInPlatform);
+ if (typeof transform === 'function') {
+ tags = tags.map(transform);
+ }
+ return tags;
+}
+
+// Same as _getTags() but only looks inside a platform section.
+function _getTagsInPlatform (pelem, tag, platform, transform) {
+ var platformTag = pelem.find('./platform[@name="' + platform + '"]');
+ var tags = platformTag ? platformTag.findall(tag) : [];
+ if (typeof transform === 'function') {
+ tags = tags.map(transform);
+ }
+ return tags;
+}
+
+// Check if x is a string 'true'.
+function isStrTrue (x) {
+ return String(x).toLowerCase() === 'true';
+}
+
+module.exports = PluginInfo;
+// Backwards compat:
+PluginInfo.PluginInfo = PluginInfo;
+PluginInfo.loadPluginsDir = function (dir) {
+ var PluginInfoProvider = require('./PluginInfoProvider');
+ return new PluginInfoProvider().getAllWithinSearchPath(dir);
+};
diff --git a/node_modules/cordova-common/src/PluginInfo/PluginInfoProvider.js b/node_modules/cordova-common/src/PluginInfo/PluginInfoProvider.js
new file mode 100644
index 0000000..403167d
--- /dev/null
+++ b/node_modules/cordova-common/src/PluginInfo/PluginInfoProvider.js
@@ -0,0 +1,82 @@
+/**
+ 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.
+*/
+
+/* jshint sub:true, laxcomma:true, laxbreak:true */
+
+var fs = require('fs-extra');
+var path = require('path');
+var PluginInfo = require('./PluginInfo');
+var events = require('../events');
+
+function PluginInfoProvider () {
+ this._cache = {};
+ this._getAllCache = {};
+}
+
+PluginInfoProvider.prototype.get = function (dirName) {
+ var absPath = path.resolve(dirName);
+ if (!this._cache[absPath]) {
+ this._cache[absPath] = new PluginInfo(dirName);
+ }
+ return this._cache[absPath];
+};
+
+// Normally you don't need to put() entries, but it's used
+// when copying plugins, and in unit tests.
+PluginInfoProvider.prototype.put = function (pluginInfo) {
+ var absPath = path.resolve(pluginInfo.dir);
+ this._cache[absPath] = pluginInfo;
+};
+
+// Used for plugin search path processing.
+// Given a dir containing multiple plugins, create a PluginInfo object for
+// each of them and return as array.
+// Should load them all in parallel and return a promise, but not yet.
+PluginInfoProvider.prototype.getAllWithinSearchPath = function (dirName) {
+ var absPath = path.resolve(dirName);
+ if (!this._getAllCache[absPath]) {
+ this._getAllCache[absPath] = getAllHelper(absPath, this);
+ }
+ return this._getAllCache[absPath];
+};
+
+function getAllHelper (absPath, provider) {
+ if (!fs.existsSync(absPath)) {
+ return [];
+ }
+ // If dir itself is a plugin, return it in an array with one element.
+ if (fs.existsSync(path.join(absPath, 'plugin.xml'))) {
+ return [provider.get(absPath)];
+ }
+ var subdirs = fs.readdirSync(absPath);
+ var plugins = [];
+ subdirs.forEach(function (subdir) {
+ var d = path.join(absPath, subdir);
+ if (fs.existsSync(path.join(d, 'plugin.xml'))) {
+ try {
+ plugins.push(provider.get(d));
+ } catch (e) {
+ events.emit('warn', 'Error parsing ' + path.join(d, 'plugin.xml.\n' + e.stack));
+ }
+ }
+ });
+ return plugins;
+}
+
+module.exports = PluginInfoProvider;
diff --git a/node_modules/cordova-common/src/PluginManager.js b/node_modules/cordova-common/src/PluginManager.js
new file mode 100644
index 0000000..4e9973b
--- /dev/null
+++ b/node_modules/cordova-common/src/PluginManager.js
@@ -0,0 +1,149 @@
+/*
+ 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 Q = require('q');
+var fs = require('fs-extra');
+var path = require('path');
+
+var ActionStack = require('./ActionStack');
+var PlatformJson = require('./PlatformJson');
+var CordovaError = require('./CordovaError/CordovaError');
+var PlatformMunger = require('./ConfigChanges/ConfigChanges').PlatformMunger;
+var PluginInfoProvider = require('./PluginInfo/PluginInfoProvider');
+
+/**
+ * @constructor
+ * @class PluginManager
+ * Represents an entity for adding/removing plugins for platforms
+ *
+ * @param {String} platform Platform name
+ * @param {Object} locations - Platform files and directories
+ * @param {IDEProject} ideProject The IDE project to add/remove plugin changes to/from
+ */
+function PluginManager (platform, locations, ideProject) {
+ this.platform = platform;
+ this.locations = locations;
+ this.project = ideProject;
+
+ var platformJson = PlatformJson.load(locations.root, platform);
+ this.munger = new PlatformMunger(platform, locations.root, platformJson, new PluginInfoProvider());
+}
+
+/**
+ * @constructs PluginManager
+ * A convenience shortcut to new PluginManager(...)
+ *
+ * @param {String} platform Platform name
+ * @param {Object} locations - Platform files and directories
+ * @param {IDEProject} ideProject The IDE project to add/remove plugin changes to/from
+ * @returns new PluginManager instance
+ */
+PluginManager.get = function (platform, locations, ideProject) {
+ return new PluginManager(platform, locations, ideProject);
+};
+
+PluginManager.INSTALL = 'install';
+PluginManager.UNINSTALL = 'uninstall';
+
+module.exports = PluginManager;
+
+/**
+ * Describes and implements common plugin installation/uninstallation routine. The flow is the following:
+ * * Validate and set defaults for options. Note that options are empty by default. Everything
+ * needed for platform IDE project must be passed from outside. Plugin variables (which
+ * are the part of the options) also must be already populated with 'PACKAGE_NAME' variable.
+ * * Collect all plugin's native and web files, get installers/uninstallers and process
+ * all these via ActionStack.
+ * * Save the IDE project, so the changes made by installers are persisted.
+ * * Generate config changes munge for plugin and apply it to all required files
+ * * Generate metadata for plugin and plugin modules and save it to 'cordova_plugins.js'
+ *
+ * @param {PluginInfo} plugin A PluginInfo structure representing plugin to install
+ * @param {Object} [options={}] An installation options. It is expected but is not necessary
+ * that options would contain 'variables' inner object with 'PACKAGE_NAME' field set by caller.
+ *
+ * @returns {Promise} Returns a Q promise, either resolved in case of success, rejected otherwise.
+ */
+PluginManager.prototype.doOperation = function (operation, plugin, options) {
+ if (operation !== PluginManager.INSTALL && operation !== PluginManager.UNINSTALL) { return Q.reject(new CordovaError('The parameter is incorrect. The opeation must be either "add" or "remove"')); }
+
+ if (!plugin || plugin.constructor.name !== 'PluginInfo') { return Q.reject(new CordovaError('The parameter is incorrect. The first parameter should be a PluginInfo instance')); }
+
+ // Set default to empty object to play safe when accesing properties
+ options = options || {};
+
+ var self = this;
+ var actions = new ActionStack();
+
+ // gather all files need to be handled during operation ...
+ plugin.getFilesAndFrameworks(this.platform, options)
+ .concat(plugin.getAssets(this.platform))
+ .concat(plugin.getJsModules(this.platform))
+ // ... put them into stack ...
+ .forEach(function (item) {
+ var installer = self.project.getInstaller(item.itemType);
+ var uninstaller = self.project.getUninstaller(item.itemType);
+ var actionArgs = [item, plugin, self.project, options];
+
+ var action;
+ if (operation === PluginManager.INSTALL) {
+ action = actions.createAction(installer, actionArgs, uninstaller, actionArgs);
+ } else /* op === PluginManager.UNINSTALL */{
+ action = actions.createAction(uninstaller, actionArgs, installer, actionArgs);
+ }
+ actions.push(action);
+ });
+
+ // ... and run through the action stack
+ return actions.process(this.platform)
+ .then(function () {
+ if (self.project.write) {
+ self.project.write();
+ }
+
+ if (operation === PluginManager.INSTALL) {
+ // Ignore passed `is_top_level` option since platform itself doesn't know
+ // anything about managing dependencies - it's responsibility of caller.
+ self.munger.add_plugin_changes(plugin, options.variables, /* is_top_level= */true, /* should_increment= */true, options.force);
+ self.munger.platformJson.addPluginMetadata(plugin);
+ } else {
+ self.munger.remove_plugin_changes(plugin, /* is_top_level= */true);
+ self.munger.platformJson.removePluginMetadata(plugin);
+ }
+
+ // Save everything (munge and plugin/modules metadata)
+ self.munger.save_all();
+
+ var metadata = self.munger.platformJson.generateMetadata();
+ fs.writeFileSync(path.join(self.locations.www, 'cordova_plugins.js'), metadata, 'utf-8');
+
+ // CB-11022 save plugin metadata to both www and platform_www if options.usePlatformWww is specified
+ if (options.usePlatformWww) {
+ fs.writeFileSync(path.join(self.locations.platformWww, 'cordova_plugins.js'), metadata, 'utf-8');
+ }
+ });
+};
+
+PluginManager.prototype.addPlugin = function (plugin, installOptions) {
+ return this.doOperation(PluginManager.INSTALL, plugin, installOptions);
+};
+
+PluginManager.prototype.removePlugin = function (plugin, uninstallOptions) {
+ return this.doOperation(PluginManager.UNINSTALL, plugin, uninstallOptions);
+};
diff --git a/node_modules/cordova-common/src/events.js b/node_modules/cordova-common/src/events.js
new file mode 100644
index 0000000..d16485c
--- /dev/null
+++ b/node_modules/cordova-common/src/events.js
@@ -0,0 +1,81 @@
+/**
+ 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 EventEmitter = require('events').EventEmitter;
+
+const MAX_LISTENERS = 20;
+
+const INSTANCE_KEY = Symbol.for('org.apache.cordova.common.CordovaEvents');
+
+let EVENTS_RECEIVER = null;
+
+class CordovaEventEmitter extends EventEmitter {
+ /**
+ * Sets up current instance to forward emitted events to another EventEmitter
+ * instance.
+ *
+ * @param {EventEmitter} [eventEmitter] The emitter instance to forward
+ * events to. Falsy value, when passed, disables forwarding.
+ */
+ forwardEventsTo (eventEmitter) {
+ // If no argument is specified disable events forwarding
+ if (!eventEmitter) {
+ EVENTS_RECEIVER = undefined;
+ return;
+ }
+
+ if (!(eventEmitter instanceof EventEmitter)) {
+ throw new Error('Cordova events can be redirected to another EventEmitter instance only');
+ }
+
+ // CB-10940 Skipping forwarding to self to avoid infinite recursion.
+ // This is the case when the modules are npm-linked.
+ if (this !== eventEmitter) {
+ EVENTS_RECEIVER = eventEmitter;
+ } else {
+ // Reset forwarding if we are subscribing to self
+ EVENTS_RECEIVER = undefined;
+ }
+ }
+
+ /**
+ * Sets up current instance to forward emitted events to another EventEmitter
+ * instance.
+ *
+ * @param {EventEmitter} [eventEmitter] The emitter instance to forward
+ * events to. Falsy value, when passed, disables forwarding.
+ */
+ emit (eventName, ...args) {
+ if (EVENTS_RECEIVER) {
+ EVENTS_RECEIVER.emit(eventName, ...args);
+ }
+
+ return super.emit(eventName, ...args);
+ }
+}
+
+// This singleton instance pattern is based on the ideas from
+// https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
+if (Object.getOwnPropertySymbols(global).indexOf(INSTANCE_KEY) === -1) {
+ const events = new CordovaEventEmitter();
+ events.setMaxListeners(MAX_LISTENERS);
+ global[INSTANCE_KEY] = events;
+}
+
+module.exports = global[INSTANCE_KEY];
diff --git a/node_modules/cordova-common/src/superspawn.js b/node_modules/cordova-common/src/superspawn.js
new file mode 100644
index 0000000..7c999a1
--- /dev/null
+++ b/node_modules/cordova-common/src/superspawn.js
@@ -0,0 +1,155 @@
+/**
+ 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 crossSpawn = require('cross-spawn');
+var fs = require('fs-extra');
+var _ = require('underscore');
+var Q = require('q');
+var events = require('./events');
+var iswin32 = process.platform === 'win32';
+
+/**
+ * A special implementation for child_process.spawn that handles
+ * Windows-specific issues with batch files and spaces in paths. Returns a
+ * promise that succeeds only for return code 0. It is also possible to
+ * subscribe on spawned process' stdout and stderr streams using progress
+ * handler for resultant promise.
+ *
+ * @example spawn('mycommand', [], {stdio: 'pipe'}) .progress(function (stdio){
+ * if (stdio.stderr) { console.error(stdio.stderr); } })
+ * .then(function(result){ // do other stuff })
+ *
+ * @param {String} cmd A command to spawn
+ * @param {String[]} [args=[]] An array of arguments, passed to spawned
+ * process
+ * @param {Object} [opts={}] A configuration object
+ * @param {String|String[]|Object} opts.stdio Property that configures how
+ * spawned process' stdio will behave. Has the same meaning and possible
+ * values as 'stdio' options for child_process.spawn method
+ * (https://nodejs.org/api/child_process.html#child_process_options_stdio).
+ * @param {Object} [env={}] A map of extra environment variables
+ * @param {String} [cwd=process.cwd()] Working directory for the command
+ * @param {Boolean} [chmod=false] If truthy, will attempt to set the execute
+ * bit before executing on non-Windows platforms
+ *
+ * @return {Promise} A promise that is either fulfilled if the spawned
+ * process is exited with zero error code or rejected otherwise. If the
+ * 'stdio' option set to 'default' or 'pipe', the promise also emits progress
+ * messages with the following contents:
+ * {
+ * 'stdout': ...,
+ * 'stderr': ...
+ * }
+ */
+exports.spawn = function (cmd, args, opts) {
+ args = args || [];
+ opts = opts || {};
+ var spawnOpts = {};
+ var d = Q.defer();
+
+ if (opts.stdio !== 'default') {
+ // Ignore 'default' value for stdio because it corresponds to child_process's default 'pipe' option
+ spawnOpts.stdio = opts.stdio;
+ }
+
+ if (opts.cwd) {
+ spawnOpts.cwd = opts.cwd;
+ }
+
+ if (opts.env) {
+ spawnOpts.env = _.extend(_.extend({}, process.env), opts.env);
+ }
+
+ if (opts.chmod && !iswin32) {
+ try {
+ // This fails when module is installed in a system directory (e.g. via sudo npm install)
+ fs.chmodSync(cmd, '755');
+ } catch (e) {
+ // If the perms weren't set right, then this will come as an error upon execution.
+ }
+ }
+
+ events.emit(opts.printCommand ? 'log' : 'verbose', 'Running command: ' + cmd + ' ' + args.join(' '));
+
+ // At least until Node.js 8, child_process.spawn will throw exceptions
+ // instead of emitting error events in certain cases (like EACCES), Thus we
+ // have to wrap the execution in try/catch to convert them into rejections.
+ try {
+ var child = crossSpawn.spawn(cmd, args, spawnOpts);
+ } catch (e) {
+ whenDone(e);
+ return d.promise;
+ }
+ var capturedOut = '';
+ var capturedErr = '';
+
+ if (child.stdout) {
+ child.stdout.setEncoding('utf8');
+ child.stdout.on('data', function (data) {
+ capturedOut += data;
+ d.notify({ stdout: data });
+ });
+ }
+
+ if (child.stderr) {
+ child.stderr.setEncoding('utf8');
+ child.stderr.on('data', function (data) {
+ capturedErr += data;
+ d.notify({ stderr: data });
+ });
+ }
+
+ child.on('close', whenDone);
+ child.on('error', whenDone);
+ function whenDone (arg) {
+ if (child) {
+ child.removeListener('close', whenDone);
+ child.removeListener('error', whenDone);
+ }
+ var code = typeof arg === 'number' ? arg : arg && arg.code;
+
+ events.emit('verbose', 'Command finished with error code ' + code + ': ' + cmd + ' ' + args);
+ if (code === 0) {
+ d.resolve(capturedOut.trim());
+ } else {
+ var errMsg = cmd + ': Command failed with exit code ' + code;
+ if (capturedErr) {
+ errMsg += ' Error output:\n' + capturedErr.trim();
+ }
+ var err = new Error(errMsg);
+ if (capturedErr) {
+ err.stderr = capturedErr;
+ }
+ if (capturedOut) {
+ err.stdout = capturedOut;
+ }
+ err.code = code;
+ d.reject(err);
+ }
+ }
+
+ return d.promise;
+};
+
+exports.maybeSpawn = function (cmd, args, opts) {
+ if (fs.existsSync(cmd)) {
+ return exports.spawn(cmd, args, opts);
+ }
+ return Q(null);
+};
diff --git a/node_modules/cordova-common/src/util/addProperty.js b/node_modules/cordova-common/src/util/addProperty.js
new file mode 100644
index 0000000..6e058d3
--- /dev/null
+++ b/node_modules/cordova-common/src/util/addProperty.js
@@ -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.
+*/
+
+module.exports = function addProperty (module, property, modulePath, obj) {
+ obj = obj || module.exports;
+ // Add properties as getter to delay load the modules on first invocation
+ Object.defineProperty(obj, property, {
+ configurable: true,
+ get: function () {
+ var delayLoadedModule = module.require(modulePath);
+ obj[property] = delayLoadedModule;
+ return delayLoadedModule;
+ }
+ });
+};
diff --git a/node_modules/cordova-common/src/util/formatError.js b/node_modules/cordova-common/src/util/formatError.js
new file mode 100644
index 0000000..c080ad2
--- /dev/null
+++ b/node_modules/cordova-common/src/util/formatError.js
@@ -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.
+*/
+
+const CordovaError = require('../CordovaError/CordovaError');
+
+/**
+ * Formats an error for logging.
+ *
+ * @param {Error} error - The error to be formatted.
+ * @param {boolean} isVerbose - Whether the include additional debugging
+ * information when formatting the error.
+ *
+ * @returns {string} The formatted error message.
+ */
+module.exports = function formatError (error, isVerbose) {
+ var message = '';
+
+ if (error instanceof CordovaError) {
+ message = error.toString(isVerbose);
+ } else if (error instanceof Error) {
+ if (isVerbose) {
+ message = error.stack;
+ } else {
+ message = error.message;
+ }
+ } else {
+ // Plain text error message
+ message = error;
+ }
+
+ if (typeof message === 'string' && !message.toUpperCase().startsWith('ERROR:')) {
+ // Needed for backward compatibility with external tools
+ message = 'Error: ' + message;
+ }
+
+ return message;
+};
diff --git a/node_modules/cordova-common/src/util/plist-helpers.js b/node_modules/cordova-common/src/util/plist-helpers.js
new file mode 100644
index 0000000..9e50dbf
--- /dev/null
+++ b/node_modules/cordova-common/src/util/plist-helpers.js
@@ -0,0 +1,95 @@
+/**
+ 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.
+*/
+
+// contains PLIST utility functions
+var __ = require('underscore');
+var plist = require('plist');
+
+// adds node to doc at selector
+module.exports.graftPLIST = graftPLIST;
+function graftPLIST (doc, xml, selector) {
+ var obj = plist.parse('' + xml + ' ');
+
+ var node = doc[selector];
+ if (node && Array.isArray(node) && Array.isArray(obj)) {
+ node = node.concat(obj);
+ for (var i = 0; i < node.length; i++) {
+ for (var j = i + 1; j < node.length; ++j) {
+ if (nodeEqual(node[i], node[j])) { node.splice(j--, 1); }
+ }
+ }
+ doc[selector] = node;
+ } else {
+ // plist uses objects for . If we have two dicts we merge them instead of
+ // overriding the old one. See CB-6472
+ if (node && __.isObject(node) && __.isObject(obj) && !__.isDate(node) && !__.isDate(obj)) { // arrays checked above
+ __.extend(obj, node);
+ }
+ doc[selector] = obj;
+ }
+
+ return true;
+}
+
+// removes node from doc at selector
+module.exports.prunePLIST = prunePLIST;
+function prunePLIST (doc, xml, selector) {
+ var obj = plist.parse('' + xml + ' ');
+
+ pruneOBJECT(doc, selector, obj);
+
+ return true;
+}
+
+function pruneOBJECT (doc, selector, fragment) {
+ if (Array.isArray(fragment) && Array.isArray(doc[selector])) {
+ var empty = true;
+ for (var i in fragment) {
+ for (var j in doc[selector]) {
+ empty = pruneOBJECT(doc[selector], j, fragment[i]) && empty;
+ }
+ }
+ if (empty) {
+ delete doc[selector];
+ return true;
+ }
+ } else if (nodeEqual(doc[selector], fragment)) {
+ delete doc[selector];
+ return true;
+ }
+
+ return false;
+}
+
+function nodeEqual (node1, node2) {
+ if (typeof node1 !== typeof node2) { return false; } else if (typeof node1 === 'string') {
+ node2 = escapeRE(node2).replace(/\\\$\(\S+\)/gm, '(.*?)');
+ return new RegExp('^' + node2 + '$').test(node1);
+ } else {
+ for (var key in node2) {
+ if (!nodeEqual(node1[key], node2[key])) return false;
+ }
+ return true;
+ }
+}
+
+// escape string for use in regex
+function escapeRE (str) {
+ return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
+}
diff --git a/node_modules/cordova-common/src/util/xml-helpers.js b/node_modules/cordova-common/src/util/xml-helpers.js
new file mode 100644
index 0000000..ad2fdb3
--- /dev/null
+++ b/node_modules/cordova-common/src/util/xml-helpers.js
@@ -0,0 +1,339 @@
+/**
+ 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.
+*/
+
+/**
+ * contains XML utility functions, some of which are specific to elementtree
+ */
+
+var fs = require('fs-extra');
+var path = require('path');
+var _ = require('underscore');
+var et = require('elementtree');
+var stripBom = require('strip-bom');
+
+var ROOT = /^\/([^/]*)/;
+var ABSOLUTE = /^\/([^/]*)\/(.*)/;
+
+module.exports = {
+ // compare two et.XML nodes, see if they match
+ // compares tagName, text, attributes and children (recursively)
+ equalNodes: function (one, two) {
+ if (one.tag !== two.tag) {
+ return false;
+ } else if (one.text.trim() !== two.text.trim()) {
+ return false;
+ } else if (one._children.length !== two._children.length) {
+ return false;
+ }
+
+ if (!attribMatch(one, two)) return false;
+
+ for (var i = 0; i < one._children.length; i++) {
+ if (!module.exports.equalNodes(one._children[i], two._children[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ // adds node to doc at selector, creating parent if it doesn't exist
+ graftXML: function (doc, nodes, selector, after) {
+ var parent = module.exports.resolveParent(doc, selector);
+ if (!parent) {
+ // Try to create the parent recursively if necessary
+ try {
+ var parentToCreate = et.XML('<' + path.basename(selector) + '/>');
+ var parentSelector = path.dirname(selector);
+
+ this.graftXML(doc, [parentToCreate], parentSelector);
+ } catch (e) {
+ return false;
+ }
+ parent = module.exports.resolveParent(doc, selector);
+ if (!parent) return false;
+ }
+
+ nodes.forEach(function (node) {
+ // check if child is unique first
+ if (uniqueChild(node, parent)) {
+ var children = parent.getchildren();
+ var insertIdx = after ? findInsertIdx(children, after) : children.length;
+
+ // TODO: replace with parent.insert after the bug in ElementTree is fixed
+ parent.getchildren().splice(insertIdx, 0, node);
+ }
+ });
+
+ return true;
+ },
+
+ // adds new attributes to doc at selector
+ // Will only merge if attribute has not been modified already or --force is used
+ graftXMLMerge: function (doc, nodes, selector, xml) {
+ var target = module.exports.resolveParent(doc, selector);
+ if (!target) return false;
+
+ // saves the attributes of the original xml before making changes
+ xml.oldAttrib = _.extend({}, target.attrib);
+
+ nodes.forEach(function (node) {
+ var attributes = node.attrib;
+ for (var attribute in attributes) {
+ target.attrib[attribute] = node.attrib[attribute];
+ }
+ });
+
+ return true;
+ },
+
+ // overwrite all attributes to doc at selector with new attributes
+ // Will only overwrite if attribute has not been modified already or --force is used
+ graftXMLOverwrite: function (doc, nodes, selector, xml) {
+ var target = module.exports.resolveParent(doc, selector);
+ if (!target) return false;
+
+ // saves the attributes of the original xml before making changes
+ xml.oldAttrib = _.extend({}, target.attrib);
+
+ // remove old attributes from target
+ var targetAttributes = target.attrib;
+ for (var targetAttribute in targetAttributes) {
+ delete targetAttributes[targetAttribute];
+ }
+
+ // add new attributes to target
+ nodes.forEach(function (node) {
+ var attributes = node.attrib;
+ for (var attribute in attributes) {
+ target.attrib[attribute] = node.attrib[attribute];
+ }
+ });
+
+ return true;
+ },
+
+ // removes node from doc at selector
+ pruneXML: function (doc, nodes, selector) {
+ var parent = module.exports.resolveParent(doc, selector);
+ if (!parent) return false;
+
+ nodes.forEach(function (node) {
+ var matchingKid = findChild(node, parent);
+ if (matchingKid !== undefined) {
+ // stupid elementtree takes an index argument it doesn't use
+ // and does not conform to the python lib
+ parent.remove(matchingKid);
+ }
+ });
+
+ return true;
+ },
+
+ // restores attributes from doc at selector
+ pruneXMLRestore: function (doc, selector, xml) {
+ var target = module.exports.resolveParent(doc, selector);
+ if (!target) return false;
+
+ if (xml.oldAttrib) {
+ target.attrib = _.extend({}, xml.oldAttrib);
+ }
+
+ return true;
+ },
+
+ pruneXMLRemove: function (doc, selector, nodes) {
+ var target = module.exports.resolveParent(doc, selector);
+ if (!target) return false;
+
+ nodes.forEach(function (node) {
+ var attributes = node.attrib;
+ for (var attribute in attributes) {
+ if (target.attrib[attribute]) {
+ delete target.attrib[attribute];
+ }
+ }
+ });
+
+ return true;
+ },
+
+ parseElementtreeSync: function (filename) {
+ var contents = stripBom(fs.readFileSync(filename, 'utf-8'));
+ return new et.ElementTree(et.XML(contents));
+ },
+
+ resolveParent: function (doc, selector) {
+ var parent, tagName, subSelector;
+
+ // handle absolute selector (which elementtree doesn't like)
+ if (ROOT.test(selector)) {
+ tagName = selector.match(ROOT)[1];
+ // test for wildcard "any-tag" root selector
+ if (tagName === '*' || tagName === doc._root.tag) {
+ parent = doc._root;
+
+ // could be an absolute path, but not selecting the root
+ if (ABSOLUTE.test(selector)) {
+ subSelector = selector.match(ABSOLUTE)[2];
+ parent = parent.find(subSelector);
+ }
+ } else {
+ return false;
+ }
+ } else {
+ parent = doc.find(selector);
+ }
+ return parent;
+ }
+};
+
+function findChild (node, parent) {
+ const matches = parent.findall(node.tag);
+ return matches.find(m => module.exports.equalNodes(node, m));
+}
+
+function uniqueChild (node, parent) {
+ return !findChild(node, parent);
+}
+
+// Find the index at which to insert an entry. After is a ;-separated priority list
+// of tags after which the insertion should be made. E.g. If we need to
+// insert an element C, and the rule is that the order of children has to be
+// As, Bs, Cs. After will be equal to "C;B;A".
+function findInsertIdx (children, after) {
+ var childrenTags = children.map(function (child) { return child.tag; });
+ var afters = after.split(';');
+ var afterIndexes = afters.map(function (current) { return childrenTags.lastIndexOf(current); });
+ var foundIndex = _.find(afterIndexes, function (index) { return index !== -1; });
+
+ // add to the beginning if no matching nodes are found
+ return typeof foundIndex === 'undefined' ? 0 : foundIndex + 1;
+}
+
+var BLACKLIST = ['platform', 'feature', 'plugin', 'engine'];
+var SINGLETONS = ['content', 'author', 'name'];
+function mergeXml (src, dest, platform, clobber) {
+ // Do nothing for blacklisted tags.
+ if (BLACKLIST.includes(src.tag)) return;
+
+ // Handle attributes
+ Object.getOwnPropertyNames(src.attrib).forEach(function (attribute) {
+ if (clobber || !dest.attrib[attribute]) {
+ dest.attrib[attribute] = src.attrib[attribute];
+ }
+ });
+ // Handle text
+ if (src.text && (clobber || !dest.text)) {
+ dest.text = src.text;
+ }
+ // Handle children
+ src.getchildren().forEach(mergeChild);
+
+ // Handle platform
+ if (platform) {
+ src.findall('platform[@name="' + platform + '"]').forEach(function (platformElement) {
+ platformElement.getchildren().forEach(mergeChild);
+ });
+ }
+
+ // Handle duplicate preference tags (by name attribute)
+ removeDuplicatePreferences(dest);
+
+ function mergeChild (srcChild) {
+ var srcTag = srcChild.tag;
+ var destChild = new et.Element(srcTag);
+ var foundChild;
+ var query = srcTag + '';
+ var shouldMerge = true;
+
+ if (BLACKLIST.includes(srcTag)) return;
+
+ if (SINGLETONS.includes(srcTag)) {
+ foundChild = dest.find(query);
+ if (foundChild) {
+ destChild = foundChild;
+ dest.remove(destChild);
+ }
+ } else {
+ // Check for an exact match and if you find one don't add
+ var mergeCandidates = dest.findall(query)
+ .filter(function (foundChild) {
+ return foundChild && textMatch(srcChild, foundChild) && attribMatch(srcChild, foundChild);
+ });
+
+ if (mergeCandidates.length > 0) {
+ destChild = mergeCandidates[0];
+ dest.remove(destChild);
+ shouldMerge = false;
+ }
+ }
+
+ mergeXml(srcChild, destChild, platform, clobber && shouldMerge);
+ dest.append(destChild);
+ }
+
+ function removeDuplicatePreferences (xml) {
+ // reduce preference tags to a hashtable to remove dupes
+ var prefHash = xml.findall('preference[@name][@value]').reduce(function (previousValue, currentValue) {
+ previousValue[currentValue.attrib.name] = currentValue.attrib.value;
+ return previousValue;
+ }, {});
+
+ // remove all preferences
+ xml.findall('preference[@name][@value]').forEach(function (pref) {
+ xml.remove(pref);
+ });
+
+ // write new preferences
+ Object.keys(prefHash).forEach(function (key) {
+ var element = et.SubElement(xml, 'preference');
+ element.set('name', key);
+ element.set('value', this[key]);
+ }, prefHash);
+ }
+}
+
+// Expose for testing.
+module.exports.mergeXml = mergeXml;
+
+function textMatch (elm1, elm2) {
+ var text1 = elm1.text ? elm1.text.replace(/\s+/, '') : '';
+ var text2 = elm2.text ? elm2.text.replace(/\s+/, '') : '';
+ return (text1 === '' || text1 === text2);
+}
+
+function attribMatch (one, two) {
+ var oneAttribKeys = Object.keys(one.attrib);
+ var twoAttribKeys = Object.keys(two.attrib);
+
+ if (oneAttribKeys.length !== twoAttribKeys.length) {
+ return false;
+ }
+
+ for (var i = 0; i < oneAttribKeys.length; i++) {
+ var attribName = oneAttribKeys[i];
+
+ if (one.attrib[attribName] !== two.attrib[attribName]) {
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/node_modules/cordova-plugin-googlemaps/.cordova b/node_modules/cordova-plugin-googlemaps/.cordova
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/cordova-plugin-googlemaps/.eslintignore b/node_modules/cordova-plugin-googlemaps/.eslintignore
new file mode 100644
index 0000000..2113bd9
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.eslintignore
@@ -0,0 +1,2 @@
+www/Promise.js
+*.spec.js
\ No newline at end of file
diff --git a/node_modules/cordova-plugin-googlemaps/.eslintrc.js b/node_modules/cordova-plugin-googlemaps/.eslintrc.js
new file mode 100644
index 0000000..bd081fe
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.eslintrc.js
@@ -0,0 +1,42 @@
+module.exports = {
+ "env": {
+ "browser": true,
+ "node": true
+ },
+ "extends": "eslint:recommended",
+ "parserOptions": {
+ "ecmaVersion": 5
+ },
+ "rules": {
+ "indent": [
+ "error",
+ 2
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "quotes": [
+ "error",
+ "single"
+ ],
+ "semi": [
+ "error",
+ "always"
+ ],
+ "no-console": 0
+ },
+ "globals": {
+ "require": false,
+ "Symbol": false,
+ "window": false,
+ "cordova": false,
+ "Promise": false,
+ "module": false,
+ "angular": false,
+ "firebase": false,
+ "exports": false,
+ "google": false,
+ "plugin": false
+ }
+};
diff --git a/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE.md b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..12451b5
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,68 @@
+
+
+**I'm submitting a ...** (check one with "x")
+- [ ] question
+- [ ] any problem or bug report
+- [ ] feature request
+
+**If you choose 'problem or bug report', please select OS:** (check one with "x")
+- [ ] **Android**
+- [ ] **iOS**
+
+**cordova information:** (run `$> cordova plugin list`)
+
+```
+insert the output from the command here
+```
+
+**If you use `@ionic-native/google-maps`, please tell the package.json (only `@ionic-native/core` and `@ionic-native/google-maps` are fine mostly)**
+
+**Current behavior:**
+
+
+**Expected behavior:**
+
+
+**Screen capture or video record:**
+
+
+**Related code, data or error log (please format your code or data):**
+
+```
+The person who share your project files on Github (or other git repository) is in faster lane than other people.
+Please share your project files on Github or others(Bitbucket, Gitlabs...etc).
+If you don't want to share your project files, please create a demo project, then share it.
+
+Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate.
+
+Giving much information, you are waiting time is less.
+Thank you for your cooperation.
+```
diff --git a/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/feature_request.md b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..478a05c
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,22 @@
+---
+name: Feature request
+about: Suggest an idea for this plugin
+
+---
+
+
+
+**Please tell us your new feature idea**
+
+**Why do you need it?**
+
+**How helps other people?**
diff --git a/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/private-support.md b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/private-support.md
new file mode 100644
index 0000000..18262e7
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/private-support.md
@@ -0,0 +1,41 @@
+---
+name: Private support
+about: How to request private support?
+
+---
+
+This plugin is open source project, thus you can use this plugin as free!
+
+In order to share the issue knowledges with other people, we would like to ask you to make converstations in open issue threads as much as possible.
+
+However some people, some companies do not allow to do that, because of their NDAs or privacy policies.
+
+Yes, we understand thier situations.
+
+In that case, choose **"private support"**.
+If you choose "**private support**", we will make a private chat room for you, then we can discuss your issues.
+We don't discover your code or your application screen captures into public spaces.
+
+### Fee
+
+You can choose one of following options:
+
+- only one time, ask only one issue.
+ Please donate $15 USD.
+
+- 1 month private support, up to 10 issues.
+ Please donate $100 USD.
+
+- one year private support, no cap.
+ Please donate $1,000 USD.
+
+
+
+### How to apply it?
+
+Please make an issue with this template, then donate the fee amount.
+
+ https://github.com/mapsplugin/cordova-plugin-googlemaps#please-support-this-plugin-activity
+
+You don't need to discover your information at this issue thread.
+After donation, we will contact the email address which is used for paypal payment.
diff --git a/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/question-or-bug-report.md b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/question-or-bug-report.md
new file mode 100644
index 0000000..2de8f14
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.github/ISSUE_TEMPLATE/question-or-bug-report.md
@@ -0,0 +1,83 @@
+---
+name: Question or bug report
+about: Create a report to help us improve
+
+---
+
+
+
+**I'm submitting a ...** (check one with "x")
+- [ ] question
+- [ ] any problem or bug report
+
+**OS:** (check one with "x")
+- [ ] **Android**
+- [ ] **iOS**
+- [ ] **Browser**
+
+**cordova information:** (run `$> cordova plugin list`)
+
+```
+insert the output from the command here
+```
+
+**If you use `@ionic-native/google-maps`, please tell the package.json (only `@ionic-native/core` and `@ionic-native/google-maps` are fine mostly)**
+```
+@ionic-native/core :
+@ionic-native/google-maps :
+```
+
+**Current behavior:**
+
+
+**Expected behavior:**
+
+
+**Screen capture or video record:**
+
+
+**Related code, data or error log (please format your code or data):**
+
+```
+Please share your project files on Github or others(Bitbucket, Gitlabs...etc).
+If you don't want to share your project files, please create a demo project, then share it.
+
+Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate.
+
+Giving much information, you are waiting time is less.
+Thank you for your cooperation.
+```
+
+**Support this plugin activity**
+
+I appreicate if you give me a beer :beer: from [here](
+https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=SQPLZJ672HJ9N&lc=US&item_name=Cordova%2dGoogleMaps%2dPlugin&amount=5%2e00¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)
diff --git a/node_modules/cordova-plugin-googlemaps/.jsbeautifyrc b/node_modules/cordova-plugin-googlemaps/.jsbeautifyrc
new file mode 100644
index 0000000..aee5ec4
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.jsbeautifyrc
@@ -0,0 +1,11 @@
+{
+ "js": {
+ "indent_size": 2,
+ "indent_char": " ",
+ "indent_level": 0,
+ "indent_with_tabs": false,
+ "preserve_newlines": true,
+ "max_preserve_newlines": 2,
+ "jslint_happy": true
+ }
+}
diff --git a/node_modules/cordova-plugin-googlemaps/.jshintrc b/node_modules/cordova-plugin-googlemaps/.jshintrc
new file mode 100644
index 0000000..0be1498
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.jshintrc
@@ -0,0 +1,3 @@
+{
+ "esversion": 5
+}
diff --git a/node_modules/cordova-plugin-googlemaps/.travis.yml b/node_modules/cordova-plugin-googlemaps/.travis.yml
new file mode 100644
index 0000000..1cb3404
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/.travis.yml
@@ -0,0 +1,98 @@
+sudo: false
+
+env:
+ global:
+ - NODE_VERSION="10.12.0"
+ - ANDROID_API="28"
+ - ANDROID_BUILD_TOOLS="28.0.3"
+ - CORDOVA_VERSION="9.0.0"
+
+notifications:
+ email: false
+
+before_cache:
+ # Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching)
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+
+cache:
+ directories:
+
+ # Gradle dependencies
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
+
+ # Android directory
+ - $HOME/.android
+
+ # NVM
+ - $HOME/.nvm
+
+matrix:
+ include:
+ - os: linux
+ env: CORDOVA_PLATFORM="browser"
+ language: node_js
+ node_js: '${NODE_VERSION}'
+
+ - if: branch = master
+ os: osx
+ env: CORDOVA_PLATFORM="ios"
+ language: objective-c
+ cache:
+ - bundler
+ - cocoapods
+ node_js: '${NODE_VERSION}'
+ osx_image: xcode9.4
+ before_script:
+ - exist=$(which ios-deploy); if [[ -z "${exist}" ]]; then
+ npm -g install ios-deploy > /dev/null;
+ fi
+
+ - if: branch = master
+ env: CORDOVA_PLATFORM="android"
+ os: linux
+ node_js: '${NODE_VERSION}'
+ language: android
+ jdk: oraclejdk8
+ android:
+ components:
+ - tools
+ - android-${ANDROID_API}
+ - platform-tools
+ # The BuildTools version used by your project
+ - build-tools-${ANDROID_BUILD_TOOLS}
+ # The SDK version used to compile your project
+ - android-${ANDROID_API}
+ # Additional components
+ - extra-android-m2repository
+ - extra-google-m2repository
+ - sys-img-x86-android-${ANDROID_API}
+ licenses:
+ - 'android-sdk-license-.+'
+ - '.+'
+
+install:
+
+ - exist=$(which nvm); if [[ -z "${exist}" ]]; then
+ rm -rf ~/.nvm > /dev/null;
+ git clone https://github.com/creationix/nvm.git ~/.nvm > /dev/null;
+ (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags` > /dev/null);
+ source ~/.nvm/nvm.sh && nvm > /dev/null;
+ fi
+ - exist=$(nvm list | grep ${NODE_VERSION}); if [[ -z "${exist}" ]]; then
+ nvm install ${NODE_VERSION} > /dev/null;
+ fi
+ - nvm use ${NODE_VERSION} > /dev/null;
+ - node --version
+ - exist=$(which cordova); if [[ -z "${exist}" ]]; then
+ npm -g install cordova@${CORDOVA_VERSION} > /dev/null;
+ fi
+ - cordova --version
+ - exist=$(which cordova-paramedic); if [[ -z "${exist}" ]]; then
+ npm -g install https://github.com/apache/cordova-paramedic;
+ fi
+ - npm i > /dev/null
+
+script:
+ - /bin/bash build_test.sh
diff --git a/node_modules/cordova-plugin-googlemaps/LICENSE b/node_modules/cordova-plugin-googlemaps/LICENSE
new file mode 100644
index 0000000..adba9c2
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/LICENSE
@@ -0,0 +1,206 @@
+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 2014 Masashi Katsumata
+
+ 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.
+
+Additional conditions:
+ As of the cordova-plugin-googlemaps version 2.2.5, following user is prohibited to use this plugin (additional fork, copy the code from this repo, anything).
+ - the member of `Bemyeye Holdings limited (https://github.com/BeMyEye)`
+
diff --git a/node_modules/cordova-plugin-googlemaps/README.md b/node_modules/cordova-plugin-googlemaps/README.md
new file mode 100644
index 0000000..4d4d973
--- /dev/null
+++ b/node_modules/cordova-plugin-googlemaps/README.md
@@ -0,0 +1,433 @@
+# Cordova GoogleMaps plugin for Android, iOS and Browser v2.7.1
+
+| Download | Build test (multiple_maps branch)|
+|----------|---------------------------|
+| [](https://npm-stat.com/charts.html?package=cordova-plugin-googlemaps) |[](https://travis-ci.org/mapsplugin/cordova-plugin-googlemaps/branches) |
+
+ This plugin displays Google Maps in your application.
+ This plugin uses these libraries for each platforms:
+
+ - Android : [Google Maps Android API](https://developers.google.com/maps/documentation/android/)
+ - iOS : [Google Maps SDK for iOS](https://developers.google.com/maps/documentation/ios/)
+ - Browser : [Google Maps JavaScript API v3](https://developers.google.com/maps/documentation/javascript/)
+
+ Both [PhoneGap](http://phonegap.com/) and [Apache Cordova](http://cordova.apache.org/) are supported.
+
+
+
+
+Android, iOS
+
+
+
+Browser
+
+
+
+
+
+-----
+
+## Guides
+
+ - [How to generate API keys?](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/api_key/README.md)
+ - [Hello, World](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/hello-world/README.md)
+ - [Hello, World (with PhoneGap Build)](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/hello-world-phonegap-build/README.md)
+ - [Trouble shootings](https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/troubleshootings/README.md)
+
+## Quick install
+
+ ```
+ $> cordova plugin add cordova-plugin-googlemaps
+ ```
+
+Then set your Google Maps API keys into your `config.xml` (Android / iOS).
+
+ ```xml
+
+
+
+
+ ```
+
+For browser platform,
+
+ ```js
+ // If your app runs this program on browser,
+ // you need to set `API_KEY_FOR_BROWSER_RELEASE` and `API_KEY_FOR_BROWSER_DEBUG`
+ // before `plugin.google.maps.Map.getMap()`
+ //
+ // API_KEY_FOR_BROWSER_RELEASE for `https:` protocol
+ // API_KEY_FOR_BROWSER_DEBUG for `http:` protocol
+ //
+ plugin.google.maps.environment.setEnv({
+ 'API_KEY_FOR_BROWSER_RELEASE': '(YOUR_API_KEY_IS_HERE)',
+ 'API_KEY_FOR_BROWSER_DEBUG': '' // optional
+ });
+
+ // Create a Google Maps native view under the map_canvas div.
+ var map = plugin.google.maps.Map.getMap(div);
+
+ ```
+
+## PhoneGap Build settings
+
+ ```xml
+
+
+
+
+
+ ```
+
+## Install optional variables (config.xml)
+
+ -  **PLAY_SERVICES_VERSION = (15.0.1)**
+ The Google Play Services SDK version.
+ _You need to specify the same version number with all other plugins._
+ Check out the latest version [here](https://developers.google.com/android/guides/releases).
+
+ -  **ANDROID_SUPPORT_V4_VERSION = (27.1.1)**
+ This plugin requires the Android support library v4.
+ _The minimum version is 24.1.0._
+ Check out the latest version [here](https://developer.android.com/topic/libraries/support-library/revisions.html).
+
+ -  **LOCATION_WHEN_IN_USE_DESCRIPTION**
+ This message is displayed when your application requests **LOCATION PERMISSION for only necessary times**.
+
+ -  **LOCATION_ALWAYS_USAGE_DESCRIPTION**
+ This message is displayed when your application requests **LOCATION PERMISSION for always**.
+
+---------------------------------------------------------------------------------------------------------
+
+## Please support this plugin activity.
+
+ In order to keep this plugin as free, please consider to donate little amount for this project.
+
+ [](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=SQPLZJ672HJ9N&lc=US&item_name=cordova%2dgooglemaps%2dplugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)
+
+---------------------------------------------------------------------------------------------------------
+
+## Release Notes
+
+ - **v2.7.1**
+ - Fix: (iOS) UiWebView references present in v2.7.0
+
+ - **v2.7.0**
+ - Re-adoption: cordova-plugin-googlemaps-sdk dependency
+ - Important update: No longer support `UIWebView` on iOS. `WKWebView` only.
+ - Fix: (iOS) Can't load image files from local host on ionic 4 / 5
+ - Update: (Android) prevent null pointer error in AsyncLoadImage.java
+ - Fix: Css animation interference when call setDiv and there is a push/pop page
+ - Fix: (Android/iOS/Browser) KML parser crash
+ - Fix: flickering and wrong rendering of some DOM elements
+ - Add: `map.stopAnimation()`
+ - Fix: can't remove map while map.animateCamera() is running
+ - Update: (Android) Increase cache memory size
+ - Update: (Android/iOS) Danish localization
+ - Fix: (Android) Prevent resize event after `map.setDiv(null)`
+ - Fix: (Android/iOS) Can not interactive with the map inside