UNPKG

237 kBJavaScriptView Raw
1// Chance.js 1.0.5
2// http://chancejs.com
3// (c) 2013 Victor Quinn
4// Chance may be freely distributed or modified under the MIT license.
5
6(function () {
7
8 // Constants
9 var MAX_INT = 9007199254740992;
10 var MIN_INT = -MAX_INT;
11 var NUMBERS = '0123456789';
12 var CHARS_LOWER = 'abcdefghijklmnopqrstuvwxyz';
13 var CHARS_UPPER = CHARS_LOWER.toUpperCase();
14 var HEX_POOL = NUMBERS + "abcdef";
15
16 // Cached array helpers
17 var slice = Array.prototype.slice;
18
19 // Constructor
20 function Chance (seed) {
21 if (!(this instanceof Chance)) {
22 return seed == null ? new Chance() : new Chance(seed);
23 }
24
25 // if user has provided a function, use that as the generator
26 if (typeof seed === 'function') {
27 this.random = seed;
28 return this;
29 }
30
31 if (arguments.length) {
32 // set a starting value of zero so we can add to it
33 this.seed = 0;
34 }
35
36 // otherwise, leave this.seed blank so that MT will receive a blank
37
38 for (var i = 0; i < arguments.length; i++) {
39 var seedling = 0;
40 if (Object.prototype.toString.call(arguments[i]) === '[object String]') {
41 for (var j = 0; j < arguments[i].length; j++) {
42 // create a numeric hash for each argument, add to seedling
43 var hash = 0;
44 for (var k = 0; k < arguments[i].length; k++) {
45 hash = arguments[i].charCodeAt(k) + (hash << 6) + (hash << 16) - hash;
46 }
47 seedling += hash;
48 }
49 } else {
50 seedling = arguments[i];
51 }
52 this.seed += (arguments.length - i) * seedling;
53 }
54
55 // If no generator function was provided, use our MT
56 this.mt = this.mersenne_twister(this.seed);
57 this.bimd5 = this.blueimp_md5();
58 this.random = function () {
59 return this.mt.random(this.seed);
60 };
61
62 return this;
63 }
64
65 Chance.prototype.VERSION = "1.0.5";
66
67 // Random helper functions
68 function initOptions(options, defaults) {
69 options || (options = {});
70
71 if (defaults) {
72 for (var i in defaults) {
73 if (typeof options[i] === 'undefined') {
74 options[i] = defaults[i];
75 }
76 }
77 }
78
79 return options;
80 }
81
82 function testRange(test, errorMessage) {
83 if (test) {
84 throw new RangeError(errorMessage);
85 }
86 }
87
88 /**
89 * Encode the input string with Base64.
90 */
91 var base64 = function() {
92 throw new Error('No Base64 encoder available.');
93 };
94
95 // Select proper Base64 encoder.
96 (function determineBase64Encoder() {
97 if (typeof btoa === 'function') {
98 base64 = btoa;
99 } else if (typeof Buffer === 'function') {
100 base64 = function(input) {
101 return new Buffer(input).toString('base64');
102 };
103 }
104 })();
105
106 // -- Basics --
107
108 /**
109 * Return a random bool, either true or false
110 *
111 * @param {Object} [options={ likelihood: 50 }] alter the likelihood of
112 * receiving a true or false value back.
113 * @throws {RangeError} if the likelihood is out of bounds
114 * @returns {Bool} either true or false
115 */
116 Chance.prototype.bool = function (options) {
117 // likelihood of success (true)
118 options = initOptions(options, {likelihood : 50});
119
120 // Note, we could get some minor perf optimizations by checking range
121 // prior to initializing defaults, but that makes code a bit messier
122 // and the check more complicated as we have to check existence of
123 // the object then existence of the key before checking constraints.
124 // Since the options initialization should be minor computationally,
125 // decision made for code cleanliness intentionally. This is mentioned
126 // here as it's the first occurrence, will not be mentioned again.
127 testRange(
128 options.likelihood < 0 || options.likelihood > 100,
129 "Chance: Likelihood accepts values from 0 to 100."
130 );
131
132 return this.random() * 100 < options.likelihood;
133 };
134
135 /**
136 * Return a random character.
137 *
138 * @param {Object} [options={}] can specify a character pool, only alpha,
139 * only symbols, and casing (lower or upper)
140 * @returns {String} a single random character
141 * @throws {RangeError} Can only specify alpha or symbols, not both
142 */
143 Chance.prototype.character = function (options) {
144 options = initOptions(options);
145 testRange(
146 options.alpha && options.symbols,
147 "Chance: Cannot specify both alpha and symbols."
148 );
149
150 var symbols = "!@#$%^&*()[]",
151 letters, pool;
152
153 if (options.casing === 'lower') {
154 letters = CHARS_LOWER;
155 } else if (options.casing === 'upper') {
156 letters = CHARS_UPPER;
157 } else {
158 letters = CHARS_LOWER + CHARS_UPPER;
159 }
160
161 if (options.pool) {
162 pool = options.pool;
163 } else if (options.alpha) {
164 pool = letters;
165 } else if (options.symbols) {
166 pool = symbols;
167 } else {
168 pool = letters + NUMBERS + symbols;
169 }
170
171 return pool.charAt(this.natural({max: (pool.length - 1)}));
172 };
173
174 // Note, wanted to use "float" or "double" but those are both JS reserved words.
175
176 // Note, fixed means N OR LESS digits after the decimal. This because
177 // It could be 14.9000 but in JavaScript, when this is cast as a number,
178 // the trailing zeroes are dropped. Left to the consumer if trailing zeroes are
179 // needed
180 /**
181 * Return a random floating point number
182 *
183 * @param {Object} [options={}] can specify a fixed precision, min, max
184 * @returns {Number} a single floating point number
185 * @throws {RangeError} Can only specify fixed or precision, not both. Also
186 * min cannot be greater than max
187 */
188 Chance.prototype.floating = function (options) {
189 options = initOptions(options, {fixed : 4});
190 testRange(
191 options.fixed && options.precision,
192 "Chance: Cannot specify both fixed and precision."
193 );
194
195 var num;
196 var fixed = Math.pow(10, options.fixed);
197
198 var max = MAX_INT / fixed;
199 var min = -max;
200
201 testRange(
202 options.min && options.fixed && options.min < min,
203 "Chance: Min specified is out of range with fixed. Min should be, at least, " + min
204 );
205 testRange(
206 options.max && options.fixed && options.max > max,
207 "Chance: Max specified is out of range with fixed. Max should be, at most, " + max
208 );
209
210 options = initOptions(options, { min : min, max : max });
211
212 // Todo - Make this work!
213 // options.precision = (typeof options.precision !== "undefined") ? options.precision : false;
214
215 num = this.integer({min: options.min * fixed, max: options.max * fixed});
216 var num_fixed = (num / fixed).toFixed(options.fixed);
217
218 return parseFloat(num_fixed);
219 };
220
221 /**
222 * Return a random integer
223 *
224 * NOTE the max and min are INCLUDED in the range. So:
225 * chance.integer({min: 1, max: 3});
226 * would return either 1, 2, or 3.
227 *
228 * @param {Object} [options={}] can specify a min and/or max
229 * @returns {Number} a single random integer number
230 * @throws {RangeError} min cannot be greater than max
231 */
232 Chance.prototype.integer = function (options) {
233 // 9007199254740992 (2^53) is the max integer number in JavaScript
234 // See: http://vq.io/132sa2j
235 options = initOptions(options, {min: MIN_INT, max: MAX_INT});
236 testRange(options.min > options.max, "Chance: Min cannot be greater than Max.");
237
238 return Math.floor(this.random() * (options.max - options.min + 1) + options.min);
239 };
240
241 /**
242 * Return a random natural
243 *
244 * NOTE the max and min are INCLUDED in the range. So:
245 * chance.natural({min: 1, max: 3});
246 * would return either 1, 2, or 3.
247 *
248 * @param {Object} [options={}] can specify a min and/or max
249 * @returns {Number} a single random integer number
250 * @throws {RangeError} min cannot be greater than max
251 */
252 Chance.prototype.natural = function (options) {
253 options = initOptions(options, {min: 0, max: MAX_INT});
254 testRange(options.min < 0, "Chance: Min cannot be less than zero.");
255 return this.integer(options);
256 };
257
258 /**
259 * Return a random hex number as string
260 *
261 * NOTE the max and min are INCLUDED in the range. So:
262 * chance.hex({min: '9', max: 'B'});
263 * would return either '9', 'A' or 'B'.
264 *
265 * @param {Object} [options={}] can specify a min and/or max and/or casing
266 * @returns {String} a single random string hex number
267 * @throws {RangeError} min cannot be greater than max
268 */
269 Chance.prototype.hex = function (options) {
270 options = initOptions(options, {min: 0, max: MAX_INT, casing: 'lower'});
271 testRange(options.min < 0, "Chance: Min cannot be less than zero.");
272 var integer = chance.natural({min: options.min, max: options.max});
273 if (options.casing === 'upper') {
274 return integer.toString(16).toUpperCase();
275 }
276 return integer.toString(16);
277 };
278
279 /**
280 * Return a random string
281 *
282 * @param {Object} [options={}] can specify a length
283 * @returns {String} a string of random length
284 * @throws {RangeError} length cannot be less than zero
285 */
286 Chance.prototype.string = function (options) {
287 options = initOptions(options, { length: this.natural({min: 5, max: 20}) });
288 testRange(options.length < 0, "Chance: Length cannot be less than zero.");
289 var length = options.length,
290 text = this.n(this.character, length, options);
291
292 return text.join("");
293 };
294
295 // -- End Basics --
296
297 // -- Helpers --
298
299 Chance.prototype.capitalize = function (word) {
300 return word.charAt(0).toUpperCase() + word.substr(1);
301 };
302
303 Chance.prototype.mixin = function (obj) {
304 for (var func_name in obj) {
305 Chance.prototype[func_name] = obj[func_name];
306 }
307 return this;
308 };
309
310 /**
311 * Given a function that generates something random and a number of items to generate,
312 * return an array of items where none repeat.
313 *
314 * @param {Function} fn the function that generates something random
315 * @param {Number} num number of terms to generate
316 * @param {Object} options any options to pass on to the generator function
317 * @returns {Array} an array of length `num` with every item generated by `fn` and unique
318 *
319 * There can be more parameters after these. All additional parameters are provided to the given function
320 */
321 Chance.prototype.unique = function(fn, num, options) {
322 testRange(
323 typeof fn !== "function",
324 "Chance: The first argument must be a function."
325 );
326
327 var comparator = function(arr, val) { return arr.indexOf(val) !== -1; };
328
329 if (options) {
330 comparator = options.comparator || comparator;
331 }
332
333 var arr = [], count = 0, result, MAX_DUPLICATES = num * 50, params = slice.call(arguments, 2);
334
335 while (arr.length < num) {
336 var clonedParams = JSON.parse(JSON.stringify(params));
337 result = fn.apply(this, clonedParams);
338 if (!comparator(arr, result)) {
339 arr.push(result);
340 // reset count when unique found
341 count = 0;
342 }
343
344 if (++count > MAX_DUPLICATES) {
345 throw new RangeError("Chance: num is likely too large for sample set");
346 }
347 }
348 return arr;
349 };
350
351 /**
352 * Gives an array of n random terms
353 *
354 * @param {Function} fn the function that generates something random
355 * @param {Number} n number of terms to generate
356 * @returns {Array} an array of length `n` with items generated by `fn`
357 *
358 * There can be more parameters after these. All additional parameters are provided to the given function
359 */
360 Chance.prototype.n = function(fn, n) {
361 testRange(
362 typeof fn !== "function",
363 "Chance: The first argument must be a function."
364 );
365
366 if (typeof n === 'undefined') {
367 n = 1;
368 }
369 var i = n, arr = [], params = slice.call(arguments, 2);
370
371 // Providing a negative count should result in a noop.
372 i = Math.max( 0, i );
373
374 for (null; i--; null) {
375 arr.push(fn.apply(this, params));
376 }
377
378 return arr;
379 };
380
381 // H/T to SO for this one: http://vq.io/OtUrZ5
382 Chance.prototype.pad = function (number, width, pad) {
383 // Default pad to 0 if none provided
384 pad = pad || '0';
385 // Convert number to a string
386 number = number + '';
387 return number.length >= width ? number : new Array(width - number.length + 1).join(pad) + number;
388 };
389
390 // DEPRECATED on 2015-10-01
391 Chance.prototype.pick = function (arr, count) {
392 if (arr.length === 0) {
393 throw new RangeError("Chance: Cannot pick() from an empty array");
394 }
395 if (!count || count === 1) {
396 return arr[this.natural({max: arr.length - 1})];
397 } else {
398 return this.shuffle(arr).slice(0, count);
399 }
400 };
401
402 // Given an array, returns a single random element
403 Chance.prototype.pickone = function (arr) {
404 if (arr.length === 0) {
405 throw new RangeError("Chance: Cannot pickone() from an empty array");
406 }
407 return arr[this.natural({max: arr.length - 1})];
408 };
409
410 // Given an array, returns a random set with 'count' elements
411 Chance.prototype.pickset = function (arr, count) {
412 if (count === 0) {
413 return [];
414 }
415 if (arr.length === 0) {
416 throw new RangeError("Chance: Cannot pickset() from an empty array");
417 }
418 if (count < 0) {
419 throw new RangeError("Chance: count must be positive number");
420 }
421 if (!count || count === 1) {
422 return [ this.pickone(arr) ];
423 } else {
424 return this.shuffle(arr).slice(0, count);
425 }
426 };
427
428 Chance.prototype.shuffle = function (arr) {
429 var old_array = arr.slice(0),
430 new_array = [],
431 j = 0,
432 length = Number(old_array.length);
433
434 for (var i = 0; i < length; i++) {
435 // Pick a random index from the array
436 j = this.natural({max: old_array.length - 1});
437 // Add it to the new array
438 new_array[i] = old_array[j];
439 // Remove that element from the original array
440 old_array.splice(j, 1);
441 }
442
443 return new_array;
444 };
445
446 // Returns a single item from an array with relative weighting of odds
447 Chance.prototype.weighted = function (arr, weights, trim) {
448 if (arr.length !== weights.length) {
449 throw new RangeError("Chance: length of array and weights must match");
450 }
451
452 // scan weights array and sum valid entries
453 var sum = 0;
454 var val;
455 for (var weightIndex = 0; weightIndex < weights.length; ++weightIndex) {
456 val = weights[weightIndex];
457 if (isNaN(val)) {
458 throw new RangeError("all weights must be numbers");
459 }
460
461 if (val > 0) {
462 sum += val;
463 }
464 }
465
466 if (sum === 0) {
467 throw new RangeError("Chance: no valid entries in array weights");
468 }
469
470 // select a value within range
471 var selected = this.random() * sum;
472
473 // find array entry corresponding to selected value
474 var total = 0;
475 var lastGoodIdx = -1;
476 var chosenIdx;
477 for (weightIndex = 0; weightIndex < weights.length; ++weightIndex) {
478 val = weights[weightIndex];
479 total += val;
480 if (val > 0) {
481 if (selected <= total) {
482 chosenIdx = weightIndex;
483 break;
484 }
485 lastGoodIdx = weightIndex;
486 }
487
488 // handle any possible rounding error comparison to ensure something is picked
489 if (weightIndex === (weights.length - 1)) {
490 chosenIdx = lastGoodIdx;
491 }
492 }
493
494 var chosen = arr[chosenIdx];
495 trim = (typeof trim === 'undefined') ? false : trim;
496 if (trim) {
497 arr.splice(chosenIdx, 1);
498 weights.splice(chosenIdx, 1);
499 }
500
501 return chosen;
502 };
503
504 // -- End Helpers --
505
506 // -- Text --
507
508 Chance.prototype.paragraph = function (options) {
509 options = initOptions(options);
510
511 var sentences = options.sentences || this.natural({min: 3, max: 7}),
512 sentence_array = this.n(this.sentence, sentences);
513
514 return sentence_array.join(' ');
515 };
516
517 // Could get smarter about this than generating random words and
518 // chaining them together. Such as: http://vq.io/1a5ceOh
519 Chance.prototype.sentence = function (options) {
520 options = initOptions(options);
521
522 var words = options.words || this.natural({min: 12, max: 18}),
523 punctuation = options.punctuation,
524 text, word_array = this.n(this.word, words);
525
526 text = word_array.join(' ');
527
528 // Capitalize first letter of sentence
529 text = this.capitalize(text);
530
531 // Make sure punctuation has a usable value
532 if (punctuation !== false && !/^[\.\?;!:]$/.test(punctuation)) {
533 punctuation = '.';
534 }
535
536 // Add punctuation mark
537 if (punctuation) {
538 text += punctuation;
539 }
540
541 return text;
542 };
543
544 Chance.prototype.syllable = function (options) {
545 options = initOptions(options);
546
547 var length = options.length || this.natural({min: 2, max: 3}),
548 consonants = 'bcdfghjklmnprstvwz', // consonants except hard to speak ones
549 vowels = 'aeiou', // vowels
550 all = consonants + vowels, // all
551 text = '',
552 chr;
553
554 // I'm sure there's a more elegant way to do this, but this works
555 // decently well.
556 for (var i = 0; i < length; i++) {
557 if (i === 0) {
558 // First character can be anything
559 chr = this.character({pool: all});
560 } else if (consonants.indexOf(chr) === -1) {
561 // Last character was a vowel, now we want a consonant
562 chr = this.character({pool: consonants});
563 } else {
564 // Last character was a consonant, now we want a vowel
565 chr = this.character({pool: vowels});
566 }
567
568 text += chr;
569 }
570
571 if (options.capitalize) {
572 text = this.capitalize(text);
573 }
574
575 return text;
576 };
577
578 Chance.prototype.word = function (options) {
579 options = initOptions(options);
580
581 testRange(
582 options.syllables && options.length,
583 "Chance: Cannot specify both syllables AND length."
584 );
585
586 var syllables = options.syllables || this.natural({min: 1, max: 3}),
587 text = '';
588
589 if (options.length) {
590 // Either bound word by length
591 do {
592 text += this.syllable();
593 } while (text.length < options.length);
594 text = text.substring(0, options.length);
595 } else {
596 // Or by number of syllables
597 for (var i = 0; i < syllables; i++) {
598 text += this.syllable();
599 }
600 }
601
602 if (options.capitalize) {
603 text = this.capitalize(text);
604 }
605
606 return text;
607 };
608
609 // -- End Text --
610
611 // -- Person --
612
613 Chance.prototype.age = function (options) {
614 options = initOptions(options);
615 var ageRange;
616
617 switch (options.type) {
618 case 'child':
619 ageRange = {min: 0, max: 12};
620 break;
621 case 'teen':
622 ageRange = {min: 13, max: 19};
623 break;
624 case 'adult':
625 ageRange = {min: 18, max: 65};
626 break;
627 case 'senior':
628 ageRange = {min: 65, max: 100};
629 break;
630 case 'all':
631 ageRange = {min: 0, max: 100};
632 break;
633 default:
634 ageRange = {min: 18, max: 65};
635 break;
636 }
637
638 return this.natural(ageRange);
639 };
640
641 Chance.prototype.birthday = function (options) {
642 var age = this.age(options);
643 var currentYear = new Date().getFullYear();
644
645 if (options && options.type) {
646 var min = new Date();
647 var max = new Date();
648 min.setFullYear(currentYear - age - 1);
649 max.setFullYear(currentYear - age);
650
651 options = initOptions(options, {
652 min: min,
653 max: max
654 });
655 } else {
656 options = initOptions(options, {
657 year: currentYear - age
658 });
659 }
660
661 return this.date(options);
662 };
663
664 // CPF; ID to identify taxpayers in Brazil
665 Chance.prototype.cpf = function (options) {
666 options = initOptions(options, {
667 formatted: true
668 });
669
670 var n = this.n(this.natural, 9, { max: 9 });
671 var d1 = n[8]*2+n[7]*3+n[6]*4+n[5]*5+n[4]*6+n[3]*7+n[2]*8+n[1]*9+n[0]*10;
672 d1 = 11 - (d1 % 11);
673 if (d1>=10) {
674 d1 = 0;
675 }
676 var d2 = d1*2+n[8]*3+n[7]*4+n[6]*5+n[5]*6+n[4]*7+n[3]*8+n[2]*9+n[1]*10+n[0]*11;
677 d2 = 11 - (d2 % 11);
678 if (d2>=10) {
679 d2 = 0;
680 }
681 var cpf = ''+n[0]+n[1]+n[2]+'.'+n[3]+n[4]+n[5]+'.'+n[6]+n[7]+n[8]+'-'+d1+d2;
682 return options.formatted ? cpf : cpf.replace(/\D/g,'');
683 };
684
685 // CNPJ: ID to identify companies in Brazil
686 Chance.prototype.cnpj = function (options) {
687 options = initOptions(options, {
688 formatted: true
689 });
690
691 var n = this.n(this.natural, 12, { max: 12 });
692 var d1 = n[11]*2+n[10]*3+n[9]*4+n[8]*5+n[7]*6+n[6]*7+n[5]*8+n[4]*9+n[3]*2+n[2]*3+n[1]*4+n[0]*5;
693 d1 = 11 - (d1 % 11);
694 if (d1<2) {
695 d1 = 0;
696 }
697 var d2 = d1*2+n[11]*3+n[10]*4+n[9]*5+n[8]*6+n[7]*7+n[6]*8+n[5]*9+n[4]*2+n[3]*3+n[2]*4+n[1]*5+n[0]*6;
698 d2 = 11 - (d2 % 11);
699 if (d2<2) {
700 d2 = 0;
701 }
702 var cnpj = ''+n[0]+n[1]+'.'+n[2]+n[3]+n[4]+'.'+n[5]+n[6]+n[7]+'/'+n[8]+n[9]+n[10]+n[11]+'-'+d1+d2;
703 return options.formatted ? cnpj : cnpj.replace(/\D/g,'');
704 };
705
706 Chance.prototype.first = function (options) {
707 options = initOptions(options, {gender: this.gender(), nationality: 'en'});
708 return this.pick(this.get("firstNames")[options.gender.toLowerCase()][options.nationality.toLowerCase()]);
709 };
710
711 Chance.prototype.gender = function (options) {
712 options = initOptions(options, {extraGenders: []});
713 return this.pick(['Male', 'Female'].concat(options.extraGenders));
714 };
715
716 Chance.prototype.last = function (options) {
717 options = initOptions(options, {nationality: 'en'});
718 return this.pick(this.get("lastNames")[options.nationality.toLowerCase()]);
719 };
720
721 Chance.prototype.israelId=function(){
722 var x=this.string({pool: '0123456789',length:8});
723 var y=0;
724 for (var i=0;i<x.length;i++){
725 var thisDigit= x[i] * (i/2===parseInt(i/2) ? 1 : 2);
726 thisDigit=this.pad(thisDigit,2).toString();
727 thisDigit=parseInt(thisDigit[0]) + parseInt(thisDigit[1]);
728 y=y+thisDigit;
729 }
730 x=x+(10-parseInt(y.toString().slice(-1))).toString().slice(-1);
731 return x;
732 };
733
734 Chance.prototype.mrz = function (options) {
735 var checkDigit = function (input) {
736 var alpha = "<ABCDEFGHIJKLMNOPQRSTUVWXYXZ".split(''),
737 multipliers = [ 7, 3, 1 ],
738 runningTotal = 0;
739
740 if (typeof input !== 'string') {
741 input = input.toString();
742 }
743
744 input.split('').forEach(function(character, idx) {
745 var pos = alpha.indexOf(character);
746
747 if(pos !== -1) {
748 character = pos === 0 ? 0 : pos + 9;
749 } else {
750 character = parseInt(character, 10);
751 }
752 character *= multipliers[idx % multipliers.length];
753 runningTotal += character;
754 });
755 return runningTotal % 10;
756 };
757 var generate = function (opts) {
758 var pad = function (length) {
759 return new Array(length + 1).join('<');
760 };
761 var number = [ 'P<',
762 opts.issuer,
763 opts.last.toUpperCase(),
764 '<<',
765 opts.first.toUpperCase(),
766 pad(39 - (opts.last.length + opts.first.length + 2)),
767 opts.passportNumber,
768 checkDigit(opts.passportNumber),
769 opts.nationality,
770 opts.dob,
771 checkDigit(opts.dob),
772 opts.gender,
773 opts.expiry,
774 checkDigit(opts.expiry),
775 pad(14),
776 checkDigit(pad(14)) ].join('');
777
778 return number +
779 (checkDigit(number.substr(44, 10) +
780 number.substr(57, 7) +
781 number.substr(65, 7)));
782 };
783
784 var that = this;
785
786 options = initOptions(options, {
787 first: this.first(),
788 last: this.last(),
789 passportNumber: this.integer({min: 100000000, max: 999999999}),
790 dob: (function () {
791 var date = that.birthday({type: 'adult'});
792 return [date.getFullYear().toString().substr(2),
793 that.pad(date.getMonth() + 1, 2),
794 that.pad(date.getDate(), 2)].join('');
795 }()),
796 expiry: (function () {
797 var date = new Date();
798 return [(date.getFullYear() + 5).toString().substr(2),
799 that.pad(date.getMonth() + 1, 2),
800 that.pad(date.getDate(), 2)].join('');
801 }()),
802 gender: this.gender() === 'Female' ? 'F': 'M',
803 issuer: 'GBR',
804 nationality: 'GBR'
805 });
806 return generate (options);
807 };
808
809 Chance.prototype.name = function (options) {
810 options = initOptions(options);
811
812 var first = this.first(options),
813 last = this.last(options),
814 name;
815
816 if (options.middle) {
817 name = first + ' ' + this.first(options) + ' ' + last;
818 } else if (options.middle_initial) {
819 name = first + ' ' + this.character({alpha: true, casing: 'upper'}) + '. ' + last;
820 } else {
821 name = first + ' ' + last;
822 }
823
824 if (options.prefix) {
825 name = this.prefix(options) + ' ' + name;
826 }
827
828 if (options.suffix) {
829 name = name + ' ' + this.suffix(options);
830 }
831
832 return name;
833 };
834
835 // Return the list of available name prefixes based on supplied gender.
836 // @todo introduce internationalization
837 Chance.prototype.name_prefixes = function (gender) {
838 gender = gender || "all";
839 gender = gender.toLowerCase();
840
841 var prefixes = [
842 { name: 'Doctor', abbreviation: 'Dr.' }
843 ];
844
845 if (gender === "male" || gender === "all") {
846 prefixes.push({ name: 'Mister', abbreviation: 'Mr.' });
847 }
848
849 if (gender === "female" || gender === "all") {
850 prefixes.push({ name: 'Miss', abbreviation: 'Miss' });
851 prefixes.push({ name: 'Misses', abbreviation: 'Mrs.' });
852 }
853
854 return prefixes;
855 };
856
857 // Alias for name_prefix
858 Chance.prototype.prefix = function (options) {
859 return this.name_prefix(options);
860 };
861
862 Chance.prototype.name_prefix = function (options) {
863 options = initOptions(options, { gender: "all" });
864 return options.full ?
865 this.pick(this.name_prefixes(options.gender)).name :
866 this.pick(this.name_prefixes(options.gender)).abbreviation;
867 };
868 //Hungarian ID number
869 Chance.prototype.HIDN= function(){
870 //Hungarian ID nuber structure: XXXXXXYY (X=number,Y=Capital Latin letter)
871 var idn_pool="0123456789";
872 var idn_chrs="ABCDEFGHIJKLMNOPQRSTUVWXYXZ";
873 var idn="";
874 idn+=this.string({pool:idn_pool,length:6});
875 idn+=this.string({pool:idn_chrs,length:2});
876 return idn;
877 };
878
879
880 Chance.prototype.ssn = function (options) {
881 options = initOptions(options, {ssnFour: false, dashes: true});
882 var ssn_pool = "1234567890",
883 ssn,
884 dash = options.dashes ? '-' : '';
885
886 if(!options.ssnFour) {
887 ssn = this.string({pool: ssn_pool, length: 3}) + dash +
888 this.string({pool: ssn_pool, length: 2}) + dash +
889 this.string({pool: ssn_pool, length: 4});
890 } else {
891 ssn = this.string({pool: ssn_pool, length: 4});
892 }
893 return ssn;
894 };
895
896 // Return the list of available name suffixes
897 // @todo introduce internationalization
898 Chance.prototype.name_suffixes = function () {
899 var suffixes = [
900 { name: 'Doctor of Osteopathic Medicine', abbreviation: 'D.O.' },
901 { name: 'Doctor of Philosophy', abbreviation: 'Ph.D.' },
902 { name: 'Esquire', abbreviation: 'Esq.' },
903 { name: 'Junior', abbreviation: 'Jr.' },
904 { name: 'Juris Doctor', abbreviation: 'J.D.' },
905 { name: 'Master of Arts', abbreviation: 'M.A.' },
906 { name: 'Master of Business Administration', abbreviation: 'M.B.A.' },
907 { name: 'Master of Science', abbreviation: 'M.S.' },
908 { name: 'Medical Doctor', abbreviation: 'M.D.' },
909 { name: 'Senior', abbreviation: 'Sr.' },
910 { name: 'The Third', abbreviation: 'III' },
911 { name: 'The Fourth', abbreviation: 'IV' },
912 { name: 'Bachelor of Engineering', abbreviation: 'B.E' },
913 { name: 'Bachelor of Technology', abbreviation: 'B.TECH' }
914 ];
915 return suffixes;
916 };
917
918 // Alias for name_suffix
919 Chance.prototype.suffix = function (options) {
920 return this.name_suffix(options);
921 };
922
923 Chance.prototype.name_suffix = function (options) {
924 options = initOptions(options);
925 return options.full ?
926 this.pick(this.name_suffixes()).name :
927 this.pick(this.name_suffixes()).abbreviation;
928 };
929
930 Chance.prototype.nationalities = function () {
931 return this.get("nationalities");
932 };
933
934 // Generate random nationality based on json list
935 Chance.prototype.nationality = function () {
936 var nationality = this.pick(this.nationalities());
937 return nationality.name;
938 };
939
940 // -- End Person --
941
942 // -- Mobile --
943 // Android GCM Registration ID
944 Chance.prototype.android_id = function () {
945 return "APA91" + this.string({ pool: "0123456789abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_", length: 178 });
946 };
947
948 // Apple Push Token
949 Chance.prototype.apple_token = function () {
950 return this.string({ pool: "abcdef1234567890", length: 64 });
951 };
952
953 // Windows Phone 8 ANID2
954 Chance.prototype.wp8_anid2 = function () {
955 return base64( this.hash( { length : 32 } ) );
956 };
957
958 // Windows Phone 7 ANID
959 Chance.prototype.wp7_anid = function () {
960 return 'A=' + this.guid().replace(/-/g, '').toUpperCase() + '&E=' + this.hash({ length:3 }) + '&W=' + this.integer({ min:0, max:9 });
961 };
962
963 // BlackBerry Device PIN
964 Chance.prototype.bb_pin = function () {
965 return this.hash({ length: 8 });
966 };
967
968 // -- End Mobile --
969
970 // -- Web --
971 Chance.prototype.avatar = function (options) {
972 var url = null;
973 var URL_BASE = '//www.gravatar.com/avatar/';
974 var PROTOCOLS = {
975 http: 'http',
976 https: 'https'
977 };
978 var FILE_TYPES = {
979 bmp: 'bmp',
980 gif: 'gif',
981 jpg: 'jpg',
982 png: 'png'
983 };
984 var FALLBACKS = {
985 '404': '404', // Return 404 if not found
986 mm: 'mm', // Mystery man
987 identicon: 'identicon', // Geometric pattern based on hash
988 monsterid: 'monsterid', // A generated monster icon
989 wavatar: 'wavatar', // A generated face
990 retro: 'retro', // 8-bit icon
991 blank: 'blank' // A transparent png
992 };
993 var RATINGS = {
994 g: 'g',
995 pg: 'pg',
996 r: 'r',
997 x: 'x'
998 };
999 var opts = {
1000 protocol: null,
1001 email: null,
1002 fileExtension: null,
1003 size: null,
1004 fallback: null,
1005 rating: null
1006 };
1007
1008 if (!options) {
1009 // Set to a random email
1010 opts.email = this.email();
1011 options = {};
1012 }
1013 else if (typeof options === 'string') {
1014 opts.email = options;
1015 options = {};
1016 }
1017 else if (typeof options !== 'object') {
1018 return null;
1019 }
1020 else if (options.constructor === 'Array') {
1021 return null;
1022 }
1023
1024 opts = initOptions(options, opts);
1025
1026 if (!opts.email) {
1027 // Set to a random email
1028 opts.email = this.email();
1029 }
1030
1031 // Safe checking for params
1032 opts.protocol = PROTOCOLS[opts.protocol] ? opts.protocol + ':' : '';
1033 opts.size = parseInt(opts.size, 0) ? opts.size : '';
1034 opts.rating = RATINGS[opts.rating] ? opts.rating : '';
1035 opts.fallback = FALLBACKS[opts.fallback] ? opts.fallback : '';
1036 opts.fileExtension = FILE_TYPES[opts.fileExtension] ? opts.fileExtension : '';
1037
1038 url =
1039 opts.protocol +
1040 URL_BASE +
1041 this.bimd5.md5(opts.email) +
1042 (opts.fileExtension ? '.' + opts.fileExtension : '') +
1043 (opts.size || opts.rating || opts.fallback ? '?' : '') +
1044 (opts.size ? '&s=' + opts.size.toString() : '') +
1045 (opts.rating ? '&r=' + opts.rating : '') +
1046 (opts.fallback ? '&d=' + opts.fallback : '')
1047 ;
1048
1049 return url;
1050 };
1051
1052 /**
1053 * #Description:
1054 * ===============================================
1055 * Generate random color value base on color type:
1056 * -> hex
1057 * -> rgb
1058 * -> rgba
1059 * -> 0x
1060 * -> named color
1061 *
1062 * #Examples:
1063 * ===============================================
1064 * * Geerate random hex color
1065 * chance.color() => '#79c157' / 'rgb(110,52,164)' / '0x67ae0b' / '#e2e2e2' / '#29CFA7'
1066 *
1067 * * Generate Hex based color value
1068 * chance.color({format: 'hex'}) => '#d67118'
1069 *
1070 * * Generate simple rgb value
1071 * chance.color({format: 'rgb'}) => 'rgb(110,52,164)'
1072 *
1073 * * Generate Ox based color value
1074 * chance.color({format: '0x'}) => '0x67ae0b'
1075 *
1076 * * Generate graiscale based value
1077 * chance.color({grayscale: true}) => '#e2e2e2'
1078 *
1079 * * Return valide color name
1080 * chance.color({format: 'name'}) => 'red'
1081 *
1082 * * Make color uppercase
1083 * chance.color({casing: 'upper'}) => '#29CFA7'
1084
1085 * * Min Max values for RGBA
1086 * var light_red = chance.color({format: 'hex', min_red: 200, max_red: 255, max_green: 0, max_blue: 0, min_alpha: .2, max_alpha: .3});
1087 *
1088 * @param [object] options
1089 * @return [string] color value
1090 */
1091 Chance.prototype.color = function (options) {
1092 function pad(n, width, z) {
1093 z = z || '0';
1094 n = n + '';
1095 return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
1096 }
1097
1098 function gray(value, delimiter) {
1099 return [value, value, value].join(delimiter || '');
1100 }
1101
1102 function rgb(hasAlpha) {
1103 var rgbValue = (hasAlpha) ? 'rgba' : 'rgb';
1104 var alphaChannel = (hasAlpha) ? (',' + this.floating({min:min_alpha, max:max_alpha})) : "";
1105 var colorValue = (isGrayscale) ? (gray(this.natural({min: min_rgb, max: max_rgb}), ',')) : (this.natural({min: min_green, max: max_green}) + ',' + this.natural({min: min_blue, max: max_blue}) + ',' + this.natural({max: 255}));
1106 return rgbValue + '(' + colorValue + alphaChannel + ')';
1107 }
1108
1109 function hex(start, end, withHash) {
1110 var symbol = (withHash) ? "#" : "";
1111 var hexstring = "";
1112
1113 if (isGrayscale) {
1114 hexstring = gray(pad(this.hex({min: min_rgb, max: max_rgb}), 2));
1115 if (options.format === "shorthex") {
1116 hexstring = gray(this.hex({min: 0, max: 15}));
1117 console.log("hex: " + hexstring);
1118 }
1119 }
1120 else {
1121 if (options.format === "shorthex") {
1122 hexstring = pad(this.hex({min: Math.floor(min_red / 16), max: Math.floor(max_red / 16)}), 1) + pad(this.hex({min: Math.floor(min_green / 16), max: Math.floor(max_green / 16)}), 1) + pad(this.hex({min: Math.floor(min_blue / 16), max: Math.floor(max_blue / 16)}), 1);
1123 }
1124 else if (min_red !== undefined || max_red !== undefined || min_green !== undefined || max_green !== undefined || min_blue !== undefined || max_blue !== undefined) {
1125 hexstring = pad(this.hex({min: min_red, max: max_red}), 2) + pad(this.hex({min: min_green, max: max_green}), 2) + pad(this.hex({min: min_blue, max: max_blue}), 2);
1126 }
1127 else {
1128 hexstring = pad(this.hex({min: min_rgb, max: max_rgb}), 2) + pad(this.hex({min: min_rgb, max: max_rgb}), 2) + pad(this.hex({min: min_rgb, max: max_rgb}), 2);
1129 }
1130 }
1131
1132 return symbol + hexstring;
1133 }
1134
1135 options = initOptions(options, {
1136 format: this.pick(['hex', 'shorthex', 'rgb', 'rgba', '0x', 'name']),
1137 grayscale: false,
1138 casing: 'lower',
1139 min: 0,
1140 max: 255,
1141 min_red: undefined,
1142 max_red: undefined,
1143 min_green: undefined,
1144 max_green: undefined,
1145 min_blue: undefined,
1146 max_blue: undefined,
1147 min_alpha: 0,
1148 max_alpha: 1
1149 });
1150
1151 var isGrayscale = options.grayscale;
1152 var min_rgb = options.min;
1153 var max_rgb = options.max;
1154 var min_red = options.min_red;
1155 var max_red = options.max_red;
1156 var min_green = options.min_green;
1157 var max_green = options.max_green;
1158 var min_blue = options.min_blue;
1159 var max_blue = options.max_blue;
1160 var min_alpha = options.min_alpha;
1161 var max_alpha = options.max_alpha;
1162 if (options.min_red === undefined) { min_red = min_rgb; }
1163 if (options.max_red === undefined) { max_red = max_rgb; }
1164 if (options.min_green === undefined) { min_green = min_rgb; }
1165 if (options.max_green === undefined) { max_green = max_rgb; }
1166 if (options.min_blue === undefined) { min_blue = min_rgb; }
1167 if (options.max_blue === undefined) { max_blue = max_rgb; }
1168 if (options.min_alpha === undefined) { min_alpha = 0; }
1169 if (options.max_alpha === undefined) { max_alpha = 1; }
1170 if (isGrayscale && min_rgb === 0 && max_rgb === 255 && min_red !== undefined && max_red !== undefined) {
1171 min_rgb = ((min_red + min_green + min_blue) / 3);
1172 max_rgb = ((max_red + max_green + max_blue) / 3);
1173 }
1174 var colorValue;
1175
1176 if (options.format === 'hex') {
1177 colorValue = hex.call(this, 2, 6, true);
1178 }
1179 else if (options.format === 'shorthex') {
1180 colorValue = hex.call(this, 1, 3, true);
1181 }
1182 else if (options.format === 'rgb') {
1183 colorValue = rgb.call(this, false);
1184 }
1185 else if (options.format === 'rgba') {
1186 colorValue = rgb.call(this, true);
1187 }
1188 else if (options.format === '0x') {
1189 colorValue = '0x' + hex.call(this, 2, 6);
1190 }
1191 else if(options.format === 'name') {
1192 return this.pick(this.get("colorNames"));
1193 }
1194 else {
1195 throw new RangeError('Invalid format provided. Please provide one of "hex", "shorthex", "rgb", "rgba", "0x" or "name".');
1196 }
1197
1198 if (options.casing === 'upper' ) {
1199 colorValue = colorValue.toUpperCase();
1200 }
1201
1202 return colorValue;
1203 };
1204
1205 Chance.prototype.domain = function (options) {
1206 options = initOptions(options);
1207 return this.word() + '.' + (options.tld || this.tld());
1208 };
1209
1210 Chance.prototype.email = function (options) {
1211 options = initOptions(options);
1212 return this.word({length: options.length}) + '@' + (options.domain || this.domain());
1213 };
1214
1215 Chance.prototype.fbid = function () {
1216 return parseInt('10000' + this.natural({max: 100000000000}), 10);
1217 };
1218
1219 Chance.prototype.google_analytics = function () {
1220 var account = this.pad(this.natural({max: 999999}), 6);
1221 var property = this.pad(this.natural({max: 99}), 2);
1222
1223 return 'UA-' + account + '-' + property;
1224 };
1225
1226 Chance.prototype.hashtag = function () {
1227 return '#' + this.word();
1228 };
1229
1230 Chance.prototype.ip = function () {
1231 // Todo: This could return some reserved IPs. See http://vq.io/137dgYy
1232 // this should probably be updated to account for that rare as it may be
1233 return this.natural({min: 1, max: 254}) + '.' +
1234 this.natural({max: 255}) + '.' +
1235 this.natural({max: 255}) + '.' +
1236 this.natural({min: 1, max: 254});
1237 };
1238
1239 Chance.prototype.ipv6 = function () {
1240 var ip_addr = this.n(this.hash, 8, {length: 4});
1241
1242 return ip_addr.join(":");
1243 };
1244
1245 Chance.prototype.klout = function () {
1246 return this.natural({min: 1, max: 99});
1247 };
1248
1249 Chance.prototype.semver = function (options) {
1250 options = initOptions(options, { include_prerelease: true });
1251
1252 var range = this.pickone(["^", "~", "<", ">", "<=", ">=", "="]);
1253 if (options.range) {
1254 range = options.range;
1255 }
1256
1257 var prerelease = "";
1258 if (options.include_prerelease) {
1259 prerelease = this.weighted(["", "-dev", "-beta", "-alpha"], [50, 10, 5, 1]);
1260 }
1261 return range + this.rpg('3d10').join('.') + prerelease;
1262 };
1263
1264 Chance.prototype.tlds = function () {
1265 return ['com', 'org', 'edu', 'gov', 'co.uk', 'net', 'io', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'bq', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st', 'su', 'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm', 'zw'];
1266 };
1267
1268 Chance.prototype.tld = function () {
1269 return this.pick(this.tlds());
1270 };
1271
1272 Chance.prototype.twitter = function () {
1273 return '@' + this.word();
1274 };
1275
1276 Chance.prototype.url = function (options) {
1277 options = initOptions(options, { protocol: "http", domain: this.domain(options), domain_prefix: "", path: this.word(), extensions: []});
1278
1279 var extension = options.extensions.length > 0 ? "." + this.pick(options.extensions) : "";
1280 var domain = options.domain_prefix ? options.domain_prefix + "." + options.domain : options.domain;
1281
1282 return options.protocol + "://" + domain + "/" + options.path + extension;
1283 };
1284
1285 Chance.prototype.port = function() {
1286 return this.integer({min: 0, max: 65535});
1287 };
1288
1289 // -- End Web --
1290
1291 // -- Location --
1292
1293 Chance.prototype.address = function (options) {
1294 options = initOptions(options);
1295 return this.natural({min: 5, max: 2000}) + ' ' + this.street(options);
1296 };
1297
1298 Chance.prototype.altitude = function (options) {
1299 options = initOptions(options, {fixed: 5, min: 0, max: 8848});
1300 return this.floating({
1301 min: options.min,
1302 max: options.max,
1303 fixed: options.fixed
1304 });
1305 };
1306
1307 Chance.prototype.areacode = function (options) {
1308 options = initOptions(options, {parens : true});
1309 // Don't want area codes to start with 1, or have a 9 as the second digit
1310 var areacode = this.natural({min: 2, max: 9}).toString() +
1311 this.natural({min: 0, max: 8}).toString() +
1312 this.natural({min: 0, max: 9}).toString();
1313
1314 return options.parens ? '(' + areacode + ')' : areacode;
1315 };
1316
1317 Chance.prototype.city = function () {
1318 return this.capitalize(this.word({syllables: 3}));
1319 };
1320
1321 Chance.prototype.coordinates = function (options) {
1322 return this.latitude(options) + ', ' + this.longitude(options);
1323 };
1324
1325 Chance.prototype.countries = function () {
1326 return this.get("countries");
1327 };
1328
1329 Chance.prototype.country = function (options) {
1330 options = initOptions(options);
1331 var country = this.pick(this.countries());
1332 return options.full ? country.name : country.abbreviation;
1333 };
1334
1335 Chance.prototype.depth = function (options) {
1336 options = initOptions(options, {fixed: 5, min: -10994, max: 0});
1337 return this.floating({
1338 min: options.min,
1339 max: options.max,
1340 fixed: options.fixed
1341 });
1342 };
1343
1344 Chance.prototype.geohash = function (options) {
1345 options = initOptions(options, { length: 7 });
1346 return this.string({ length: options.length, pool: '0123456789bcdefghjkmnpqrstuvwxyz' });
1347 };
1348
1349 Chance.prototype.geojson = function (options) {
1350 return this.latitude(options) + ', ' + this.longitude(options) + ', ' + this.altitude(options);
1351 };
1352
1353 Chance.prototype.latitude = function (options) {
1354 options = initOptions(options, {fixed: 5, min: -90, max: 90});
1355 return this.floating({min: options.min, max: options.max, fixed: options.fixed});
1356 };
1357
1358 Chance.prototype.longitude = function (options) {
1359 options = initOptions(options, {fixed: 5, min: -180, max: 180});
1360 return this.floating({min: options.min, max: options.max, fixed: options.fixed});
1361 };
1362
1363 Chance.prototype.phone = function (options) {
1364 var self = this,
1365 numPick,
1366 ukNum = function (parts) {
1367 var section = [];
1368 //fills the section part of the phone number with random numbers.
1369 parts.sections.forEach(function(n) {
1370 section.push(self.string({ pool: '0123456789', length: n}));
1371 });
1372 return parts.area + section.join(' ');
1373 };
1374 options = initOptions(options, {
1375 formatted: true,
1376 country: 'us',
1377 mobile: false
1378 });
1379 if (!options.formatted) {
1380 options.parens = false;
1381 }
1382 var phone;
1383 switch (options.country) {
1384 case 'fr':
1385 if (!options.mobile) {
1386 numPick = this.pick([
1387 // Valid zone and département codes.
1388 '01' + this.pick(['30', '34', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '53', '55', '56', '58', '60', '64', '69', '70', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83']) + self.string({ pool: '0123456789', length: 6}),
1389 '02' + this.pick(['14', '18', '22', '23', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '40', '41', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '56', '57', '61', '62', '69', '72', '76', '77', '78', '85', '90', '96', '97', '98', '99']) + self.string({ pool: '0123456789', length: 6}),
1390 '03' + this.pick(['10', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '39', '44', '45', '51', '52', '54', '55', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90']) + self.string({ pool: '0123456789', length: 6}),
1391 '04' + this.pick(['11', '13', '15', '20', '22', '26', '27', '30', '32', '34', '37', '42', '43', '44', '50', '56', '57', '63', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '88', '89', '90', '91', '92', '93', '94', '95', '97', '98']) + self.string({ pool: '0123456789', length: 6}),
1392 '05' + this.pick(['08', '16', '17', '19', '24', '31', '32', '33', '34', '35', '40', '45', '46', '47', '49', '53', '55', '56', '57', '58', '59', '61', '62', '63', '64', '65', '67', '79', '81', '82', '86', '87', '90', '94']) + self.string({ pool: '0123456789', length: 6}),
1393 '09' + self.string({ pool: '0123456789', length: 8}),
1394 ]);
1395 phone = options.formatted ? numPick.match(/../g).join(' ') : numPick;
1396 } else {
1397 numPick = this.pick(['06', '07']) + self.string({ pool: '0123456789', length: 8});
1398 phone = options.formatted ? numPick.match(/../g).join(' ') : numPick;
1399 }
1400 break;
1401 case 'uk':
1402 if (!options.mobile) {
1403 numPick = this.pick([
1404 //valid area codes of major cities/counties followed by random numbers in required format.
1405
1406 { area: '01' + this.character({ pool: '234569' }) + '1 ', sections: [3,4] },
1407 { area: '020 ' + this.character({ pool: '378' }), sections: [3,4] },
1408 { area: '023 ' + this.character({ pool: '89' }), sections: [3,4] },
1409 { area: '024 7', sections: [3,4] },
1410 { area: '028 ' + this.pick(['25','28','37','71','82','90','92','95']), sections: [2,4] },
1411 { area: '012' + this.pick(['04','08','54','76','97','98']) + ' ', sections: [6] },
1412 { area: '013' + this.pick(['63','64','84','86']) + ' ', sections: [6] },
1413 { area: '014' + this.pick(['04','20','60','61','80','88']) + ' ', sections: [6] },
1414 { area: '015' + this.pick(['24','27','62','66']) + ' ', sections: [6] },
1415 { area: '016' + this.pick(['06','29','35','47','59','95']) + ' ', sections: [6] },
1416 { area: '017' + this.pick(['26','44','50','68']) + ' ', sections: [6] },
1417 { area: '018' + this.pick(['27','37','84','97']) + ' ', sections: [6] },
1418 { area: '019' + this.pick(['00','05','35','46','49','63','95']) + ' ', sections: [6] }
1419 ]);
1420 phone = options.formatted ? ukNum(numPick) : ukNum(numPick).replace(' ', '', 'g');
1421 } else {
1422 numPick = this.pick([
1423 { area: '07' + this.pick(['4','5','7','8','9']), sections: [2,6] },
1424 { area: '07624 ', sections: [6] }
1425 ]);
1426 phone = options.formatted ? ukNum(numPick) : ukNum(numPick).replace(' ', '');
1427 }
1428 break;
1429 case 'za':
1430 if (!options.mobile) {
1431 numPick = this.pick([
1432 '01' + this.pick(['0', '1', '2', '3', '4', '5', '6', '7', '8']) + self.string({ pool: '0123456789', length: 7}),
1433 '02' + this.pick(['1', '2', '3', '4', '7', '8']) + self.string({ pool: '0123456789', length: 7}),
1434 '03' + this.pick(['1', '2', '3', '5', '6', '9']) + self.string({ pool: '0123456789', length: 7}),
1435 '04' + this.pick(['1', '2', '3', '4', '5','6','7', '8','9']) + self.string({ pool: '0123456789', length: 7}),
1436 '05' + this.pick(['1', '3', '4', '6', '7', '8']) + self.string({ pool: '0123456789', length: 7}),
1437 ]);
1438 phone = options.formatted || numPick;
1439 } else {
1440 numPick = this.pick([
1441 '060' + this.pick(['3','4','5','6','7','8','9']) + self.string({ pool: '0123456789', length: 6}),
1442 '061' + this.pick(['0','1','2','3','4','5','8']) + self.string({ pool: '0123456789', length: 6}),
1443 '06' + self.string({ pool: '0123456789', length: 7}),
1444 '071' + this.pick(['0','1','2','3','4','5','6','7','8','9']) + self.string({ pool: '0123456789', length: 6}),
1445 '07' + this.pick(['2','3','4','6','7','8','9']) + self.string({ pool: '0123456789', length: 7}),
1446 '08' + this.pick(['0','1','2','3','4','5']) + self.string({ pool: '0123456789', length: 7}),
1447 ]);
1448 phone = options.formatted || numPick;
1449 }
1450
1451 break;
1452
1453 case 'us':
1454 var areacode = this.areacode(options).toString();
1455 var exchange = this.natural({ min: 2, max: 9 }).toString() +
1456 this.natural({ min: 0, max: 9 }).toString() +
1457 this.natural({ min: 0, max: 9 }).toString();
1458 var subscriber = this.natural({ min: 1000, max: 9999 }).toString(); // this could be random [0-9]{4}
1459 phone = options.formatted ? areacode + ' ' + exchange + '-' + subscriber : areacode + exchange + subscriber;
1460 }
1461 return phone;
1462 };
1463
1464 Chance.prototype.postal = function () {
1465 // Postal District
1466 var pd = this.character({pool: "XVTSRPNKLMHJGECBA"});
1467 // Forward Sortation Area (FSA)
1468 var fsa = pd + this.natural({max: 9}) + this.character({alpha: true, casing: "upper"});
1469 // Local Delivery Unut (LDU)
1470 var ldu = this.natural({max: 9}) + this.character({alpha: true, casing: "upper"}) + this.natural({max: 9});
1471
1472 return fsa + " " + ldu;
1473 };
1474
1475 Chance.prototype.counties = function (options) {
1476 options = initOptions(options, { country: 'uk' });
1477 return this.get("counties")[options.country.toLowerCase()];
1478 };
1479
1480 Chance.prototype.county = function (options) {
1481 return this.pick(this.counties(options)).name;
1482 };
1483
1484 Chance.prototype.provinces = function (options) {
1485 options = initOptions(options, { country: 'ca' });
1486 return this.get("provinces")[options.country.toLowerCase()];
1487 };
1488
1489 Chance.prototype.province = function (options) {
1490 return (options && options.full) ?
1491 this.pick(this.provinces(options)).name :
1492 this.pick(this.provinces(options)).abbreviation;
1493 };
1494
1495 Chance.prototype.state = function (options) {
1496 return (options && options.full) ?
1497 this.pick(this.states(options)).name :
1498 this.pick(this.states(options)).abbreviation;
1499 };
1500
1501 Chance.prototype.states = function (options) {
1502 options = initOptions(options, { country: 'us', us_states_and_dc: true } );
1503
1504 var states;
1505
1506 switch (options.country.toLowerCase()) {
1507 case 'us':
1508 var us_states_and_dc = this.get("us_states_and_dc"),
1509 territories = this.get("territories"),
1510 armed_forces = this.get("armed_forces");
1511
1512 states = [];
1513
1514 if (options.us_states_and_dc) {
1515 states = states.concat(us_states_and_dc);
1516 }
1517 if (options.territories) {
1518 states = states.concat(territories);
1519 }
1520 if (options.armed_forces) {
1521 states = states.concat(armed_forces);
1522 }
1523 break;
1524 case 'it':
1525 states = this.get("country_regions")[options.country.toLowerCase()];
1526 break;
1527 case 'uk':
1528 states = this.get("counties")[options.country.toLowerCase()];
1529 break;
1530 }
1531
1532 return states;
1533 };
1534
1535 Chance.prototype.street = function (options) {
1536 options = initOptions(options, { country: 'us', syllables: 2 });
1537 var street;
1538
1539 switch (options.country.toLowerCase()) {
1540 case 'us':
1541 street = this.word({ syllables: options.syllables });
1542 street = this.capitalize(street);
1543 street += ' ';
1544 street += options.short_suffix ?
1545 this.street_suffix(options).abbreviation :
1546 this.street_suffix(options).name;
1547 break;
1548 case 'it':
1549 street = this.word({ syllables: options.syllables });
1550 street = this.capitalize(street);
1551 street = (options.short_suffix ?
1552 this.street_suffix(options).abbreviation :
1553 this.street_suffix(options).name) + " " + street;
1554 break;
1555 }
1556 return street;
1557 };
1558
1559 Chance.prototype.street_suffix = function (options) {
1560 options = initOptions(options, { country: 'us' });
1561 return this.pick(this.street_suffixes(options));
1562 };
1563
1564 Chance.prototype.street_suffixes = function (options) {
1565 options = initOptions(options, { country: 'us' });
1566 // These are the most common suffixes.
1567 return this.get("street_suffixes")[options.country.toLowerCase()];
1568 };
1569
1570 // Note: only returning US zip codes, internationalization will be a whole
1571 // other beast to tackle at some point.
1572 Chance.prototype.zip = function (options) {
1573 var zip = this.n(this.natural, 5, {max: 9});
1574
1575 if (options && options.plusfour === true) {
1576 zip.push('-');
1577 zip = zip.concat(this.n(this.natural, 4, {max: 9}));
1578 }
1579
1580 return zip.join("");
1581 };
1582
1583 // -- End Location --
1584
1585 // -- Time
1586
1587 Chance.prototype.ampm = function () {
1588 return this.bool() ? 'am' : 'pm';
1589 };
1590
1591 Chance.prototype.date = function (options) {
1592 var date_string, date;
1593
1594 // If interval is specified we ignore preset
1595 if(options && (options.min || options.max)) {
1596 options = initOptions(options, {
1597 american: true,
1598 string: false
1599 });
1600 var min = typeof options.min !== "undefined" ? options.min.getTime() : 1;
1601 // 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. http://es5.github.io/#x15.9.1.1
1602 var max = typeof options.max !== "undefined" ? options.max.getTime() : 8640000000000000;
1603
1604 date = new Date(this.integer({min: min, max: max}));
1605 } else {
1606 var m = this.month({raw: true});
1607 var daysInMonth = m.days;
1608
1609 if(options && options.month) {
1610 // Mod 12 to allow months outside range of 0-11 (not encouraged, but also not prevented).
1611 daysInMonth = this.get('months')[((options.month % 12) + 12) % 12].days;
1612 }
1613
1614 options = initOptions(options, {
1615 year: parseInt(this.year(), 10),
1616 // Necessary to subtract 1 because Date() 0-indexes month but not day or year
1617 // for some reason.
1618 month: m.numeric - 1,
1619 day: this.natural({min: 1, max: daysInMonth}),
1620 hour: this.hour({twentyfour: true}),
1621 minute: this.minute(),
1622 second: this.second(),
1623 millisecond: this.millisecond(),
1624 american: true,
1625 string: false
1626 });
1627
1628 date = new Date(options.year, options.month, options.day, options.hour, options.minute, options.second, options.millisecond);
1629 }
1630
1631 if (options.american) {
1632 // Adding 1 to the month is necessary because Date() 0-indexes
1633 // months but not day for some odd reason.
1634 date_string = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
1635 } else {
1636 date_string = date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear();
1637 }
1638
1639 return options.string ? date_string : date;
1640 };
1641
1642 Chance.prototype.hammertime = function (options) {
1643 return this.date(options).getTime();
1644 };
1645
1646 Chance.prototype.hour = function (options) {
1647 options = initOptions(options, {
1648 min: options && options.twentyfour ? 0 : 1,
1649 max: options && options.twentyfour ? 23 : 12
1650 });
1651
1652 testRange(options.min < 0, "Chance: Min cannot be less than 0.");
1653 testRange(options.twentyfour && options.max > 23, "Chance: Max cannot be greater than 23 for twentyfour option.");
1654 testRange(!options.twentyfour && options.max > 12, "Chance: Max cannot be greater than 12.");
1655 testRange(options.min > options.max, "Chance: Min cannot be greater than Max.");
1656
1657 return this.natural({min: options.min, max: options.max});
1658 };
1659
1660 Chance.prototype.millisecond = function () {
1661 return this.natural({max: 999});
1662 };
1663
1664 Chance.prototype.minute = Chance.prototype.second = function (options) {
1665 options = initOptions(options, {min: 0, max: 59});
1666
1667 testRange(options.min < 0, "Chance: Min cannot be less than 0.");
1668 testRange(options.max > 59, "Chance: Max cannot be greater than 59.");
1669 testRange(options.min > options.max, "Chance: Min cannot be greater than Max.");
1670
1671 return this.natural({min: options.min, max: options.max});
1672 };
1673
1674 Chance.prototype.month = function (options) {
1675 options = initOptions(options, {min: 1, max: 12});
1676
1677 testRange(options.min < 1, "Chance: Min cannot be less than 1.");
1678 testRange(options.max > 12, "Chance: Max cannot be greater than 12.");
1679 testRange(options.min > options.max, "Chance: Min cannot be greater than Max.");
1680
1681 var month = this.pick(this.months().slice(options.min - 1, options.max));
1682 return options.raw ? month : month.name;
1683 };
1684
1685 Chance.prototype.months = function () {
1686 return this.get("months");
1687 };
1688
1689 Chance.prototype.second = function () {
1690 return this.natural({max: 59});
1691 };
1692
1693 Chance.prototype.timestamp = function () {
1694 return this.natural({min: 1, max: parseInt(new Date().getTime() / 1000, 10)});
1695 };
1696
1697 Chance.prototype.weekday = function (options) {
1698 options = initOptions(options, {weekday_only: false});
1699 var weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"];
1700 if (!options.weekday_only) {
1701 weekdays.push("Saturday");
1702 weekdays.push("Sunday");
1703 }
1704 return this.pickone(weekdays);
1705 };
1706
1707 Chance.prototype.year = function (options) {
1708 // Default to current year as min if none specified
1709 options = initOptions(options, {min: new Date().getFullYear()});
1710
1711 // Default to one century after current year as max if none specified
1712 options.max = (typeof options.max !== "undefined") ? options.max : options.min + 100;
1713
1714 return this.natural(options).toString();
1715 };
1716
1717 // -- End Time
1718
1719 // -- Finance --
1720
1721 Chance.prototype.cc = function (options) {
1722 options = initOptions(options);
1723
1724 var type, number, to_generate;
1725
1726 type = (options.type) ?
1727 this.cc_type({ name: options.type, raw: true }) :
1728 this.cc_type({ raw: true });
1729
1730 number = type.prefix.split("");
1731 to_generate = type.length - type.prefix.length - 1;
1732
1733 // Generates n - 1 digits
1734 number = number.concat(this.n(this.integer, to_generate, {min: 0, max: 9}));
1735
1736 // Generates the last digit according to Luhn algorithm
1737 number.push(this.luhn_calculate(number.join("")));
1738
1739 return number.join("");
1740 };
1741
1742 Chance.prototype.cc_types = function () {
1743 // http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29
1744 return this.get("cc_types");
1745 };
1746
1747 Chance.prototype.cc_type = function (options) {
1748 options = initOptions(options);
1749 var types = this.cc_types(),
1750 type = null;
1751
1752 if (options.name) {
1753 for (var i = 0; i < types.length; i++) {
1754 // Accept either name or short_name to specify card type
1755 if (types[i].name === options.name || types[i].short_name === options.name) {
1756 type = types[i];
1757 break;
1758 }
1759 }
1760 if (type === null) {
1761 throw new RangeError("Credit card type '" + options.name + "'' is not supported");
1762 }
1763 } else {
1764 type = this.pick(types);
1765 }
1766
1767 return options.raw ? type : type.name;
1768 };
1769
1770 //return all world currency by ISO 4217
1771 Chance.prototype.currency_types = function () {
1772 return this.get("currency_types");
1773 };
1774
1775 //return random world currency by ISO 4217
1776 Chance.prototype.currency = function () {
1777 return this.pick(this.currency_types());
1778 };
1779
1780 //return all timezones availabel
1781 Chance.prototype.timezones = function () {
1782 return this.get("timezones");
1783 };
1784
1785 //return random timezone
1786 Chance.prototype.timezone = function () {
1787 return this.pick(this.timezones());
1788 };
1789
1790 //Return random correct currency exchange pair (e.g. EUR/USD) or array of currency code
1791 Chance.prototype.currency_pair = function (returnAsString) {
1792 var currencies = this.unique(this.currency, 2, {
1793 comparator: function(arr, val) {
1794
1795 return arr.reduce(function(acc, item) {
1796 // If a match has been found, short circuit check and just return
1797 return acc || (item.code === val.code);
1798 }, false);
1799 }
1800 });
1801
1802 if (returnAsString) {
1803 return currencies[0].code + '/' + currencies[1].code;
1804 } else {
1805 return currencies;
1806 }
1807 };
1808
1809 Chance.prototype.dollar = function (options) {
1810 // By default, a somewhat more sane max for dollar than all available numbers
1811 options = initOptions(options, {max : 10000, min : 0});
1812
1813 var dollar = this.floating({min: options.min, max: options.max, fixed: 2}).toString(),
1814 cents = dollar.split('.')[1];
1815
1816 if (cents === undefined) {
1817 dollar += '.00';
1818 } else if (cents.length < 2) {
1819 dollar = dollar + '0';
1820 }
1821
1822 if (dollar < 0) {
1823 return '-$' + dollar.replace('-', '');
1824 } else {
1825 return '$' + dollar;
1826 }
1827 };
1828
1829 Chance.prototype.euro = function (options) {
1830 return Number(this.dollar(options).replace("$", "")).toLocaleString() + "€";
1831 };
1832
1833 Chance.prototype.exp = function (options) {
1834 options = initOptions(options);
1835 var exp = {};
1836
1837 exp.year = this.exp_year();
1838
1839 // If the year is this year, need to ensure month is greater than the
1840 // current month or this expiration will not be valid
1841 if (exp.year === (new Date().getFullYear()).toString()) {
1842 exp.month = this.exp_month({future: true});
1843 } else {
1844 exp.month = this.exp_month();
1845 }
1846
1847 return options.raw ? exp : exp.month + '/' + exp.year;
1848 };
1849
1850 Chance.prototype.exp_month = function (options) {
1851 options = initOptions(options);
1852 var month, month_int,
1853 // Date object months are 0 indexed
1854 curMonth = new Date().getMonth() + 1;
1855
1856 if (options.future && (curMonth !== 12)) {
1857 do {
1858 month = this.month({raw: true}).numeric;
1859 month_int = parseInt(month, 10);
1860 } while (month_int <= curMonth);
1861 } else {
1862 month = this.month({raw: true}).numeric;
1863 }
1864
1865 return month;
1866 };
1867
1868 Chance.prototype.exp_year = function () {
1869 var curMonth = new Date().getMonth() + 1,
1870 curYear = new Date().getFullYear();
1871
1872 return this.year({min: ((curMonth === 12) ? (curYear + 1) : curYear), max: (curYear + 10)});
1873 };
1874
1875 Chance.prototype.vat = function (options) {
1876 options = initOptions(options, { country: 'it' });
1877 switch (options.country.toLowerCase()) {
1878 case 'it':
1879 return this.it_vat();
1880 }
1881 };
1882
1883 /**
1884 * Generate a string matching IBAN pattern (https://en.wikipedia.org/wiki/International_Bank_Account_Number).
1885 * No country-specific formats support (yet)
1886 */
1887 Chance.prototype.iban = function () {
1888 var alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1889 var alphanum = alpha + '0123456789';
1890 var iban =
1891 this.string({ length: 2, pool: alpha }) +
1892 this.pad(this.integer({ min: 0, max: 99 }), 2) +
1893 this.string({ length: 4, pool: alphanum }) +
1894 this.pad(this.natural(), this.natural({ min: 6, max: 26 }));
1895 return iban;
1896 };
1897
1898 // -- End Finance
1899
1900 // -- Regional
1901
1902 Chance.prototype.it_vat = function () {
1903 var it_vat = this.natural({min: 1, max: 1800000});
1904
1905 it_vat = this.pad(it_vat, 7) + this.pad(this.pick(this.provinces({ country: 'it' })).code, 3);
1906 return it_vat + this.luhn_calculate(it_vat);
1907 };
1908
1909 /*
1910 * this generator is written following the official algorithm
1911 * all data can be passed explicitely or randomized by calling chance.cf() without options
1912 * the code does not check that the input data is valid (it goes beyond the scope of the generator)
1913 *
1914 * @param [Object] options = { first: first name,
1915 * last: last name,
1916 * gender: female|male,
1917 birthday: JavaScript date object,
1918 city: string(4), 1 letter + 3 numbers
1919 }
1920 * @return [string] codice fiscale
1921 *
1922 */
1923 Chance.prototype.cf = function (options) {
1924 options = options || {};
1925 var gender = !!options.gender ? options.gender : this.gender(),
1926 first = !!options.first ? options.first : this.first( { gender: gender, nationality: 'it'} ),
1927 last = !!options.last ? options.last : this.last( { nationality: 'it'} ),
1928 birthday = !!options.birthday ? options.birthday : this.birthday(),
1929 city = !!options.city ? options.city : this.pickone(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'L', 'M', 'Z']) + this.pad(this.natural({max:999}), 3),
1930 cf = [],
1931 name_generator = function(name, isLast) {
1932 var temp,
1933 return_value = [];
1934
1935 if (name.length < 3) {
1936 return_value = name.split("").concat("XXX".split("")).splice(0,3);
1937 }
1938 else {
1939 temp = name.toUpperCase().split('').map(function(c){
1940 return ("BCDFGHJKLMNPRSTVWZ".indexOf(c) !== -1) ? c : undefined;
1941 }).join('');
1942 if (temp.length > 3) {
1943 if (isLast) {
1944 temp = temp.substr(0,3);
1945 } else {
1946 temp = temp[0] + temp.substr(2,2);
1947 }
1948 }
1949 if (temp.length < 3) {
1950 return_value = temp;
1951 temp = name.toUpperCase().split('').map(function(c){
1952 return ("AEIOU".indexOf(c) !== -1) ? c : undefined;
1953 }).join('').substr(0, 3 - return_value.length);
1954 }
1955 return_value = return_value + temp;
1956 }
1957
1958 return return_value;
1959 },
1960 date_generator = function(birthday, gender, that) {
1961 var lettermonths = ['A', 'B', 'C', 'D', 'E', 'H', 'L', 'M', 'P', 'R', 'S', 'T'];
1962
1963 return birthday.getFullYear().toString().substr(2) +
1964 lettermonths[birthday.getMonth()] +
1965 that.pad(birthday.getDate() + ((gender.toLowerCase() === "female") ? 40 : 0), 2);
1966 },
1967 checkdigit_generator = function(cf) {
1968 var range1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
1969 range2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ",
1970 evens = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
1971 odds = "BAKPLCQDREVOSFTGUHMINJWZYX",
1972 digit = 0;
1973
1974
1975 for(var i = 0; i < 15; i++) {
1976 if (i % 2 !== 0) {
1977 digit += evens.indexOf(range2[range1.indexOf(cf[i])]);
1978 }
1979 else {
1980 digit += odds.indexOf(range2[range1.indexOf(cf[i])]);
1981 }
1982 }
1983 return evens[digit % 26];
1984 };
1985
1986 cf = cf.concat(name_generator(last, true), name_generator(first), date_generator(birthday, gender, this), city.toUpperCase().split("")).join("");
1987 cf += checkdigit_generator(cf.toUpperCase(), this);
1988
1989 return cf.toUpperCase();
1990 };
1991
1992 Chance.prototype.pl_pesel = function () {
1993 var number = this.natural({min: 1, max: 9999999999});
1994 var arr = this.pad(number, 10).split('');
1995 for (var i = 0; i < arr.length; i++) {
1996 arr[i] = parseInt(arr[i]);
1997 }
1998
1999 var controlNumber = (1 * arr[0] + 3 * arr[1] + 7 * arr[2] + 9 * arr[3] + 1 * arr[4] + 3 * arr[5] + 7 * arr[6] + 9 * arr[7] + 1 * arr[8] + 3 * arr[9]) % 10;
2000 if(controlNumber !== 0) {
2001 controlNumber = 10 - controlNumber;
2002 }
2003
2004 return arr.join('') + controlNumber;
2005 };
2006
2007 Chance.prototype.pl_nip = function () {
2008 var number = this.natural({min: 1, max: 999999999});
2009 var arr = this.pad(number, 9).split('');
2010 for (var i = 0; i < arr.length; i++) {
2011 arr[i] = parseInt(arr[i]);
2012 }
2013
2014 var controlNumber = (6 * arr[0] + 5 * arr[1] + 7 * arr[2] + 2 * arr[3] + 3 * arr[4] + 4 * arr[5] + 5 * arr[6] + 6 * arr[7] + 7 * arr[8]) % 11;
2015 if(controlNumber === 10) {
2016 return this.pl_nip();
2017 }
2018
2019 return arr.join('') + controlNumber;
2020 };
2021
2022 Chance.prototype.pl_regon = function () {
2023 var number = this.natural({min: 1, max: 99999999});
2024 var arr = this.pad(number, 8).split('');
2025 for (var i = 0; i < arr.length; i++) {
2026 arr[i] = parseInt(arr[i]);
2027 }
2028
2029 var controlNumber = (8 * arr[0] + 9 * arr[1] + 2 * arr[2] + 3 * arr[3] + 4 * arr[4] + 5 * arr[5] + 6 * arr[6] + 7 * arr[7]) % 11;
2030 if(controlNumber === 10) {
2031 controlNumber = 0;
2032 }
2033
2034 return arr.join('') + controlNumber;
2035 };
2036
2037 // -- End Regional
2038
2039 // -- Miscellaneous --
2040
2041 // Dice - For all the board game geeks out there, myself included ;)
2042 function diceFn (range) {
2043 return function () {
2044 return this.natural(range);
2045 };
2046 }
2047 Chance.prototype.d4 = diceFn({min: 1, max: 4});
2048 Chance.prototype.d6 = diceFn({min: 1, max: 6});
2049 Chance.prototype.d8 = diceFn({min: 1, max: 8});
2050 Chance.prototype.d10 = diceFn({min: 1, max: 10});
2051 Chance.prototype.d12 = diceFn({min: 1, max: 12});
2052 Chance.prototype.d20 = diceFn({min: 1, max: 20});
2053 Chance.prototype.d30 = diceFn({min: 1, max: 30});
2054 Chance.prototype.d100 = diceFn({min: 1, max: 100});
2055
2056 Chance.prototype.rpg = function (thrown, options) {
2057 options = initOptions(options);
2058 if (!thrown) {
2059 throw new RangeError("A type of die roll must be included");
2060 } else {
2061 var bits = thrown.toLowerCase().split("d"),
2062 rolls = [];
2063
2064 if (bits.length !== 2 || !parseInt(bits[0], 10) || !parseInt(bits[1], 10)) {
2065 throw new Error("Invalid format provided. Please provide #d# where the first # is the number of dice to roll, the second # is the max of each die");
2066 }
2067 for (var i = bits[0]; i > 0; i--) {
2068 rolls[i - 1] = this.natural({min: 1, max: bits[1]});
2069 }
2070 return (typeof options.sum !== 'undefined' && options.sum) ? rolls.reduce(function (p, c) { return p + c; }) : rolls;
2071 }
2072 };
2073
2074 // Guid
2075 Chance.prototype.guid = function (options) {
2076 options = initOptions(options, { version: 5 });
2077
2078 var guid_pool = "abcdef1234567890",
2079 variant_pool = "ab89",
2080 guid = this.string({ pool: guid_pool, length: 8 }) + '-' +
2081 this.string({ pool: guid_pool, length: 4 }) + '-' +
2082 // The Version
2083 options.version +
2084 this.string({ pool: guid_pool, length: 3 }) + '-' +
2085 // The Variant
2086 this.string({ pool: variant_pool, length: 1 }) +
2087 this.string({ pool: guid_pool, length: 3 }) + '-' +
2088 this.string({ pool: guid_pool, length: 12 });
2089 return guid;
2090 };
2091
2092 // Hash
2093 Chance.prototype.hash = function (options) {
2094 options = initOptions(options, {length : 40, casing: 'lower'});
2095 var pool = options.casing === 'upper' ? HEX_POOL.toUpperCase() : HEX_POOL;
2096 return this.string({pool: pool, length: options.length});
2097 };
2098
2099 Chance.prototype.luhn_check = function (num) {
2100 var str = num.toString();
2101 var checkDigit = +str.substring(str.length - 1);
2102 return checkDigit === this.luhn_calculate(+str.substring(0, str.length - 1));
2103 };
2104
2105 Chance.prototype.luhn_calculate = function (num) {
2106 var digits = num.toString().split("").reverse();
2107 var sum = 0;
2108 var digit;
2109
2110 for (var i = 0, l = digits.length; l > i; ++i) {
2111 digit = +digits[i];
2112 if (i % 2 === 0) {
2113 digit *= 2;
2114 if (digit > 9) {
2115 digit -= 9;
2116 }
2117 }
2118 sum += digit;
2119 }
2120 return (sum * 9) % 10;
2121 };
2122
2123 // MD5 Hash
2124 Chance.prototype.md5 = function(options) {
2125 var opts = { str: '', key: null, raw: false };
2126
2127 if (!options) {
2128 opts.str = this.string();
2129 options = {};
2130 }
2131 else if (typeof options === 'string') {
2132 opts.str = options;
2133 options = {};
2134 }
2135 else if (typeof options !== 'object') {
2136 return null;
2137 }
2138 else if(options.constructor === 'Array') {
2139 return null;
2140 }
2141
2142 opts = initOptions(options, opts);
2143
2144 if(!opts.str){
2145 throw new Error('A parameter is required to return an md5 hash.');
2146 }
2147
2148 return this.bimd5.md5(opts.str, opts.key, opts.raw);
2149 };
2150
2151 /**
2152 * #Description:
2153 * =====================================================
2154 * Generate random file name with extension
2155 *
2156 * The argument provide extension type
2157 * -> raster
2158 * -> vector
2159 * -> 3d
2160 * -> document
2161 *
2162 * If nothing is provided the function return random file name with random
2163 * extension type of any kind
2164 *
2165 * The user can validate the file name length range
2166 * If nothing provided the generated file name is random
2167 *
2168 * #Extension Pool :
2169 * * Currently the supported extensions are
2170 * -> some of the most popular raster image extensions
2171 * -> some of the most popular vector image extensions
2172 * -> some of the most popular 3d image extensions
2173 * -> some of the most popular document extensions
2174 *
2175 * #Examples :
2176 * =====================================================
2177 *
2178 * Return random file name with random extension. The file extension
2179 * is provided by a predefined collection of extensions. More about the extension
2180 * pool can be found in #Extension Pool section
2181 *
2182 * chance.file()
2183 * => dsfsdhjf.xml
2184 *
2185 * In order to generate a file name with specific length, specify the
2186 * length property and integer value. The extension is going to be random
2187 *
2188 * chance.file({length : 10})
2189 * => asrtineqos.pdf
2190 *
2191 * In order to generate file with extension from some of the predefined groups
2192 * of the extension pool just specify the extension pool category in fileType property
2193 *
2194 * chance.file({fileType : 'raster'})
2195 * => dshgssds.psd
2196 *
2197 * You can provide specific extension for your files
2198 * chance.file({extension : 'html'})
2199 * => djfsd.html
2200 *
2201 * Or you could pass custom collection of extensions by array or by object
2202 * chance.file({extensions : [...]})
2203 * => dhgsdsd.psd
2204 *
2205 * chance.file({extensions : { key : [...], key : [...]}})
2206 * => djsfksdjsd.xml
2207 *
2208 * @param [collection] options
2209 * @return [string]
2210 *
2211 */
2212 Chance.prototype.file = function(options) {
2213
2214 var fileOptions = options || {};
2215 var poolCollectionKey = "fileExtension";
2216 var typeRange = Object.keys(this.get("fileExtension"));//['raster', 'vector', '3d', 'document'];
2217 var fileName;
2218 var fileExtension;
2219
2220 // Generate random file name
2221 fileName = this.word({length : fileOptions.length});
2222
2223 // Generate file by specific extension provided by the user
2224 if(fileOptions.extension) {
2225
2226 fileExtension = fileOptions.extension;
2227 return (fileName + '.' + fileExtension);
2228 }
2229
2230 // Generate file by specific extension collection
2231 if(fileOptions.extensions) {
2232
2233 if(Array.isArray(fileOptions.extensions)) {
2234
2235 fileExtension = this.pickone(fileOptions.extensions);
2236 return (fileName + '.' + fileExtension);
2237 }
2238 else if(fileOptions.extensions.constructor === Object) {
2239
2240 var extensionObjectCollection = fileOptions.extensions;
2241 var keys = Object.keys(extensionObjectCollection);
2242
2243 fileExtension = this.pickone(extensionObjectCollection[this.pickone(keys)]);
2244 return (fileName + '.' + fileExtension);
2245 }
2246
2247 throw new Error("Expect collection of type Array or Object to be passed as an argument ");
2248 }
2249
2250 // Generate file extension based on specific file type
2251 if(fileOptions.fileType) {
2252
2253 var fileType = fileOptions.fileType;
2254 if(typeRange.indexOf(fileType) !== -1) {
2255
2256 fileExtension = this.pickone(this.get(poolCollectionKey)[fileType]);
2257 return (fileName + '.' + fileExtension);
2258 }
2259
2260 throw new Error("Expect file type value to be 'raster', 'vector', '3d' or 'document' ");
2261 }
2262
2263 // Generate random file name if no extension options are passed
2264 fileExtension = this.pickone(this.get(poolCollectionKey)[this.pickone(typeRange)]);
2265 return (fileName + '.' + fileExtension);
2266 };
2267
2268 var data = {
2269
2270 firstNames: {
2271 "male": {
2272 "en": ["James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "Charles", "Thomas", "Christopher", "Daniel", "Matthew", "George", "Donald", "Anthony", "Paul", "Mark", "Edward", "Steven", "Kenneth", "Andrew", "Brian", "Joshua", "Kevin", "Ronald", "Timothy", "Jason", "Jeffrey", "Frank", "Gary", "Ryan", "Nicholas", "Eric", "Stephen", "Jacob", "Larry", "Jonathan", "Scott", "Raymond", "Justin", "Brandon", "Gregory", "Samuel", "Benjamin", "Patrick", "Jack", "Henry", "Walter", "Dennis", "Jerry", "Alexander", "Peter", "Tyler", "Douglas", "Harold", "Aaron", "Jose", "Adam", "Arthur", "Zachary", "Carl", "Nathan", "Albert", "Kyle", "Lawrence", "Joe", "Willie", "Gerald", "Roger", "Keith", "Jeremy", "Terry", "Harry", "Ralph", "Sean", "Jesse", "Roy", "Louis", "Billy", "Austin", "Bruce", "Eugene", "Christian", "Bryan", "Wayne", "Russell", "Howard", "Fred", "Ethan", "Jordan", "Philip", "Alan", "Juan", "Randy", "Vincent", "Bobby", "Dylan", "Johnny", "Phillip", "Victor", "Clarence", "Ernest", "Martin", "Craig", "Stanley", "Shawn", "Travis", "Bradley", "Leonard", "Earl", "Gabriel", "Jimmy", "Francis", "Todd", "Noah", "Danny", "Dale", "Cody", "Carlos", "Allen", "Frederick", "Logan", "Curtis", "Alex", "Joel", "Luis", "Norman", "Marvin", "Glenn", "Tony", "Nathaniel", "Rodney", "Melvin", "Alfred", "Steve", "Cameron", "Chad", "Edwin", "Caleb", "Evan", "Antonio", "Lee", "Herbert", "Jeffery", "Isaac", "Derek", "Ricky", "Marcus", "Theodore", "Elijah", "Luke", "Jesus", "Eddie", "Troy", "Mike", "Dustin", "Ray", "Adrian", "Bernard", "Leroy", "Angel", "Randall", "Wesley", "Ian", "Jared", "Mason", "Hunter", "Calvin", "Oscar", "Clifford", "Jay", "Shane", "Ronnie", "Barry", "Lucas", "Corey", "Manuel", "Leo", "Tommy", "Warren", "Jackson", "Isaiah", "Connor", "Don", "Dean", "Jon", "Julian", "Miguel", "Bill", "Lloyd", "Charlie", "Mitchell", "Leon", "Jerome", "Darrell", "Jeremiah", "Alvin", "Brett", "Seth", "Floyd", "Jim", "Blake", "Micheal", "Gordon", "Trevor", "Lewis", "Erik", "Edgar", "Vernon", "Devin", "Gavin", "Jayden", "Chris", "Clyde", "Tom", "Derrick", "Mario", "Brent", "Marc", "Herman", "Chase", "Dominic", "Ricardo", "Franklin", "Maurice", "Max", "Aiden", "Owen", "Lester", "Gilbert", "Elmer", "Gene", "Francisco", "Glen", "Cory", "Garrett", "Clayton", "Sam", "Jorge", "Chester", "Alejandro", "Jeff", "Harvey", "Milton", "Cole", "Ivan", "Andre", "Duane", "Landon"],
2273 // Data taken from http://www.dati.gov.it/dataset/comune-di-firenze_0163
2274 "it": ["Adolfo", "Alberto", "Aldo", "Alessandro", "Alessio", "Alfredo", "Alvaro", "Andrea", "Angelo", "Angiolo", "Antonino", "Antonio", "Attilio", "Benito", "Bernardo", "Bruno", "Carlo", "Cesare", "Christian", "Claudio", "Corrado", "Cosimo", "Cristian", "Cristiano", "Daniele", "Dario", "David", "Davide", "Diego", "Dino", "Domenico", "Duccio", "Edoardo", "Elia", "Elio", "Emanuele", "Emiliano", "Emilio", "Enrico", "Enzo", "Ettore", "Fabio", "Fabrizio", "Federico", "Ferdinando", "Fernando", "Filippo", "Francesco", "Franco", "Gabriele", "Giacomo", "Giampaolo", "Giampiero", "Giancarlo", "Gianfranco", "Gianluca", "Gianmarco", "Gianni", "Gino", "Giorgio", "Giovanni", "Giuliano", "Giulio", "Giuseppe", "Graziano", "Gregorio", "Guido", "Iacopo", "Jacopo", "Lapo", "Leonardo", "Lorenzo", "Luca", "Luciano", "Luigi", "Manuel", "Marcello", "Marco", "Marino", "Mario", "Massimiliano", "Massimo", "Matteo", "Mattia", "Maurizio", "Mauro", "Michele", "Mirko", "Mohamed", "Nello", "Neri", "Niccolò", "Nicola", "Osvaldo", "Otello", "Paolo", "Pier Luigi", "Piero", "Pietro", "Raffaele", "Remo", "Renato", "Renzo", "Riccardo", "Roberto", "Rolando", "Romano", "Salvatore", "Samuele", "Sandro", "Sergio", "Silvano", "Simone", "Stefano", "Thomas", "Tommaso", "Ubaldo", "Ugo", "Umberto", "Valerio", "Valter", "Vasco", "Vincenzo", "Vittorio"]
2275 },
2276 "female": {
2277 "en": ["Mary", "Emma", "Elizabeth", "Minnie", "Margaret", "Ida", "Alice", "Bertha", "Sarah", "Annie", "Clara", "Ella", "Florence", "Cora", "Martha", "Laura", "Nellie", "Grace", "Carrie", "Maude", "Mabel", "Bessie", "Jennie", "Gertrude", "Julia", "Hattie", "Edith", "Mattie", "Rose", "Catherine", "Lillian", "Ada", "Lillie", "Helen", "Jessie", "Louise", "Ethel", "Lula", "Myrtle", "Eva", "Frances", "Lena", "Lucy", "Edna", "Maggie", "Pearl", "Daisy", "Fannie", "Josephine", "Dora", "Rosa", "Katherine", "Agnes", "Marie", "Nora", "May", "Mamie", "Blanche", "Stella", "Ellen", "Nancy", "Effie", "Sallie", "Nettie", "Della", "Lizzie", "Flora", "Susie", "Maud", "Mae", "Etta", "Harriet", "Sadie", "Caroline", "Katie", "Lydia", "Elsie", "Kate", "Susan", "Mollie", "Alma", "Addie", "Georgia", "Eliza", "Lulu", "Nannie", "Lottie", "Amanda", "Belle", "Charlotte", "Rebecca", "Ruth", "Viola", "Olive", "Amelia", "Hannah", "Jane", "Virginia", "Emily", "Matilda", "Irene", "Kathryn", "Esther", "Willie", "Henrietta", "Ollie", "Amy", "Rachel", "Sara", "Estella", "Theresa", "Augusta", "Ora", "Pauline", "Josie", "Lola", "Sophia", "Leona", "Anne", "Mildred", "Ann", "Beulah", "Callie", "Lou", "Delia", "Eleanor", "Barbara", "Iva", "Louisa", "Maria", "Mayme", "Evelyn", "Estelle", "Nina", "Betty", "Marion", "Bettie", "Dorothy", "Luella", "Inez", "Lela", "Rosie", "Allie", "Millie", "Janie", "Cornelia", "Victoria", "Ruby", "Winifred", "Alta", "Celia", "Christine", "Beatrice", "Birdie", "Harriett", "Mable", "Myra", "Sophie", "Tillie", "Isabel", "Sylvia", "Carolyn", "Isabelle", "Leila", "Sally", "Ina", "Essie", "Bertie", "Nell", "Alberta", "Katharine", "Lora", "Rena", "Mina", "Rhoda", "Mathilda", "Abbie", "Eula", "Dollie", "Hettie", "Eunice", "Fanny", "Ola", "Lenora", "Adelaide", "Christina", "Lelia", "Nelle", "Sue", "Johanna", "Lilly", "Lucinda", "Minerva", "Lettie", "Roxie", "Cynthia", "Helena", "Hilda", "Hulda", "Bernice", "Genevieve", "Jean", "Cordelia", "Marian", "Francis", "Jeanette", "Adeline", "Gussie", "Leah", "Lois", "Lura", "Mittie", "Hallie", "Isabella", "Olga", "Phoebe", "Teresa", "Hester", "Lida", "Lina", "Winnie", "Claudia", "Marguerite", "Vera", "Cecelia", "Bess", "Emilie", "Rosetta", "Verna", "Myrtie", "Cecilia", "Elva", "Olivia", "Ophelia", "Georgie", "Elnora", "Violet", "Adele", "Lily", "Linnie", "Loretta", "Madge", "Polly", "Virgie", "Eugenia", "Lucile", "Lucille", "Mabelle", "Rosalie"],
2278 // Data taken from http://www.dati.gov.it/dataset/comune-di-firenze_0162
2279 "it": ["Ada", "Adriana", "Alessandra", "Alessia", "Alice", "Angela", "Anna", "Anna Maria", "Annalisa", "Annita", "Annunziata", "Antonella", "Arianna", "Asia", "Assunta", "Aurora", "Barbara", "Beatrice", "Benedetta", "Bianca", "Bruna", "Camilla", "Carla", "Carlotta", "Carmela", "Carolina", "Caterina", "Catia", "Cecilia", "Chiara", "Cinzia", "Clara", "Claudia", "Costanza", "Cristina", "Daniela", "Debora", "Diletta", "Dina", "Donatella", "Elena", "Eleonora", "Elisa", "Elisabetta", "Emanuela", "Emma", "Eva", "Federica", "Fernanda", "Fiorella", "Fiorenza", "Flora", "Franca", "Francesca", "Gabriella", "Gaia", "Gemma", "Giada", "Gianna", "Gina", "Ginevra", "Giorgia", "Giovanna", "Giulia", "Giuliana", "Giuseppa", "Giuseppina", "Grazia", "Graziella", "Greta", "Ida", "Ilaria", "Ines", "Iolanda", "Irene", "Irma", "Isabella", "Jessica", "Laura", "Leda", "Letizia", "Licia", "Lidia", "Liliana", "Lina", "Linda", "Lisa", "Livia", "Loretta", "Luana", "Lucia", "Luciana", "Lucrezia", "Luisa", "Manuela", "Mara", "Marcella", "Margherita", "Maria", "Maria Cristina", "Maria Grazia", "Maria Luisa", "Maria Pia", "Maria Teresa", "Marina", "Marisa", "Marta", "Martina", "Marzia", "Matilde", "Melissa", "Michela", "Milena", "Mirella", "Monica", "Natalina", "Nella", "Nicoletta", "Noemi", "Olga", "Paola", "Patrizia", "Piera", "Pierina", "Raffaella", "Rebecca", "Renata", "Rina", "Rita", "Roberta", "Rosa", "Rosanna", "Rossana", "Rossella", "Sabrina", "Sandra", "Sara", "Serena", "Silvana", "Silvia", "Simona", "Simonetta", "Sofia", "Sonia", "Stefania", "Susanna", "Teresa", "Tina", "Tiziana", "Tosca", "Valentina", "Valeria", "Vanda", "Vanessa", "Vanna", "Vera", "Veronica", "Vilma", "Viola", "Virginia", "Vittoria"]
2280 }
2281 },
2282
2283 lastNames: {
2284 "en": ['Smith', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson', 'Moore', 'Taylor', 'Anderson', 'Thomas', 'Jackson', 'White', 'Harris', 'Martin', 'Thompson', 'Garcia', 'Martinez', 'Robinson', 'Clark', 'Rodriguez', 'Lewis', 'Lee', 'Walker', 'Hall', 'Allen', 'Young', 'Hernandez', 'King', 'Wright', 'Lopez', 'Hill', 'Scott', 'Green', 'Adams', 'Baker', 'Gonzalez', 'Nelson', 'Carter', 'Mitchell', 'Perez', 'Roberts', 'Turner', 'Phillips', 'Campbell', 'Parker', 'Evans', 'Edwards', 'Collins', 'Stewart', 'Sanchez', 'Morris', 'Rogers', 'Reed', 'Cook', 'Morgan', 'Bell', 'Murphy', 'Bailey', 'Rivera', 'Cooper', 'Richardson', 'Cox', 'Howard', 'Ward', 'Torres', 'Peterson', 'Gray', 'Ramirez', 'James', 'Watson', 'Brooks', 'Kelly', 'Sanders', 'Price', 'Bennett', 'Wood', 'Barnes', 'Ross', 'Henderson', 'Coleman', 'Jenkins', 'Perry', 'Powell', 'Long', 'Patterson', 'Hughes', 'Flores', 'Washington', 'Butler', 'Simmons', 'Foster', 'Gonzales', 'Bryant', 'Alexander', 'Russell', 'Griffin', 'Diaz', 'Hayes', 'Myers', 'Ford', 'Hamilton', 'Graham', 'Sullivan', 'Wallace', 'Woods', 'Cole', 'West', 'Jordan', 'Owens', 'Reynolds', 'Fisher', 'Ellis', 'Harrison', 'Gibson', 'McDonald', 'Cruz', 'Marshall', 'Ortiz', 'Gomez', 'Murray', 'Freeman', 'Wells', 'Webb', 'Simpson', 'Stevens', 'Tucker', 'Porter', 'Hunter', 'Hicks', 'Crawford', 'Henry', 'Boyd', 'Mason', 'Morales', 'Kennedy', 'Warren', 'Dixon', 'Ramos', 'Reyes', 'Burns', 'Gordon', 'Shaw', 'Holmes', 'Rice', 'Robertson', 'Hunt', 'Black', 'Daniels', 'Palmer', 'Mills', 'Nichols', 'Grant', 'Knight', 'Ferguson', 'Rose', 'Stone', 'Hawkins', 'Dunn', 'Perkins', 'Hudson', 'Spencer', 'Gardner', 'Stephens', 'Payne', 'Pierce', 'Berry', 'Matthews', 'Arnold', 'Wagner', 'Willis', 'Ray', 'Watkins', 'Olson', 'Carroll', 'Duncan', 'Snyder', 'Hart', 'Cunningham', 'Bradley', 'Lane', 'Andrews', 'Ruiz', 'Harper', 'Fox', 'Riley', 'Armstrong', 'Carpenter', 'Weaver', 'Greene', 'Lawrence', 'Elliott', 'Chavez', 'Sims', 'Austin', 'Peters', 'Kelley', 'Franklin', 'Lawson', 'Fields', 'Gutierrez', 'Ryan', 'Schmidt', 'Carr', 'Vasquez', 'Castillo', 'Wheeler', 'Chapman', 'Oliver', 'Montgomery', 'Richards', 'Williamson', 'Johnston', 'Banks', 'Meyer', 'Bishop', 'McCoy', 'Howell', 'Alvarez', 'Morrison', 'Hansen', 'Fernandez', 'Garza', 'Harvey', 'Little', 'Burton', 'Stanley', 'Nguyen', 'George', 'Jacobs', 'Reid', 'Kim', 'Fuller', 'Lynch', 'Dean', 'Gilbert', 'Garrett', 'Romero', 'Welch', 'Larson', 'Frazier', 'Burke', 'Hanson', 'Day', 'Mendoza', 'Moreno', 'Bowman', 'Medina', 'Fowler', 'Brewer', 'Hoffman', 'Carlson', 'Silva', 'Pearson', 'Holland', 'Douglas', 'Fleming', 'Jensen', 'Vargas', 'Byrd', 'Davidson', 'Hopkins', 'May', 'Terry', 'Herrera', 'Wade', 'Soto', 'Walters', 'Curtis', 'Neal', 'Caldwell', 'Lowe', 'Jennings', 'Barnett', 'Graves', 'Jimenez', 'Horton', 'Shelton', 'Barrett', 'Obrien', 'Castro', 'Sutton', 'Gregory', 'McKinney', 'Lucas', 'Miles', 'Craig', 'Rodriquez', 'Chambers', 'Holt', 'Lambert', 'Fletcher', 'Watts', 'Bates', 'Hale', 'Rhodes', 'Pena', 'Beck', 'Newman', 'Haynes', 'McDaniel', 'Mendez', 'Bush', 'Vaughn', 'Parks', 'Dawson', 'Santiago', 'Norris', 'Hardy', 'Love', 'Steele', 'Curry', 'Powers', 'Schultz', 'Barker', 'Guzman', 'Page', 'Munoz', 'Ball', 'Keller', 'Chandler', 'Weber', 'Leonard', 'Walsh', 'Lyons', 'Ramsey', 'Wolfe', 'Schneider', 'Mullins', 'Benson', 'Sharp', 'Bowen', 'Daniel', 'Barber', 'Cummings', 'Hines', 'Baldwin', 'Griffith', 'Valdez', 'Hubbard', 'Salazar', 'Reeves', 'Warner', 'Stevenson', 'Burgess', 'Santos', 'Tate', 'Cross', 'Garner', 'Mann', 'Mack', 'Moss', 'Thornton', 'Dennis', 'McGee', 'Farmer', 'Delgado', 'Aguilar', 'Vega', 'Glover', 'Manning', 'Cohen', 'Harmon', 'Rodgers', 'Robbins', 'Newton', 'Todd', 'Blair', 'Higgins', 'Ingram', 'Reese', 'Cannon', 'Strickland', 'Townsend', 'Potter', 'Goodwin', 'Walton', 'Rowe', 'Hampton', 'Ortega', 'Patton', 'Swanson', 'Joseph', 'Francis', 'Goodman', 'Maldonado', 'Yates', 'Becker', 'Erickson', 'Hodges', 'Rios', 'Conner', 'Adkins', 'Webster', 'Norman', 'Malone', 'Hammond', 'Flowers', 'Cobb', 'Moody', 'Quinn', 'Blake', 'Maxwell', 'Pope', 'Floyd', 'Osborne', 'Paul', 'McCarthy', 'Guerrero', 'Lindsey', 'Estrada', 'Sandoval', 'Gibbs', 'Tyler', 'Gross', 'Fitzgerald', 'Stokes', 'Doyle', 'Sherman', 'Saunders', 'Wise', 'Colon', 'Gill', 'Alvarado', 'Greer', 'Padilla', 'Simon', 'Waters', 'Nunez', 'Ballard', 'Schwartz', 'McBride', 'Houston', 'Christensen', 'Klein', 'Pratt', 'Briggs', 'Parsons', 'McLaughlin', 'Zimmerman', 'French', 'Buchanan', 'Moran', 'Copeland', 'Roy', 'Pittman', 'Brady', 'McCormick', 'Holloway', 'Brock', 'Poole', 'Frank', 'Logan', 'Owen', 'Bass', 'Marsh', 'Drake', 'Wong', 'Jefferson', 'Park', 'Morton', 'Abbott', 'Sparks', 'Patrick', 'Norton', 'Huff', 'Clayton', 'Massey', 'Lloyd', 'Figueroa', 'Carson', 'Bowers', 'Roberson', 'Barton', 'Tran', 'Lamb', 'Harrington', 'Casey', 'Boone', 'Cortez', 'Clarke', 'Mathis', 'Singleton', 'Wilkins', 'Cain', 'Bryan', 'Underwood', 'Hogan', 'McKenzie', 'Collier', 'Luna', 'Phelps', 'McGuire', 'Allison', 'Bridges', 'Wilkerson', 'Nash', 'Summers', 'Atkins'],
2285 // Data taken from http://www.dati.gov.it/dataset/comune-di-firenze_0164 (first 1000)
2286 "it": ["Acciai", "Aglietti", "Agostini", "Agresti", "Ahmed", "Aiazzi", "Albanese", "Alberti", "Alessi", "Alfani", "Alinari", "Alterini", "Amato", "Ammannati", "Ancillotti", "Andrei", "Andreini", "Andreoni", "Angeli", "Anichini", "Antonelli", "Antonini", "Arena", "Ariani", "Arnetoli", "Arrighi", "Baccani", "Baccetti", "Bacci", "Bacherini", "Badii", "Baggiani", "Baglioni", "Bagni", "Bagnoli", "Baldassini", "Baldi", "Baldini", "Ballerini", "Balli", "Ballini", "Balloni", "Bambi", "Banchi", "Bandinelli", "Bandini", "Bani", "Barbetti", "Barbieri", "Barchielli", "Bardazzi", "Bardelli", "Bardi", "Barducci", "Bargellini", "Bargiacchi", "Barni", "Baroncelli", "Baroncini", "Barone", "Baroni", "Baronti", "Bartalesi", "Bartoletti", "Bartoli", "Bartolini", "Bartoloni", "Bartolozzi", "Basagni", "Basile", "Bassi", "Batacchi", "Battaglia", "Battaglini", "Bausi", "Becagli", "Becattini", "Becchi", "Becucci", "Bellandi", "Bellesi", "Belli", "Bellini", "Bellucci", "Bencini", "Benedetti", "Benelli", "Beni", "Benini", "Bensi", "Benucci", "Benvenuti", "Berlincioni", "Bernacchioni", "Bernardi", "Bernardini", "Berni", "Bernini", "Bertelli", "Berti", "Bertini", "Bessi", "Betti", "Bettini", "Biagi", "Biagini", "Biagioni", "Biagiotti", "Biancalani", "Bianchi", "Bianchini", "Bianco", "Biffoli", "Bigazzi", "Bigi", "Biliotti", "Billi", "Binazzi", "Bindi", "Bini", "Biondi", "Bizzarri", "Bocci", "Bogani", "Bolognesi", "Bonaiuti", "Bonanni", "Bonciani", "Boncinelli", "Bondi", "Bonechi", "Bongini", "Boni", "Bonini", "Borchi", "Boretti", "Borghi", "Borghini", "Borgioli", "Borri", "Borselli", "Boschi", "Bottai", "Bracci", "Braccini", "Brandi", "Braschi", "Bravi", "Brazzini", "Breschi", "Brilli", "Brizzi", "Brogelli", "Brogi", "Brogioni", "Brunelli", "Brunetti", "Bruni", "Bruno", "Brunori", "Bruschi", "Bucci", "Bucciarelli", "Buccioni", "Bucelli", "Bulli", "Burberi", "Burchi", "Burgassi", "Burroni", "Bussotti", "Buti", "Caciolli", "Caiani", "Calabrese", "Calamai", "Calamandrei", "Caldini", "Calo'", "Calonaci", "Calosi", "Calvelli", "Cambi", "Camiciottoli", "Cammelli", "Cammilli", "Campolmi", "Cantini", "Capanni", "Capecchi", "Caponi", "Cappelletti", "Cappelli", "Cappellini", "Cappugi", "Capretti", "Caputo", "Carbone", "Carboni", "Cardini", "Carlesi", "Carletti", "Carli", "Caroti", "Carotti", "Carrai", "Carraresi", "Carta", "Caruso", "Casalini", "Casati", "Caselli", "Casini", "Castagnoli", "Castellani", "Castelli", "Castellucci", "Catalano", "Catarzi", "Catelani", "Cavaciocchi", "Cavallaro", "Cavallini", "Cavicchi", "Cavini", "Ceccarelli", "Ceccatelli", "Ceccherelli", "Ceccherini", "Cecchi", "Cecchini", "Cecconi", "Cei", "Cellai", "Celli", "Cellini", "Cencetti", "Ceni", "Cenni", "Cerbai", "Cesari", "Ceseri", "Checcacci", "Checchi", "Checcucci", "Cheli", "Chellini", "Chen", "Cheng", "Cherici", "Cherubini", "Chiaramonti", "Chiarantini", "Chiarelli", "Chiari", "Chiarini", "Chiarugi", "Chiavacci", "Chiesi", "Chimenti", "Chini", "Chirici", "Chiti", "Ciabatti", "Ciampi", "Cianchi", "Cianfanelli", "Cianferoni", "Ciani", "Ciapetti", "Ciappi", "Ciardi", "Ciatti", "Cicali", "Ciccone", "Cinelli", "Cini", "Ciobanu", "Ciolli", "Cioni", "Cipriani", "Cirillo", "Cirri", "Ciucchi", "Ciuffi", "Ciulli", "Ciullini", "Clemente", "Cocchi", "Cognome", "Coli", "Collini", "Colombo", "Colzi", "Comparini", "Conforti", "Consigli", "Conte", "Conti", "Contini", "Coppini", "Coppola", "Corsi", "Corsini", "Corti", "Cortini", "Cosi", "Costa", "Costantini", "Costantino", "Cozzi", "Cresci", "Crescioli", "Cresti", "Crini", "Curradi", "D'Agostino", "D'Alessandro", "D'Amico", "D'Angelo", "Daddi", "Dainelli", "Dallai", "Danti", "Davitti", "De Angelis", "De Luca", "De Marco", "De Rosa", "De Santis", "De Simone", "De Vita", "Degl'Innocenti", "Degli Innocenti", "Dei", "Del Lungo", "Del Re", "Di Marco", "Di Stefano", "Dini", "Diop", "Dobre", "Dolfi", "Donati", "Dondoli", "Dong", "Donnini", "Ducci", "Dumitru", "Ermini", "Esposito", "Evangelisti", "Fabbri", "Fabbrini", "Fabbrizzi", "Fabbroni", "Fabbrucci", "Fabiani", "Facchini", "Faggi", "Fagioli", "Failli", "Faini", "Falciani", "Falcini", "Falcone", "Fallani", "Falorni", "Falsini", "Falugiani", "Fancelli", "Fanelli", "Fanetti", "Fanfani", "Fani", "Fantappie'", "Fantechi", "Fanti", "Fantini", "Fantoni", "Farina", "Fattori", "Favilli", "Fedi", "Fei", "Ferrante", "Ferrara", "Ferrari", "Ferraro", "Ferretti", "Ferri", "Ferrini", "Ferroni", "Fiaschi", "Fibbi", "Fiesoli", "Filippi", "Filippini", "Fini", "Fioravanti", "Fiore", "Fiorentini", "Fiorini", "Fissi", "Focardi", "Foggi", "Fontana", "Fontanelli", "Fontani", "Forconi", "Formigli", "Forte", "Forti", "Fortini", "Fossati", "Fossi", "Francalanci", "Franceschi", "Franceschini", "Franchi", "Franchini", "Franci", "Francini", "Francioni", "Franco", "Frassineti", "Frati", "Fratini", "Frilli", "Frizzi", "Frosali", "Frosini", "Frullini", "Fusco", "Fusi", "Gabbrielli", "Gabellini", "Gagliardi", "Galanti", "Galardi", "Galeotti", "Galletti", "Galli", "Gallo", "Gallori", "Gambacciani", "Gargani", "Garofalo", "Garuglieri", "Gashi", "Gasperini", "Gatti", "Gelli", "Gensini", "Gentile", "Gentili", "Geri", "Gerini", "Gheri", "Ghini", "Giachetti", "Giachi", "Giacomelli", "Gianassi", "Giani", "Giannelli", "Giannetti", "Gianni", "Giannini", "Giannoni", "Giannotti", "Giannozzi", "Gigli", "Giordano", "Giorgetti", "Giorgi", "Giovacchini", "Giovannelli", "Giovannetti", "Giovannini", "Giovannoni", "Giuliani", "Giunti", "Giuntini", "Giusti", "Gonnelli", "Goretti", "Gori", "Gradi", "Gramigni", "Grassi", "Grasso", "Graziani", "Grazzini", "Greco", "Grifoni", "Grillo", "Grimaldi", "Grossi", "Gualtieri", "Guarducci", "Guarino", "Guarnieri", "Guasti", "Guerra", "Guerri", "Guerrini", "Guidi", "Guidotti", "He", "Hoxha", "Hu", "Huang", "Iandelli", "Ignesti", "Innocenti", "Jin", "La Rosa", "Lai", "Landi", "Landini", "Lanini", "Lapi", "Lapini", "Lari", "Lascialfari", "Lastrucci", "Latini", "Lazzeri", "Lazzerini", "Lelli", "Lenzi", "Leonardi", "Leoncini", "Leone", "Leoni", "Lepri", "Li", "Liao", "Lin", "Linari", "Lippi", "Lisi", "Livi", "Lombardi", "Lombardini", "Lombardo", "Longo", "Lopez", "Lorenzi", "Lorenzini", "Lorini", "Lotti", "Lu", "Lucchesi", "Lucherini", "Lunghi", "Lupi", "Madiai", "Maestrini", "Maffei", "Maggi", "Maggini", "Magherini", "Magini", "Magnani", "Magnelli", "Magni", "Magnolfi", "Magrini", "Malavolti", "Malevolti", "Manca", "Mancini", "Manetti", "Manfredi", "Mangani", "Mannelli", "Manni", "Mannini", "Mannucci", "Manuelli", "Manzini", "Marcelli", "Marchese", "Marchetti", "Marchi", "Marchiani", "Marchionni", "Marconi", "Marcucci", "Margheri", "Mari", "Mariani", "Marilli", "Marinai", "Marinari", "Marinelli", "Marini", "Marino", "Mariotti", "Marsili", "Martelli", "Martinelli", "Martini", "Martino", "Marzi", "Masi", "Masini", "Masoni", "Massai", "Materassi", "Mattei", "Matteini", "Matteucci", "Matteuzzi", "Mattioli", "Mattolini", "Matucci", "Mauro", "Mazzanti", "Mazzei", "Mazzetti", "Mazzi", "Mazzini", "Mazzocchi", "Mazzoli", "Mazzoni", "Mazzuoli", "Meacci", "Mecocci", "Meini", "Melani", "Mele", "Meli", "Mengoni", "Menichetti", "Meoni", "Merlini", "Messeri", "Messina", "Meucci", "Miccinesi", "Miceli", "Micheli", "Michelini", "Michelozzi", "Migliori", "Migliorini", "Milani", "Miniati", "Misuri", "Monaco", "Montagnani", "Montagni", "Montanari", "Montelatici", "Monti", "Montigiani", "Montini", "Morandi", "Morandini", "Morelli", "Moretti", "Morganti", "Mori", "Morini", "Moroni", "Morozzi", "Mugnai", "Mugnaini", "Mustafa", "Naldi", "Naldini", "Nannelli", "Nanni", "Nannini", "Nannucci", "Nardi", "Nardini", "Nardoni", "Natali", "Ndiaye", "Nencetti", "Nencini", "Nencioni", "Neri", "Nesi", "Nesti", "Niccolai", "Niccoli", "Niccolini", "Nigi", "Nistri", "Nocentini", "Noferini", "Novelli", "Nucci", "Nuti", "Nutini", "Oliva", "Olivieri", "Olmi", "Orlandi", "Orlandini", "Orlando", "Orsini", "Ortolani", "Ottanelli", "Pacciani", "Pace", "Paci", "Pacini", "Pagani", "Pagano", "Paggetti", "Pagliai", "Pagni", "Pagnini", "Paladini", "Palagi", "Palchetti", "Palloni", "Palmieri", "Palumbo", "Pampaloni", "Pancani", "Pandolfi", "Pandolfini", "Panerai", "Panichi", "Paoletti", "Paoli", "Paolini", "Papi", "Papini", "Papucci", "Parenti", "Parigi", "Parisi", "Parri", "Parrini", "Pasquini", "Passeri", "Pecchioli", "Pecorini", "Pellegrini", "Pepi", "Perini", "Perrone", "Peruzzi", "Pesci", "Pestelli", "Petri", "Petrini", "Petrucci", "Pettini", "Pezzati", "Pezzatini", "Piani", "Piazza", "Piazzesi", "Piazzini", "Piccardi", "Picchi", "Piccini", "Piccioli", "Pieraccini", "Pieraccioni", "Pieralli", "Pierattini", "Pieri", "Pierini", "Pieroni", "Pietrini", "Pini", "Pinna", "Pinto", "Pinzani", "Pinzauti", "Piras", "Pisani", "Pistolesi", "Poggesi", "Poggi", "Poggiali", "Poggiolini", "Poli", "Pollastri", "Porciani", "Pozzi", "Pratellesi", "Pratesi", "Prosperi", "Pruneti", "Pucci", "Puccini", "Puccioni", "Pugi", "Pugliese", "Puliti", "Querci", "Quercioli", "Raddi", "Radu", "Raffaelli", "Ragazzini", "Ranfagni", "Ranieri", "Rastrelli", "Raugei", "Raveggi", "Renai", "Renzi", "Rettori", "Ricci", "Ricciardi", "Ridi", "Ridolfi", "Rigacci", "Righi", "Righini", "Rinaldi", "Risaliti", "Ristori", "Rizzo", "Rocchi", "Rocchini", "Rogai", "Romagnoli", "Romanelli", "Romani", "Romano", "Romei", "Romeo", "Romiti", "Romoli", "Romolini", "Rontini", "Rosati", "Roselli", "Rosi", "Rossetti", "Rossi", "Rossini", "Rovai", "Ruggeri", "Ruggiero", "Russo", "Sabatini", "Saccardi", "Sacchetti", "Sacchi", "Sacco", "Salerno", "Salimbeni", "Salucci", "Salvadori", "Salvestrini", "Salvi", "Salvini", "Sanesi", "Sani", "Sanna", "Santi", "Santini", "Santoni", "Santoro", "Santucci", "Sardi", "Sarri", "Sarti", "Sassi", "Sbolci", "Scali", "Scarpelli", "Scarselli", "Scopetani", "Secci", "Selvi", "Senatori", "Senesi", "Serafini", "Sereni", "Serra", "Sestini", "Sguanci", "Sieni", "Signorini", "Silvestri", "Simoncini", "Simonetti", "Simoni", "Singh", "Sodi", "Soldi", "Somigli", "Sorbi", "Sorelli", "Sorrentino", "Sottili", "Spina", "Spinelli", "Staccioli", "Staderini", "Stefanelli", "Stefani", "Stefanini", "Stella", "Susini", "Tacchi", "Tacconi", "Taddei", "Tagliaferri", "Tamburini", "Tanganelli", "Tani", "Tanini", "Tapinassi", "Tarchi", "Tarchiani", "Targioni", "Tassi", "Tassini", "Tempesti", "Terzani", "Tesi", "Testa", "Testi", "Tilli", "Tinti", "Tirinnanzi", "Toccafondi", "Tofanari", "Tofani", "Tognaccini", "Tonelli", "Tonini", "Torelli", "Torrini", "Tosi", "Toti", "Tozzi", "Trambusti", "Trapani", "Tucci", "Turchi", "Ugolini", "Ulivi", "Valente", "Valenti", "Valentini", "Vangelisti", "Vanni", "Vannini", "Vannoni", "Vannozzi", "Vannucchi", "Vannucci", "Ventura", "Venturi", "Venturini", "Vestri", "Vettori", "Vichi", "Viciani", "Vieri", "Vigiani", "Vignoli", "Vignolini", "Vignozzi", "Villani", "Vinci", "Visani", "Vitale", "Vitali", "Viti", "Viviani", "Vivoli", "Volpe", "Volpi", "Wang", "Wu", "Xu", "Yang", "Ye", "Zagli", "Zani", "Zanieri", "Zanobini", "Zecchi", "Zetti", "Zhang", "Zheng", "Zhou", "Zhu", "Zingoni", "Zini", "Zoppi"]
2287 },
2288
2289 // Data taken from https://github.com/umpirsky/country-list/blob/master/data/en_US/country.json
2290 countries: [{"name":"Afghanistan","abbreviation":"AF"},{"name":"Åland Islands","abbreviation":"AX"},{"name":"Albania","abbreviation":"AL"},{"name":"Algeria","abbreviation":"DZ"},{"name":"American Samoa","abbreviation":"AS"},{"name":"Andorra","abbreviation":"AD"},{"name":"Angola","abbreviation":"AO"},{"name":"Anguilla","abbreviation":"AI"},{"name":"Antarctica","abbreviation":"AQ"},{"name":"Antigua & Barbuda","abbreviation":"AG"},{"name":"Argentina","abbreviation":"AR"},{"name":"Armenia","abbreviation":"AM"},{"name":"Aruba","abbreviation":"AW"},{"name":"Ascension Island","abbreviation":"AC"},{"name":"Australia","abbreviation":"AU"},{"name":"Austria","abbreviation":"AT"},{"name":"Azerbaijan","abbreviation":"AZ"},{"name":"Bahamas","abbreviation":"BS"},{"name":"Bahrain","abbreviation":"BH"},{"name":"Bangladesh","abbreviation":"BD"},{"name":"Barbados","abbreviation":"BB"},{"name":"Belarus","abbreviation":"BY"},{"name":"Belgium","abbreviation":"BE"},{"name":"Belize","abbreviation":"BZ"},{"name":"Benin","abbreviation":"BJ"},{"name":"Bermuda","abbreviation":"BM"},{"name":"Bhutan","abbreviation":"BT"},{"name":"Bolivia","abbreviation":"BO"},{"name":"Bosnia & Herzegovina","abbreviation":"BA"},{"name":"Botswana","abbreviation":"BW"},{"name":"Brazil","abbreviation":"BR"},{"name":"British Indian Ocean Territory","abbreviation":"IO"},{"name":"British Virgin Islands","abbreviation":"VG"},{"name":"Brunei","abbreviation":"BN"},{"name":"Bulgaria","abbreviation":"BG"},{"name":"Burkina Faso","abbreviation":"BF"},{"name":"Burundi","abbreviation":"BI"},{"name":"Cambodia","abbreviation":"KH"},{"name":"Cameroon","abbreviation":"CM"},{"name":"Canada","abbreviation":"CA"},{"name":"Canary Islands","abbreviation":"IC"},{"name":"Cape Verde","abbreviation":"CV"},{"name":"Caribbean Netherlands","abbreviation":"BQ"},{"name":"Cayman Islands","abbreviation":"KY"},{"name":"Central African Republic","abbreviation":"CF"},{"name":"Ceuta & Melilla","abbreviation":"EA"},{"name":"Chad","abbreviation":"TD"},{"name":"Chile","abbreviation":"CL"},{"name":"China","abbreviation":"CN"},{"name":"Christmas Island","abbreviation":"CX"},{"name":"Cocos (Keeling) Islands","abbreviation":"CC"},{"name":"Colombia","abbreviation":"CO"},{"name":"Comoros","abbreviation":"KM"},{"name":"Congo - Brazzaville","abbreviation":"CG"},{"name":"Congo - Kinshasa","abbreviation":"CD"},{"name":"Cook Islands","abbreviation":"CK"},{"name":"Costa Rica","abbreviation":"CR"},{"name":"Côte d'Ivoire","abbreviation":"CI"},{"name":"Croatia","abbreviation":"HR"},{"name":"Cuba","abbreviation":"CU"},{"name":"Curaçao","abbreviation":"CW"},{"name":"Cyprus","abbreviation":"CY"},{"name":"Czech Republic","abbreviation":"CZ"},{"name":"Denmark","abbreviation":"DK"},{"name":"Diego Garcia","abbreviation":"DG"},{"name":"Djibouti","abbreviation":"DJ"},{"name":"Dominica","abbreviation":"DM"},{"name":"Dominican Republic","abbreviation":"DO"},{"name":"Ecuador","abbreviation":"EC"},{"name":"Egypt","abbreviation":"EG"},{"name":"El Salvador","abbreviation":"SV"},{"name":"Equatorial Guinea","abbreviation":"GQ"},{"name":"Eritrea","abbreviation":"ER"},{"name":"Estonia","abbreviation":"EE"},{"name":"Ethiopia","abbreviation":"ET"},{"name":"Falkland Islands","abbreviation":"FK"},{"name":"Faroe Islands","abbreviation":"FO"},{"name":"Fiji","abbreviation":"FJ"},{"name":"Finland","abbreviation":"FI"},{"name":"France","abbreviation":"FR"},{"name":"French Guiana","abbreviation":"GF"},{"name":"French Polynesia","abbreviation":"PF"},{"name":"French Southern Territories","abbreviation":"TF"},{"name":"Gabon","abbreviation":"GA"},{"name":"Gambia","abbreviation":"GM"},{"name":"Georgia","abbreviation":"GE"},{"name":"Germany","abbreviation":"DE"},{"name":"Ghana","abbreviation":"GH"},{"name":"Gibraltar","abbreviation":"GI"},{"name":"Greece","abbreviation":"GR"},{"name":"Greenland","abbreviation":"GL"},{"name":"Grenada","abbreviation":"GD"},{"name":"Guadeloupe","abbreviation":"GP"},{"name":"Guam","abbreviation":"GU"},{"name":"Guatemala","abbreviation":"GT"},{"name":"Guernsey","abbreviation":"GG"},{"name":"Guinea","abbreviation":"GN"},{"name":"Guinea-Bissau","abbreviation":"GW"},{"name":"Guyana","abbreviation":"GY"},{"name":"Haiti","abbreviation":"HT"},{"name":"Honduras","abbreviation":"HN"},{"name":"Hong Kong SAR China","abbreviation":"HK"},{"name":"Hungary","abbreviation":"HU"},{"name":"Iceland","abbreviation":"IS"},{"name":"India","abbreviation":"IN"},{"name":"Indonesia","abbreviation":"ID"},{"name":"Iran","abbreviation":"IR"},{"name":"Iraq","abbreviation":"IQ"},{"name":"Ireland","abbreviation":"IE"},{"name":"Isle of Man","abbreviation":"IM"},{"name":"Israel","abbreviation":"IL"},{"name":"Italy","abbreviation":"IT"},{"name":"Jamaica","abbreviation":"JM"},{"name":"Japan","abbreviation":"JP"},{"name":"Jersey","abbreviation":"JE"},{"name":"Jordan","abbreviation":"JO"},{"name":"Kazakhstan","abbreviation":"KZ"},{"name":"Kenya","abbreviation":"KE"},{"name":"Kiribati","abbreviation":"KI"},{"name":"Kosovo","abbreviation":"XK"},{"name":"Kuwait","abbreviation":"KW"},{"name":"Kyrgyzstan","abbreviation":"KG"},{"name":"Laos","abbreviation":"LA"},{"name":"Latvia","abbreviation":"LV"},{"name":"Lebanon","abbreviation":"LB"},{"name":"Lesotho","abbreviation":"LS"},{"name":"Liberia","abbreviation":"LR"},{"name":"Libya","abbreviation":"LY"},{"name":"Liechtenstein","abbreviation":"LI"},{"name":"Lithuania","abbreviation":"LT"},{"name":"Luxembourg","abbreviation":"LU"},{"name":"Macau SAR China","abbreviation":"MO"},{"name":"Macedonia","abbreviation":"MK"},{"name":"Madagascar","abbreviation":"MG"},{"name":"Malawi","abbreviation":"MW"},{"name":"Malaysia","abbreviation":"MY"},{"name":"Maldives","abbreviation":"MV"},{"name":"Mali","abbreviation":"ML"},{"name":"Malta","abbreviation":"MT"},{"name":"Marshall Islands","abbreviation":"MH"},{"name":"Martinique","abbreviation":"MQ"},{"name":"Mauritania","abbreviation":"MR"},{"name":"Mauritius","abbreviation":"MU"},{"name":"Mayotte","abbreviation":"YT"},{"name":"Mexico","abbreviation":"MX"},{"name":"Micronesia","abbreviation":"FM"},{"name":"Moldova","abbreviation":"MD"},{"name":"Monaco","abbreviation":"MC"},{"name":"Mongolia","abbreviation":"MN"},{"name":"Montenegro","abbreviation":"ME"},{"name":"Montserrat","abbreviation":"MS"},{"name":"Morocco","abbreviation":"MA"},{"name":"Mozambique","abbreviation":"MZ"},{"name":"Myanmar (Burma)","abbreviation":"MM"},{"name":"Namibia","abbreviation":"NA"},{"name":"Nauru","abbreviation":"NR"},{"name":"Nepal","abbreviation":"NP"},{"name":"Netherlands","abbreviation":"NL"},{"name":"New Caledonia","abbreviation":"NC"},{"name":"New Zealand","abbreviation":"NZ"},{"name":"Nicaragua","abbreviation":"NI"},{"name":"Niger","abbreviation":"NE"},{"name":"Nigeria","abbreviation":"NG"},{"name":"Niue","abbreviation":"NU"},{"name":"Norfolk Island","abbreviation":"NF"},{"name":"North Korea","abbreviation":"KP"},{"name":"Northern Mariana Islands","abbreviation":"MP"},{"name":"Norway","abbreviation":"NO"},{"name":"Oman","abbreviation":"OM"},{"name":"Pakistan","abbreviation":"PK"},{"name":"Palau","abbreviation":"PW"},{"name":"Palestinian Territories","abbreviation":"PS"},{"name":"Panama","abbreviation":"PA"},{"name":"Papua New Guinea","abbreviation":"PG"},{"name":"Paraguay","abbreviation":"PY"},{"name":"Peru","abbreviation":"PE"},{"name":"Philippines","abbreviation":"PH"},{"name":"Pitcairn Islands","abbreviation":"PN"},{"name":"Poland","abbreviation":"PL"},{"name":"Portugal","abbreviation":"PT"},{"name":"Puerto Rico","abbreviation":"PR"},{"name":"Qatar","abbreviation":"QA"},{"name":"Réunion","abbreviation":"RE"},{"name":"Romania","abbreviation":"RO"},{"name":"Russia","abbreviation":"RU"},{"name":"Rwanda","abbreviation":"RW"},{"name":"Samoa","abbreviation":"WS"},{"name":"San Marino","abbreviation":"SM"},{"name":"São Tomé and Príncipe","abbreviation":"ST"},{"name":"Saudi Arabia","abbreviation":"SA"},{"name":"Senegal","abbreviation":"SN"},{"name":"Serbia","abbreviation":"RS"},{"name":"Seychelles","abbreviation":"SC"},{"name":"Sierra Leone","abbreviation":"SL"},{"name":"Singapore","abbreviation":"SG"},{"name":"Sint Maarten","abbreviation":"SX"},{"name":"Slovakia","abbreviation":"SK"},{"name":"Slovenia","abbreviation":"SI"},{"name":"Solomon Islands","abbreviation":"SB"},{"name":"Somalia","abbreviation":"SO"},{"name":"South Africa","abbreviation":"ZA"},{"name":"South Georgia & South Sandwich Islands","abbreviation":"GS"},{"name":"South Korea","abbreviation":"KR"},{"name":"South Sudan","abbreviation":"SS"},{"name":"Spain","abbreviation":"ES"},{"name":"Sri Lanka","abbreviation":"LK"},{"name":"St. Barthélemy","abbreviation":"BL"},{"name":"St. Helena","abbreviation":"SH"},{"name":"St. Kitts & Nevis","abbreviation":"KN"},{"name":"St. Lucia","abbreviation":"LC"},{"name":"St. Martin","abbreviation":"MF"},{"name":"St. Pierre & Miquelon","abbreviation":"PM"},{"name":"St. Vincent & Grenadines","abbreviation":"VC"},{"name":"Sudan","abbreviation":"SD"},{"name":"Suriname","abbreviation":"SR"},{"name":"Svalbard & Jan Mayen","abbreviation":"SJ"},{"name":"Swaziland","abbreviation":"SZ"},{"name":"Sweden","abbreviation":"SE"},{"name":"Switzerland","abbreviation":"CH"},{"name":"Syria","abbreviation":"SY"},{"name":"Taiwan","abbreviation":"TW"},{"name":"Tajikistan","abbreviation":"TJ"},{"name":"Tanzania","abbreviation":"TZ"},{"name":"Thailand","abbreviation":"TH"},{"name":"Timor-Leste","abbreviation":"TL"},{"name":"Togo","abbreviation":"TG"},{"name":"Tokelau","abbreviation":"TK"},{"name":"Tonga","abbreviation":"TO"},{"name":"Trinidad & Tobago","abbreviation":"TT"},{"name":"Tristan da Cunha","abbreviation":"TA"},{"name":"Tunisia","abbreviation":"TN"},{"name":"Turkey","abbreviation":"TR"},{"name":"Turkmenistan","abbreviation":"TM"},{"name":"Turks & Caicos Islands","abbreviation":"TC"},{"name":"Tuvalu","abbreviation":"TV"},{"name":"U.S. Outlying Islands","abbreviation":"UM"},{"name":"U.S. Virgin Islands","abbreviation":"VI"},{"name":"Uganda","abbreviation":"UG"},{"name":"Ukraine","abbreviation":"UA"},{"name":"United Arab Emirates","abbreviation":"AE"},{"name":"United Kingdom","abbreviation":"GB"},{"name":"United States","abbreviation":"US"},{"name":"Uruguay","abbreviation":"UY"},{"name":"Uzbekistan","abbreviation":"UZ"},{"name":"Vanuatu","abbreviation":"VU"},{"name":"Vatican City","abbreviation":"VA"},{"name":"Venezuela","abbreviation":"VE"},{"name":"Vietnam","abbreviation":"VN"},{"name":"Wallis & Futuna","abbreviation":"WF"},{"name":"Western Sahara","abbreviation":"EH"},{"name":"Yemen","abbreviation":"YE"},{"name":"Zambia","abbreviation":"ZM"},{"name":"Zimbabwe","abbreviation":"ZW"}],
2291
2292 counties: {
2293 // Data taken from http://www.downloadexcelfiles.com/gb_en/download-excel-file-list-counties-uk
2294 "uk": [
2295 {name: 'Bath and North East Somerset'},
2296 {name: 'Aberdeenshire'},
2297 {name: 'Anglesey'},
2298 {name: 'Angus'},
2299 {name: 'Bedford'},
2300 {name: 'Blackburn with Darwen'},
2301 {name: 'Blackpool'},
2302 {name: 'Bournemouth'},
2303 {name: 'Bracknell Forest'},
2304 {name: 'Brighton & Hove'},
2305 {name: 'Bristol'},
2306 {name: 'Buckinghamshire'},
2307 {name: 'Cambridgeshire'},
2308 {name: 'Carmarthenshire'},
2309 {name: 'Central Bedfordshire'},
2310 {name: 'Ceredigion'},
2311 {name: 'Cheshire East'},
2312 {name: 'Cheshire West and Chester'},
2313 {name: 'Clackmannanshire'},
2314 {name: 'Conwy'},
2315 {name: 'Cornwall'},
2316 {name: 'County Antrim'},
2317 {name: 'County Armagh'},
2318 {name: 'County Down'},
2319 {name: 'County Durham'},
2320 {name: 'County Fermanagh'},
2321 {name: 'County Londonderry'},
2322 {name: 'County Tyrone'},
2323 {name: 'Cumbria'},
2324 {name: 'Darlington'},
2325 {name: 'Denbighshire'},
2326 {name: 'Derby'},
2327 {name: 'Derbyshire'},
2328 {name: 'Devon'},
2329 {name: 'Dorset'},
2330 {name: 'Dumfries and Galloway'},
2331 {name: 'Dundee'},
2332 {name: 'East Lothian'},
2333 {name: 'East Riding of Yorkshire'},
2334 {name: 'East Sussex'},
2335 {name: 'Edinburgh?'},
2336 {name: 'Essex'},
2337 {name: 'Falkirk'},
2338 {name: 'Fife'},
2339 {name: 'Flintshire'},
2340 {name: 'Gloucestershire'},
2341 {name: 'Greater London'},
2342 {name: 'Greater Manchester'},
2343 {name: 'Gwent'},
2344 {name: 'Gwynedd'},
2345 {name: 'Halton'},
2346 {name: 'Hampshire'},
2347 {name: 'Hartlepool'},
2348 {name: 'Herefordshire'},
2349 {name: 'Hertfordshire'},
2350 {name: 'Highlands'},
2351 {name: 'Hull'},
2352 {name: 'Isle of Wight'},
2353 {name: 'Isles of Scilly'},
2354 {name: 'Kent'},
2355 {name: 'Lancashire'},
2356 {name: 'Leicester'},
2357 {name: 'Leicestershire'},
2358 {name: 'Lincolnshire'},
2359 {name: 'Lothian'},
2360 {name: 'Luton'},
2361 {name: 'Medway'},
2362 {name: 'Merseyside'},
2363 {name: 'Mid Glamorgan'},
2364 {name: 'Middlesbrough'},
2365 {name: 'Milton Keynes'},
2366 {name: 'Monmouthshire'},
2367 {name: 'Moray'},
2368 {name: 'Norfolk'},
2369 {name: 'North East Lincolnshire'},
2370 {name: 'North Lincolnshire'},
2371 {name: 'North Somerset'},
2372 {name: 'North Yorkshire'},
2373 {name: 'Northamptonshire'},
2374 {name: 'Northumberland'},
2375 {name: 'Nottingham'},
2376 {name: 'Nottinghamshire'},
2377 {name: 'Oxfordshire'},
2378 {name: 'Pembrokeshire'},
2379 {name: 'Perth and Kinross'},
2380 {name: 'Peterborough'},
2381 {name: 'Plymouth'},
2382 {name: 'Poole'},
2383 {name: 'Portsmouth'},
2384 {name: 'Powys'},
2385 {name: 'Reading'},
2386 {name: 'Redcar and Cleveland'},
2387 {name: 'Rutland'},
2388 {name: 'Scottish Borders'},
2389 {name: 'Shropshire'},
2390 {name: 'Slough'},
2391 {name: 'Somerset'},
2392 {name: 'South Glamorgan'},
2393 {name: 'South Gloucestershire'},
2394 {name: 'South Yorkshire'},
2395 {name: 'Southampton'},
2396 {name: 'Southend-on-Sea'},
2397 {name: 'Staffordshire'},
2398 {name: 'Stirlingshire'},
2399 {name: 'Stockton-on-Tees'},
2400 {name: 'Stoke-on-Trent'},
2401 {name: 'Strathclyde'},
2402 {name: 'Suffolk'},
2403 {name: 'Surrey'},
2404 {name: 'Swindon'},
2405 {name: 'Telford and Wrekin'},
2406 {name: 'Thurrock'},
2407 {name: 'Torbay'},
2408 {name: 'Tyne and Wear'},
2409 {name: 'Warrington'},
2410 {name: 'Warwickshire'},
2411 {name: 'West Berkshire'},
2412 {name: 'West Glamorgan'},
2413 {name: 'West Lothian'},
2414 {name: 'West Midlands'},
2415 {name: 'West Sussex'},
2416 {name: 'West Yorkshire'},
2417 {name: 'Western Isles'},
2418 {name: 'Wiltshire'},
2419 {name: 'Windsor and Maidenhead'},
2420 {name: 'Wokingham'},
2421 {name: 'Worcestershire'},
2422 {name: 'Wrexham'},
2423 {name: 'York'}]
2424 },
2425 provinces: {
2426 "ca": [
2427 {name: 'Alberta', abbreviation: 'AB'},
2428 {name: 'British Columbia', abbreviation: 'BC'},
2429 {name: 'Manitoba', abbreviation: 'MB'},
2430 {name: 'New Brunswick', abbreviation: 'NB'},
2431 {name: 'Newfoundland and Labrador', abbreviation: 'NL'},
2432 {name: 'Nova Scotia', abbreviation: 'NS'},
2433 {name: 'Ontario', abbreviation: 'ON'},
2434 {name: 'Prince Edward Island', abbreviation: 'PE'},
2435 {name: 'Quebec', abbreviation: 'QC'},
2436 {name: 'Saskatchewan', abbreviation: 'SK'},
2437
2438 // The case could be made that the following are not actually provinces
2439 // since they are technically considered "territories" however they all
2440 // look the same on an envelope!
2441 {name: 'Northwest Territories', abbreviation: 'NT'},
2442 {name: 'Nunavut', abbreviation: 'NU'},
2443 {name: 'Yukon', abbreviation: 'YT'}
2444 ],
2445 "it": [
2446 { name: "Agrigento", abbreviation: "AG", code: 84 },
2447 { name: "Alessandria", abbreviation: "AL", code: 6 },
2448 { name: "Ancona", abbreviation: "AN", code: 42 },
2449 { name: "Aosta", abbreviation: "AO", code: 7 },
2450 { name: "L'Aquila", abbreviation: "AQ", code: 66 },
2451 { name: "Arezzo", abbreviation: "AR", code: 51 },
2452 { name: "Ascoli-Piceno", abbreviation: "AP", code: 44 },
2453 { name: "Asti", abbreviation: "AT", code: 5 },
2454 { name: "Avellino", abbreviation: "AV", code: 64 },
2455 { name: "Bari", abbreviation: "BA", code: 72 },
2456 { name: "Barletta-Andria-Trani", abbreviation: "BT", code: 72 },
2457 { name: "Belluno", abbreviation: "BL", code: 25 },
2458 { name: "Benevento", abbreviation: "BN", code: 62 },
2459 { name: "Bergamo", abbreviation: "BG", code: 16 },
2460 { name: "Biella", abbreviation: "BI", code: 96 },
2461 { name: "Bologna", abbreviation: "BO", code: 37 },
2462 { name: "Bolzano", abbreviation: "BZ", code: 21 },
2463 { name: "Brescia", abbreviation: "BS", code: 17 },
2464 { name: "Brindisi", abbreviation: "BR", code: 74 },
2465 { name: "Cagliari", abbreviation: "CA", code: 92 },
2466 { name: "Caltanissetta", abbreviation: "CL", code: 85 },
2467 { name: "Campobasso", abbreviation: "CB", code: 70 },
2468 { name: "Carbonia Iglesias", abbreviation: "CI", code: 70 },
2469 { name: "Caserta", abbreviation: "CE", code: 61 },
2470 { name: "Catania", abbreviation: "CT", code: 87 },
2471 { name: "Catanzaro", abbreviation: "CZ", code: 79 },
2472 { name: "Chieti", abbreviation: "CH", code: 69 },
2473 { name: "Como", abbreviation: "CO", code: 13 },
2474 { name: "Cosenza", abbreviation: "CS", code: 78 },
2475 { name: "Cremona", abbreviation: "CR", code: 19 },
2476 { name: "Crotone", abbreviation: "KR", code: 101 },
2477 { name: "Cuneo", abbreviation: "CN", code: 4 },
2478 { name: "Enna", abbreviation: "EN", code: 86 },
2479 { name: "Fermo", abbreviation: "FM", code: 86 },
2480 { name: "Ferrara", abbreviation: "FE", code: 38 },
2481 { name: "Firenze", abbreviation: "FI", code: 48 },
2482 { name: "Foggia", abbreviation: "FG", code: 71 },
2483 { name: "Forli-Cesena", abbreviation: "FC", code: 71 },
2484 { name: "Frosinone", abbreviation: "FR", code: 60 },
2485 { name: "Genova", abbreviation: "GE", code: 10 },
2486 { name: "Gorizia", abbreviation: "GO", code: 31 },
2487 { name: "Grosseto", abbreviation: "GR", code: 53 },
2488 { name: "Imperia", abbreviation: "IM", code: 8 },
2489 { name: "Isernia", abbreviation: "IS", code: 94 },
2490 { name: "La-Spezia", abbreviation: "SP", code: 66 },
2491 { name: "Latina", abbreviation: "LT", code: 59 },
2492 { name: "Lecce", abbreviation: "LE", code: 75 },
2493 { name: "Lecco", abbreviation: "LC", code: 97 },
2494 { name: "Livorno", abbreviation: "LI", code: 49 },
2495 { name: "Lodi", abbreviation: "LO", code: 98 },
2496 { name: "Lucca", abbreviation: "LU", code: 46 },
2497 { name: "Macerata", abbreviation: "MC", code: 43 },
2498 { name: "Mantova", abbreviation: "MN", code: 20 },
2499 { name: "Massa-Carrara", abbreviation: "MS", code: 45 },
2500 { name: "Matera", abbreviation: "MT", code: 77 },
2501 { name: "Medio Campidano", abbreviation: "VS", code: 77 },
2502 { name: "Messina", abbreviation: "ME", code: 83 },
2503 { name: "Milano", abbreviation: "MI", code: 15 },
2504 { name: "Modena", abbreviation: "MO", code: 36 },
2505 { name: "Monza-Brianza", abbreviation: "MB", code: 36 },
2506 { name: "Napoli", abbreviation: "NA", code: 63 },
2507 { name: "Novara", abbreviation: "NO", code: 3 },
2508 { name: "Nuoro", abbreviation: "NU", code: 91 },
2509 { name: "Ogliastra", abbreviation: "OG", code: 91 },
2510 { name: "Olbia Tempio", abbreviation: "OT", code: 91 },
2511 { name: "Oristano", abbreviation: "OR", code: 95 },
2512 { name: "Padova", abbreviation: "PD", code: 28 },
2513 { name: "Palermo", abbreviation: "PA", code: 82 },
2514 { name: "Parma", abbreviation: "PR", code: 34 },
2515 { name: "Pavia", abbreviation: "PV", code: 18 },
2516 { name: "Perugia", abbreviation: "PG", code: 54 },
2517 { name: "Pesaro-Urbino", abbreviation: "PU", code: 41 },
2518 { name: "Pescara", abbreviation: "PE", code: 68 },
2519 { name: "Piacenza", abbreviation: "PC", code: 33 },
2520 { name: "Pisa", abbreviation: "PI", code: 50 },
2521 { name: "Pistoia", abbreviation: "PT", code: 47 },
2522 { name: "Pordenone", abbreviation: "PN", code: 93 },
2523 { name: "Potenza", abbreviation: "PZ", code: 76 },
2524 { name: "Prato", abbreviation: "PO", code: 100 },
2525 { name: "Ragusa", abbreviation: "RG", code: 88 },
2526 { name: "Ravenna", abbreviation: "RA", code: 39 },
2527 { name: "Reggio-Calabria", abbreviation: "RC", code: 35 },
2528 { name: "Reggio-Emilia", abbreviation: "RE", code: 35 },
2529 { name: "Rieti", abbreviation: "RI", code: 57 },
2530 { name: "Rimini", abbreviation: "RN", code: 99 },
2531 { name: "Roma", abbreviation: "Roma", code: 58 },
2532 { name: "Rovigo", abbreviation: "RO", code: 29 },
2533 { name: "Salerno", abbreviation: "SA", code: 65 },
2534 { name: "Sassari", abbreviation: "SS", code: 90 },
2535 { name: "Savona", abbreviation: "SV", code: 9 },
2536 { name: "Siena", abbreviation: "SI", code: 52 },
2537 { name: "Siracusa", abbreviation: "SR", code: 89 },
2538 { name: "Sondrio", abbreviation: "SO", code: 14 },
2539 { name: "Taranto", abbreviation: "TA", code: 73 },
2540 { name: "Teramo", abbreviation: "TE", code: 67 },
2541 { name: "Terni", abbreviation: "TR", code: 55 },
2542 { name: "Torino", abbreviation: "TO", code: 1 },
2543 { name: "Trapani", abbreviation: "TP", code: 81 },
2544 { name: "Trento", abbreviation: "TN", code: 22 },
2545 { name: "Treviso", abbreviation: "TV", code: 26 },
2546 { name: "Trieste", abbreviation: "TS", code: 32 },
2547 { name: "Udine", abbreviation: "UD", code: 30 },
2548 { name: "Varese", abbreviation: "VA", code: 12 },
2549 { name: "Venezia", abbreviation: "VE", code: 27 },
2550 { name: "Verbania", abbreviation: "VB", code: 27 },
2551 { name: "Vercelli", abbreviation: "VC", code: 2 },
2552 { name: "Verona", abbreviation: "VR", code: 23 },
2553 { name: "Vibo-Valentia", abbreviation: "VV", code: 102 },
2554 { name: "Vicenza", abbreviation: "VI", code: 24 },
2555 { name: "Viterbo", abbreviation: "VT", code: 56 }
2556 ]
2557 },
2558
2559 // from: https://github.com/samsargent/Useful-Autocomplete-Data/blob/master/data/nationalities.json
2560 nationalities: [
2561 {name: 'Afghan'},
2562 {name: 'Albanian'},
2563 {name: 'Algerian'},
2564 {name: 'American'},
2565 {name: 'Andorran'},
2566 {name: 'Angolan'},
2567 {name: 'Antiguans'},
2568 {name: 'Argentinean'},
2569 {name: 'Armenian'},
2570 {name: 'Australian'},
2571 {name: 'Austrian'},
2572 {name: 'Azerbaijani'},
2573 {name: 'Bahami'},
2574 {name: 'Bahraini'},
2575 {name: 'Bangladeshi'},
2576 {name: 'Barbadian'},
2577 {name: 'Barbudans'},
2578 {name: 'Batswana'},
2579 {name: 'Belarusian'},
2580 {name: 'Belgian'},
2581 {name: 'Belizean'},
2582 {name: 'Beninese'},
2583 {name: 'Bhutanese'},
2584 {name: 'Bolivian'},
2585 {name: 'Bosnian'},
2586 {name: 'Brazilian'},
2587 {name: 'British'},
2588 {name: 'Bruneian'},
2589 {name: 'Bulgarian'},
2590 {name: 'Burkinabe'},
2591 {name: 'Burmese'},
2592 {name: 'Burundian'},
2593 {name: 'Cambodian'},
2594 {name: 'Cameroonian'},
2595 {name: 'Canadian'},
2596 {name: 'Cape Verdean'},
2597 {name: 'Central African'},
2598 {name: 'Chadian'},
2599 {name: 'Chilean'},
2600 {name: 'Chinese'},
2601 {name: 'Colombian'},
2602 {name: 'Comoran'},
2603 {name: 'Congolese'},
2604 {name: 'Costa Rican'},
2605 {name: 'Croatian'},
2606 {name: 'Cuban'},
2607 {name: 'Cypriot'},
2608 {name: 'Czech'},
2609 {name: 'Danish'},
2610 {name: 'Djibouti'},
2611 {name: 'Dominican'},
2612 {name: 'Dutch'},
2613 {name: 'East Timorese'},
2614 {name: 'Ecuadorean'},
2615 {name: 'Egyptian'},
2616 {name: 'Emirian'},
2617 {name: 'Equatorial Guinean'},
2618 {name: 'Eritrean'},
2619 {name: 'Estonian'},
2620 {name: 'Ethiopian'},
2621 {name: 'Fijian'},
2622 {name: 'Filipino'},
2623 {name: 'Finnish'},
2624 {name: 'French'},
2625 {name: 'Gabonese'},
2626 {name: 'Gambian'},
2627 {name: 'Georgian'},
2628 {name: 'German'},
2629 {name: 'Ghanaian'},
2630 {name: 'Greek'},
2631 {name: 'Grenadian'},
2632 {name: 'Guatemalan'},
2633 {name: 'Guinea-Bissauan'},
2634 {name: 'Guinean'},
2635 {name: 'Guyanese'},
2636 {name: 'Haitian'},
2637 {name: 'Herzegovinian'},
2638 {name: 'Honduran'},
2639 {name: 'Hungarian'},
2640 {name: 'I-Kiribati'},
2641 {name: 'Icelander'},
2642 {name: 'Indian'},
2643 {name: 'Indonesian'},
2644 {name: 'Iranian'},
2645 {name: 'Iraqi'},
2646 {name: 'Irish'},
2647 {name: 'Israeli'},
2648 {name: 'Italian'},
2649 {name: 'Ivorian'},
2650 {name: 'Jamaican'},
2651 {name: 'Japanese'},
2652 {name: 'Jordanian'},
2653 {name: 'Kazakhstani'},
2654 {name: 'Kenyan'},
2655 {name: 'Kittian and Nevisian'},
2656 {name: 'Kuwaiti'},
2657 {name: 'Kyrgyz'},
2658 {name: 'Laotian'},
2659 {name: 'Latvian'},
2660 {name: 'Lebanese'},
2661 {name: 'Liberian'},
2662 {name: 'Libyan'},
2663 {name: 'Liechtensteiner'},
2664 {name: 'Lithuanian'},
2665 {name: 'Luxembourger'},
2666 {name: 'Macedonian'},
2667 {name: 'Malagasy'},
2668 {name: 'Malawian'},
2669 {name: 'Malaysian'},
2670 {name: 'Maldivan'},
2671 {name: 'Malian'},
2672 {name: 'Maltese'},
2673 {name: 'Marshallese'},
2674 {name: 'Mauritanian'},
2675 {name: 'Mauritian'},
2676 {name: 'Mexican'},
2677 {name: 'Micronesian'},
2678 {name: 'Moldovan'},
2679 {name: 'Monacan'},
2680 {name: 'Mongolian'},
2681 {name: 'Moroccan'},
2682 {name: 'Mosotho'},
2683 {name: 'Motswana'},
2684 {name: 'Mozambican'},
2685 {name: 'Namibian'},
2686 {name: 'Nauruan'},
2687 {name: 'Nepalese'},
2688 {name: 'New Zealander'},
2689 {name: 'Nicaraguan'},
2690 {name: 'Nigerian'},
2691 {name: 'Nigerien'},
2692 {name: 'North Korean'},
2693 {name: 'Northern Irish'},
2694 {name: 'Norwegian'},
2695 {name: 'Omani'},
2696 {name: 'Pakistani'},
2697 {name: 'Palauan'},
2698 {name: 'Panamanian'},
2699 {name: 'Papua New Guinean'},
2700 {name: 'Paraguayan'},
2701 {name: 'Peruvian'},
2702 {name: 'Polish'},
2703 {name: 'Portuguese'},
2704 {name: 'Qatari'},
2705 {name: 'Romani'},
2706 {name: 'Russian'},
2707 {name: 'Rwandan'},
2708 {name: 'Saint Lucian'},
2709 {name: 'Salvadoran'},
2710 {name: 'Samoan'},
2711 {name: 'San Marinese'},
2712 {name: 'Sao Tomean'},
2713 {name: 'Saudi'},
2714 {name: 'Scottish'},
2715 {name: 'Senegalese'},
2716 {name: 'Serbian'},
2717 {name: 'Seychellois'},
2718 {name: 'Sierra Leonean'},
2719 {name: 'Singaporean'},
2720 {name: 'Slovakian'},
2721 {name: 'Slovenian'},
2722 {name: 'Solomon Islander'},
2723 {name: 'Somali'},
2724 {name: 'South African'},
2725 {name: 'South Korean'},
2726 {name: 'Spanish'},
2727 {name: 'Sri Lankan'},
2728 {name: 'Sudanese'},
2729 {name: 'Surinamer'},
2730 {name: 'Swazi'},
2731 {name: 'Swedish'},
2732 {name: 'Swiss'},
2733 {name: 'Syrian'},
2734 {name: 'Taiwanese'},
2735 {name: 'Tajik'},
2736 {name: 'Tanzanian'},
2737 {name: 'Thai'},
2738 {name: 'Togolese'},
2739 {name: 'Tongan'},
2740 {name: 'Trinidadian or Tobagonian'},
2741 {name: 'Tunisian'},
2742 {name: 'Turkish'},
2743 {name: 'Tuvaluan'},
2744 {name: 'Ugandan'},
2745 {name: 'Ukrainian'},
2746 {name: 'Uruguaya'},
2747 {name: 'Uzbekistani'},
2748 {name: 'Venezuela'},
2749 {name: 'Vietnamese'},
2750 {name: 'Wels'},
2751 {name: 'Yemenit'},
2752 {name: 'Zambia'},
2753 {name: 'Zimbabwe'},
2754 ],
2755
2756 us_states_and_dc: [
2757 {name: 'Alabama', abbreviation: 'AL'},
2758 {name: 'Alaska', abbreviation: 'AK'},
2759 {name: 'Arizona', abbreviation: 'AZ'},
2760 {name: 'Arkansas', abbreviation: 'AR'},
2761 {name: 'California', abbreviation: 'CA'},
2762 {name: 'Colorado', abbreviation: 'CO'},
2763 {name: 'Connecticut', abbreviation: 'CT'},
2764 {name: 'Delaware', abbreviation: 'DE'},
2765 {name: 'District of Columbia', abbreviation: 'DC'},
2766 {name: 'Florida', abbreviation: 'FL'},
2767 {name: 'Georgia', abbreviation: 'GA'},
2768 {name: 'Hawaii', abbreviation: 'HI'},
2769 {name: 'Idaho', abbreviation: 'ID'},
2770 {name: 'Illinois', abbreviation: 'IL'},
2771 {name: 'Indiana', abbreviation: 'IN'},
2772 {name: 'Iowa', abbreviation: 'IA'},
2773 {name: 'Kansas', abbreviation: 'KS'},
2774 {name: 'Kentucky', abbreviation: 'KY'},
2775 {name: 'Louisiana', abbreviation: 'LA'},
2776 {name: 'Maine', abbreviation: 'ME'},
2777 {name: 'Maryland', abbreviation: 'MD'},
2778 {name: 'Massachusetts', abbreviation: 'MA'},
2779 {name: 'Michigan', abbreviation: 'MI'},
2780 {name: 'Minnesota', abbreviation: 'MN'},
2781 {name: 'Mississippi', abbreviation: 'MS'},
2782 {name: 'Missouri', abbreviation: 'MO'},
2783 {name: 'Montana', abbreviation: 'MT'},
2784 {name: 'Nebraska', abbreviation: 'NE'},
2785 {name: 'Nevada', abbreviation: 'NV'},
2786 {name: 'New Hampshire', abbreviation: 'NH'},
2787 {name: 'New Jersey', abbreviation: 'NJ'},
2788 {name: 'New Mexico', abbreviation: 'NM'},
2789 {name: 'New York', abbreviation: 'NY'},
2790 {name: 'North Carolina', abbreviation: 'NC'},
2791 {name: 'North Dakota', abbreviation: 'ND'},
2792 {name: 'Ohio', abbreviation: 'OH'},
2793 {name: 'Oklahoma', abbreviation: 'OK'},
2794 {name: 'Oregon', abbreviation: 'OR'},
2795 {name: 'Pennsylvania', abbreviation: 'PA'},
2796 {name: 'Rhode Island', abbreviation: 'RI'},
2797 {name: 'South Carolina', abbreviation: 'SC'},
2798 {name: 'South Dakota', abbreviation: 'SD'},
2799 {name: 'Tennessee', abbreviation: 'TN'},
2800 {name: 'Texas', abbreviation: 'TX'},
2801 {name: 'Utah', abbreviation: 'UT'},
2802 {name: 'Vermont', abbreviation: 'VT'},
2803 {name: 'Virginia', abbreviation: 'VA'},
2804 {name: 'Washington', abbreviation: 'WA'},
2805 {name: 'West Virginia', abbreviation: 'WV'},
2806 {name: 'Wisconsin', abbreviation: 'WI'},
2807 {name: 'Wyoming', abbreviation: 'WY'}
2808 ],
2809
2810 territories: [
2811 {name: 'American Samoa', abbreviation: 'AS'},
2812 {name: 'Federated States of Micronesia', abbreviation: 'FM'},
2813 {name: 'Guam', abbreviation: 'GU'},
2814 {name: 'Marshall Islands', abbreviation: 'MH'},
2815 {name: 'Northern Mariana Islands', abbreviation: 'MP'},
2816 {name: 'Puerto Rico', abbreviation: 'PR'},
2817 {name: 'Virgin Islands, U.S.', abbreviation: 'VI'}
2818 ],
2819
2820 armed_forces: [
2821 {name: 'Armed Forces Europe', abbreviation: 'AE'},
2822 {name: 'Armed Forces Pacific', abbreviation: 'AP'},
2823 {name: 'Armed Forces the Americas', abbreviation: 'AA'}
2824 ],
2825
2826 country_regions: {
2827 it: [
2828 { name: "Valle d'Aosta", abbreviation: "VDA" },
2829 { name: "Piemonte", abbreviation: "PIE" },
2830 { name: "Lombardia", abbreviation: "LOM" },
2831 { name: "Veneto", abbreviation: "VEN" },
2832 { name: "Trentino Alto Adige", abbreviation: "TAA" },
2833 { name: "Friuli Venezia Giulia", abbreviation: "FVG" },
2834 { name: "Liguria", abbreviation: "LIG" },
2835 { name: "Emilia Romagna", abbreviation: "EMR" },
2836 { name: "Toscana", abbreviation: "TOS" },
2837 { name: "Umbria", abbreviation: "UMB" },
2838 { name: "Marche", abbreviation: "MAR" },
2839 { name: "Abruzzo", abbreviation: "ABR" },
2840 { name: "Lazio", abbreviation: "LAZ" },
2841 { name: "Campania", abbreviation: "CAM" },
2842 { name: "Puglia", abbreviation: "PUG" },
2843 { name: "Basilicata", abbreviation: "BAS" },
2844 { name: "Molise", abbreviation: "MOL" },
2845 { name: "Calabria", abbreviation: "CAL" },
2846 { name: "Sicilia", abbreviation: "SIC" },
2847 { name: "Sardegna", abbreviation: "SAR" }
2848 ]
2849 },
2850
2851 street_suffixes: {
2852 'us': [
2853 {name: 'Avenue', abbreviation: 'Ave'},
2854 {name: 'Boulevard', abbreviation: 'Blvd'},
2855 {name: 'Center', abbreviation: 'Ctr'},
2856 {name: 'Circle', abbreviation: 'Cir'},
2857 {name: 'Court', abbreviation: 'Ct'},
2858 {name: 'Drive', abbreviation: 'Dr'},
2859 {name: 'Extension', abbreviation: 'Ext'},
2860 {name: 'Glen', abbreviation: 'Gln'},
2861 {name: 'Grove', abbreviation: 'Grv'},
2862 {name: 'Heights', abbreviation: 'Hts'},
2863 {name: 'Highway', abbreviation: 'Hwy'},
2864 {name: 'Junction', abbreviation: 'Jct'},
2865 {name: 'Key', abbreviation: 'Key'},
2866 {name: 'Lane', abbreviation: 'Ln'},
2867 {name: 'Loop', abbreviation: 'Loop'},
2868 {name: 'Manor', abbreviation: 'Mnr'},
2869 {name: 'Mill', abbreviation: 'Mill'},
2870 {name: 'Park', abbreviation: 'Park'},
2871 {name: 'Parkway', abbreviation: 'Pkwy'},
2872 {name: 'Pass', abbreviation: 'Pass'},
2873 {name: 'Path', abbreviation: 'Path'},
2874 {name: 'Pike', abbreviation: 'Pike'},
2875 {name: 'Place', abbreviation: 'Pl'},
2876 {name: 'Plaza', abbreviation: 'Plz'},
2877 {name: 'Point', abbreviation: 'Pt'},
2878 {name: 'Ridge', abbreviation: 'Rdg'},
2879 {name: 'River', abbreviation: 'Riv'},
2880 {name: 'Road', abbreviation: 'Rd'},
2881 {name: 'Square', abbreviation: 'Sq'},
2882 {name: 'Street', abbreviation: 'St'},
2883 {name: 'Terrace', abbreviation: 'Ter'},
2884 {name: 'Trail', abbreviation: 'Trl'},
2885 {name: 'Turnpike', abbreviation: 'Tpke'},
2886 {name: 'View', abbreviation: 'Vw'},
2887 {name: 'Way', abbreviation: 'Way'}
2888 ],
2889 'it': [
2890 { name: 'Accesso', abbreviation: 'Acc.' },
2891 { name: 'Alzaia', abbreviation: 'Alz.' },
2892 { name: 'Arco', abbreviation: 'Arco' },
2893 { name: 'Archivolto', abbreviation: 'Acv.' },
2894 { name: 'Arena', abbreviation: 'Arena' },
2895 { name: 'Argine', abbreviation: 'Argine' },
2896 { name: 'Bacino', abbreviation: 'Bacino' },
2897 { name: 'Banchi', abbreviation: 'Banchi' },
2898 { name: 'Banchina', abbreviation: 'Ban.' },
2899 { name: 'Bastioni', abbreviation: 'Bas.' },
2900 { name: 'Belvedere', abbreviation: 'Belv.' },
2901 { name: 'Borgata', abbreviation: 'B.ta' },
2902 { name: 'Borgo', abbreviation: 'B.go' },
2903 { name: 'Calata', abbreviation: 'Cal.' },
2904 { name: 'Calle', abbreviation: 'Calle' },
2905 { name: 'Campiello', abbreviation: 'Cam.' },
2906 { name: 'Campo', abbreviation: 'Cam.' },
2907 { name: 'Canale', abbreviation: 'Can.' },
2908 { name: 'Carraia', abbreviation: 'Carr.' },
2909 { name: 'Cascina', abbreviation: 'Cascina' },
2910 { name: 'Case sparse', abbreviation: 'c.s.' },
2911 { name: 'Cavalcavia', abbreviation: 'Cv.' },
2912 { name: 'Circonvallazione', abbreviation: 'Cv.' },
2913 { name: 'Complanare', abbreviation: 'C.re' },
2914 { name: 'Contrada', abbreviation: 'C.da' },
2915 { name: 'Corso', abbreviation: 'C.so' },
2916 { name: 'Corte', abbreviation: 'C.te' },
2917 { name: 'Cortile', abbreviation: 'C.le' },
2918 { name: 'Diramazione', abbreviation: 'Dir.' },
2919 { name: 'Fondaco', abbreviation: 'F.co' },
2920 { name: 'Fondamenta', abbreviation: 'F.ta' },
2921 { name: 'Fondo', abbreviation: 'F.do' },
2922 { name: 'Frazione', abbreviation: 'Fr.' },
2923 { name: 'Isola', abbreviation: 'Is.' },
2924 { name: 'Largo', abbreviation: 'L.go' },
2925 { name: 'Litoranea', abbreviation: 'Lit.' },
2926 { name: 'Lungolago', abbreviation: 'L.go lago' },
2927 { name: 'Lungo Po', abbreviation: 'l.go Po' },
2928 { name: 'Molo', abbreviation: 'Molo' },
2929 { name: 'Mura', abbreviation: 'Mura' },
2930 { name: 'Passaggio privato', abbreviation: 'pass. priv.' },
2931 { name: 'Passeggiata', abbreviation: 'Pass.' },
2932 { name: 'Piazza', abbreviation: 'P.zza' },
2933 { name: 'Piazzale', abbreviation: 'P.le' },
2934 { name: 'Ponte', abbreviation: 'P.te' },
2935 { name: 'Portico', abbreviation: 'P.co' },
2936 { name: 'Rampa', abbreviation: 'Rampa' },
2937 { name: 'Regione', abbreviation: 'Reg.' },
2938 { name: 'Rione', abbreviation: 'R.ne' },
2939 { name: 'Rio', abbreviation: 'Rio' },
2940 { name: 'Ripa', abbreviation: 'Ripa' },
2941 { name: 'Riva', abbreviation: 'Riva' },
2942 { name: 'Rondò', abbreviation: 'Rondò' },
2943 { name: 'Rotonda', abbreviation: 'Rot.' },
2944 { name: 'Sagrato', abbreviation: 'Sagr.' },
2945 { name: 'Salita', abbreviation: 'Sal.' },
2946 { name: 'Scalinata', abbreviation: 'Scal.' },
2947 { name: 'Scalone', abbreviation: 'Scal.' },
2948 { name: 'Slargo', abbreviation: 'Sl.' },
2949 { name: 'Sottoportico', abbreviation: 'Sott.' },
2950 { name: 'Strada', abbreviation: 'Str.' },
2951 { name: 'Stradale', abbreviation: 'Str.le' },
2952 { name: 'Strettoia', abbreviation: 'Strett.' },
2953 { name: 'Traversa', abbreviation: 'Trav.' },
2954 { name: 'Via', abbreviation: 'V.' },
2955 { name: 'Viale', abbreviation: 'V.le' },
2956 { name: 'Vicinale', abbreviation: 'Vic.le' },
2957 { name: 'Vicolo', abbreviation: 'Vic.' }
2958 ],
2959 'uk' : [
2960 {name: 'Avenue', abbreviation: 'Ave'},
2961 {name: 'Close', abbreviation: 'Cl'},
2962 {name: 'Court', abbreviation: 'Ct'},
2963 {name: 'Crescent', abbreviation: 'Cr'},
2964 {name: 'Drive', abbreviation: 'Dr'},
2965 {name: 'Garden', abbreviation: 'Gdn'},
2966 {name: 'Gardens', abbreviation: 'Gdns'},
2967 {name: 'Green', abbreviation: 'Gn'},
2968 {name: 'Grove', abbreviation: 'Gr'},
2969 {name: 'Lane', abbreviation: 'Ln'},
2970 {name: 'Mount', abbreviation: 'Mt'},
2971 {name: 'Place', abbreviation: 'Pl'},
2972 {name: 'Park', abbreviation: 'Pk'},
2973 {name: 'Ridge', abbreviation: 'Rdg'},
2974 {name: 'Road', abbreviation: 'Rd'},
2975 {name: 'Square', abbreviation: 'Sq'},
2976 {name: 'Street', abbreviation: 'St'},
2977 {name: 'Terrace', abbreviation: 'Ter'},
2978 {name: 'Valley', abbreviation: 'Val'}
2979 ]
2980 },
2981
2982 months: [
2983 {name: 'January', short_name: 'Jan', numeric: '01', days: 31},
2984 // Not messing with leap years...
2985 {name: 'February', short_name: 'Feb', numeric: '02', days: 28},
2986 {name: 'March', short_name: 'Mar', numeric: '03', days: 31},
2987 {name: 'April', short_name: 'Apr', numeric: '04', days: 30},
2988 {name: 'May', short_name: 'May', numeric: '05', days: 31},
2989 {name: 'June', short_name: 'Jun', numeric: '06', days: 30},
2990 {name: 'July', short_name: 'Jul', numeric: '07', days: 31},
2991 {name: 'August', short_name: 'Aug', numeric: '08', days: 31},
2992 {name: 'September', short_name: 'Sep', numeric: '09', days: 30},
2993 {name: 'October', short_name: 'Oct', numeric: '10', days: 31},
2994 {name: 'November', short_name: 'Nov', numeric: '11', days: 30},
2995 {name: 'December', short_name: 'Dec', numeric: '12', days: 31}
2996 ],
2997
2998 // http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29
2999 cc_types: [
3000 {name: "American Express", short_name: 'amex', prefix: '34', length: 15},
3001 {name: "Bankcard", short_name: 'bankcard', prefix: '5610', length: 16},
3002 {name: "China UnionPay", short_name: 'chinaunion', prefix: '62', length: 16},
3003 {name: "Diners Club Carte Blanche", short_name: 'dccarte', prefix: '300', length: 14},
3004 {name: "Diners Club enRoute", short_name: 'dcenroute', prefix: '2014', length: 15},
3005 {name: "Diners Club International", short_name: 'dcintl', prefix: '36', length: 14},
3006 {name: "Diners Club United States & Canada", short_name: 'dcusc', prefix: '54', length: 16},
3007 {name: "Discover Card", short_name: 'discover', prefix: '6011', length: 16},
3008 {name: "InstaPayment", short_name: 'instapay', prefix: '637', length: 16},
3009 {name: "JCB", short_name: 'jcb', prefix: '3528', length: 16},
3010 {name: "Laser", short_name: 'laser', prefix: '6304', length: 16},
3011 {name: "Maestro", short_name: 'maestro', prefix: '5018', length: 16},
3012 {name: "Mastercard", short_name: 'mc', prefix: '51', length: 16},
3013 {name: "Solo", short_name: 'solo', prefix: '6334', length: 16},
3014 {name: "Switch", short_name: 'switch', prefix: '4903', length: 16},
3015 {name: "Visa", short_name: 'visa', prefix: '4', length: 16},
3016 {name: "Visa Electron", short_name: 'electron', prefix: '4026', length: 16}
3017 ],
3018
3019 //return all world currency by ISO 4217
3020 currency_types: [
3021 {'code' : 'AED', 'name' : 'United Arab Emirates Dirham'},
3022 {'code' : 'AFN', 'name' : 'Afghanistan Afghani'},
3023 {'code' : 'ALL', 'name' : 'Albania Lek'},
3024 {'code' : 'AMD', 'name' : 'Armenia Dram'},
3025 {'code' : 'ANG', 'name' : 'Netherlands Antilles Guilder'},
3026 {'code' : 'AOA', 'name' : 'Angola Kwanza'},
3027 {'code' : 'ARS', 'name' : 'Argentina Peso'},
3028 {'code' : 'AUD', 'name' : 'Australia Dollar'},
3029 {'code' : 'AWG', 'name' : 'Aruba Guilder'},
3030 {'code' : 'AZN', 'name' : 'Azerbaijan New Manat'},
3031 {'code' : 'BAM', 'name' : 'Bosnia and Herzegovina Convertible Marka'},
3032 {'code' : 'BBD', 'name' : 'Barbados Dollar'},
3033 {'code' : 'BDT', 'name' : 'Bangladesh Taka'},
3034 {'code' : 'BGN', 'name' : 'Bulgaria Lev'},
3035 {'code' : 'BHD', 'name' : 'Bahrain Dinar'},
3036 {'code' : 'BIF', 'name' : 'Burundi Franc'},
3037 {'code' : 'BMD', 'name' : 'Bermuda Dollar'},
3038 {'code' : 'BND', 'name' : 'Brunei Darussalam Dollar'},
3039 {'code' : 'BOB', 'name' : 'Bolivia Boliviano'},
3040 {'code' : 'BRL', 'name' : 'Brazil Real'},
3041 {'code' : 'BSD', 'name' : 'Bahamas Dollar'},
3042 {'code' : 'BTN', 'name' : 'Bhutan Ngultrum'},
3043 {'code' : 'BWP', 'name' : 'Botswana Pula'},
3044 {'code' : 'BYR', 'name' : 'Belarus Ruble'},
3045 {'code' : 'BZD', 'name' : 'Belize Dollar'},
3046 {'code' : 'CAD', 'name' : 'Canada Dollar'},
3047 {'code' : 'CDF', 'name' : 'Congo/Kinshasa Franc'},
3048 {'code' : 'CHF', 'name' : 'Switzerland Franc'},
3049 {'code' : 'CLP', 'name' : 'Chile Peso'},
3050 {'code' : 'CNY', 'name' : 'China Yuan Renminbi'},
3051 {'code' : 'COP', 'name' : 'Colombia Peso'},
3052 {'code' : 'CRC', 'name' : 'Costa Rica Colon'},
3053 {'code' : 'CUC', 'name' : 'Cuba Convertible Peso'},
3054 {'code' : 'CUP', 'name' : 'Cuba Peso'},
3055 {'code' : 'CVE', 'name' : 'Cape Verde Escudo'},
3056 {'code' : 'CZK', 'name' : 'Czech Republic Koruna'},
3057 {'code' : 'DJF', 'name' : 'Djibouti Franc'},
3058 {'code' : 'DKK', 'name' : 'Denmark Krone'},
3059 {'code' : 'DOP', 'name' : 'Dominican Republic Peso'},
3060 {'code' : 'DZD', 'name' : 'Algeria Dinar'},
3061 {'code' : 'EGP', 'name' : 'Egypt Pound'},
3062 {'code' : 'ERN', 'name' : 'Eritrea Nakfa'},
3063 {'code' : 'ETB', 'name' : 'Ethiopia Birr'},
3064 {'code' : 'EUR', 'name' : 'Euro Member Countries'},
3065 {'code' : 'FJD', 'name' : 'Fiji Dollar'},
3066 {'code' : 'FKP', 'name' : 'Falkland Islands (Malvinas) Pound'},
3067 {'code' : 'GBP', 'name' : 'United Kingdom Pound'},
3068 {'code' : 'GEL', 'name' : 'Georgia Lari'},
3069 {'code' : 'GGP', 'name' : 'Guernsey Pound'},
3070 {'code' : 'GHS', 'name' : 'Ghana Cedi'},
3071 {'code' : 'GIP', 'name' : 'Gibraltar Pound'},
3072 {'code' : 'GMD', 'name' : 'Gambia Dalasi'},
3073 {'code' : 'GNF', 'name' : 'Guinea Franc'},
3074 {'code' : 'GTQ', 'name' : 'Guatemala Quetzal'},
3075 {'code' : 'GYD', 'name' : 'Guyana Dollar'},
3076 {'code' : 'HKD', 'name' : 'Hong Kong Dollar'},
3077 {'code' : 'HNL', 'name' : 'Honduras Lempira'},
3078 {'code' : 'HRK', 'name' : 'Croatia Kuna'},
3079 {'code' : 'HTG', 'name' : 'Haiti Gourde'},
3080 {'code' : 'HUF', 'name' : 'Hungary Forint'},
3081 {'code' : 'IDR', 'name' : 'Indonesia Rupiah'},
3082 {'code' : 'ILS', 'name' : 'Israel Shekel'},
3083 {'code' : 'IMP', 'name' : 'Isle of Man Pound'},
3084 {'code' : 'INR', 'name' : 'India Rupee'},
3085 {'code' : 'IQD', 'name' : 'Iraq Dinar'},
3086 {'code' : 'IRR', 'name' : 'Iran Rial'},
3087 {'code' : 'ISK', 'name' : 'Iceland Krona'},
3088 {'code' : 'JEP', 'name' : 'Jersey Pound'},
3089 {'code' : 'JMD', 'name' : 'Jamaica Dollar'},
3090 {'code' : 'JOD', 'name' : 'Jordan Dinar'},
3091 {'code' : 'JPY', 'name' : 'Japan Yen'},
3092 {'code' : 'KES', 'name' : 'Kenya Shilling'},
3093 {'code' : 'KGS', 'name' : 'Kyrgyzstan Som'},
3094 {'code' : 'KHR', 'name' : 'Cambodia Riel'},
3095 {'code' : 'KMF', 'name' : 'Comoros Franc'},
3096 {'code' : 'KPW', 'name' : 'Korea (North) Won'},
3097 {'code' : 'KRW', 'name' : 'Korea (South) Won'},
3098 {'code' : 'KWD', 'name' : 'Kuwait Dinar'},
3099 {'code' : 'KYD', 'name' : 'Cayman Islands Dollar'},
3100 {'code' : 'KZT', 'name' : 'Kazakhstan Tenge'},
3101 {'code' : 'LAK', 'name' : 'Laos Kip'},
3102 {'code' : 'LBP', 'name' : 'Lebanon Pound'},
3103 {'code' : 'LKR', 'name' : 'Sri Lanka Rupee'},
3104 {'code' : 'LRD', 'name' : 'Liberia Dollar'},
3105 {'code' : 'LSL', 'name' : 'Lesotho Loti'},
3106 {'code' : 'LTL', 'name' : 'Lithuania Litas'},
3107 {'code' : 'LYD', 'name' : 'Libya Dinar'},
3108 {'code' : 'MAD', 'name' : 'Morocco Dirham'},
3109 {'code' : 'MDL', 'name' : 'Moldova Leu'},
3110 {'code' : 'MGA', 'name' : 'Madagascar Ariary'},
3111 {'code' : 'MKD', 'name' : 'Macedonia Denar'},
3112 {'code' : 'MMK', 'name' : 'Myanmar (Burma) Kyat'},
3113 {'code' : 'MNT', 'name' : 'Mongolia Tughrik'},
3114 {'code' : 'MOP', 'name' : 'Macau Pataca'},
3115 {'code' : 'MRO', 'name' : 'Mauritania Ouguiya'},
3116 {'code' : 'MUR', 'name' : 'Mauritius Rupee'},
3117 {'code' : 'MVR', 'name' : 'Maldives (Maldive Islands) Rufiyaa'},
3118 {'code' : 'MWK', 'name' : 'Malawi Kwacha'},
3119 {'code' : 'MXN', 'name' : 'Mexico Peso'},
3120 {'code' : 'MYR', 'name' : 'Malaysia Ringgit'},
3121 {'code' : 'MZN', 'name' : 'Mozambique Metical'},
3122 {'code' : 'NAD', 'name' : 'Namibia Dollar'},
3123 {'code' : 'NGN', 'name' : 'Nigeria Naira'},
3124 {'code' : 'NIO', 'name' : 'Nicaragua Cordoba'},
3125 {'code' : 'NOK', 'name' : 'Norway Krone'},
3126 {'code' : 'NPR', 'name' : 'Nepal Rupee'},
3127 {'code' : 'NZD', 'name' : 'New Zealand Dollar'},
3128 {'code' : 'OMR', 'name' : 'Oman Rial'},
3129 {'code' : 'PAB', 'name' : 'Panama Balboa'},
3130 {'code' : 'PEN', 'name' : 'Peru Nuevo Sol'},
3131 {'code' : 'PGK', 'name' : 'Papua New Guinea Kina'},
3132 {'code' : 'PHP', 'name' : 'Philippines Peso'},
3133 {'code' : 'PKR', 'name' : 'Pakistan Rupee'},
3134 {'code' : 'PLN', 'name' : 'Poland Zloty'},
3135 {'code' : 'PYG', 'name' : 'Paraguay Guarani'},
3136 {'code' : 'QAR', 'name' : 'Qatar Riyal'},
3137 {'code' : 'RON', 'name' : 'Romania New Leu'},
3138 {'code' : 'RSD', 'name' : 'Serbia Dinar'},
3139 {'code' : 'RUB', 'name' : 'Russia Ruble'},
3140 {'code' : 'RWF', 'name' : 'Rwanda Franc'},
3141 {'code' : 'SAR', 'name' : 'Saudi Arabia Riyal'},
3142 {'code' : 'SBD', 'name' : 'Solomon Islands Dollar'},
3143 {'code' : 'SCR', 'name' : 'Seychelles Rupee'},
3144 {'code' : 'SDG', 'name' : 'Sudan Pound'},
3145 {'code' : 'SEK', 'name' : 'Sweden Krona'},
3146 {'code' : 'SGD', 'name' : 'Singapore Dollar'},
3147 {'code' : 'SHP', 'name' : 'Saint Helena Pound'},
3148 {'code' : 'SLL', 'name' : 'Sierra Leone Leone'},
3149 {'code' : 'SOS', 'name' : 'Somalia Shilling'},
3150 {'code' : 'SPL', 'name' : 'Seborga Luigino'},
3151 {'code' : 'SRD', 'name' : 'Suriname Dollar'},
3152 {'code' : 'STD', 'name' : 'São Tomé and Príncipe Dobra'},
3153 {'code' : 'SVC', 'name' : 'El Salvador Colon'},
3154 {'code' : 'SYP', 'name' : 'Syria Pound'},
3155 {'code' : 'SZL', 'name' : 'Swaziland Lilangeni'},
3156 {'code' : 'THB', 'name' : 'Thailand Baht'},
3157 {'code' : 'TJS', 'name' : 'Tajikistan Somoni'},
3158 {'code' : 'TMT', 'name' : 'Turkmenistan Manat'},
3159 {'code' : 'TND', 'name' : 'Tunisia Dinar'},
3160 {'code' : 'TOP', 'name' : 'Tonga Pa\'anga'},
3161 {'code' : 'TRY', 'name' : 'Turkey Lira'},
3162 {'code' : 'TTD', 'name' : 'Trinidad and Tobago Dollar'},
3163 {'code' : 'TVD', 'name' : 'Tuvalu Dollar'},
3164 {'code' : 'TWD', 'name' : 'Taiwan New Dollar'},
3165 {'code' : 'TZS', 'name' : 'Tanzania Shilling'},
3166 {'code' : 'UAH', 'name' : 'Ukraine Hryvnia'},
3167 {'code' : 'UGX', 'name' : 'Uganda Shilling'},
3168 {'code' : 'USD', 'name' : 'United States Dollar'},
3169 {'code' : 'UYU', 'name' : 'Uruguay Peso'},
3170 {'code' : 'UZS', 'name' : 'Uzbekistan Som'},
3171 {'code' : 'VEF', 'name' : 'Venezuela Bolivar'},
3172 {'code' : 'VND', 'name' : 'Viet Nam Dong'},
3173 {'code' : 'VUV', 'name' : 'Vanuatu Vatu'},
3174 {'code' : 'WST', 'name' : 'Samoa Tala'},
3175 {'code' : 'XAF', 'name' : 'Communauté Financière Africaine (BEAC) CFA Franc BEAC'},
3176 {'code' : 'XCD', 'name' : 'East Caribbean Dollar'},
3177 {'code' : 'XDR', 'name' : 'International Monetary Fund (IMF) Special Drawing Rights'},
3178 {'code' : 'XOF', 'name' : 'Communauté Financière Africaine (BCEAO) Franc'},
3179 {'code' : 'XPF', 'name' : 'Comptoirs Français du Pacifique (CFP) Franc'},
3180 {'code' : 'YER', 'name' : 'Yemen Rial'},
3181 {'code' : 'ZAR', 'name' : 'South Africa Rand'},
3182 {'code' : 'ZMW', 'name' : 'Zambia Kwacha'},
3183 {'code' : 'ZWD', 'name' : 'Zimbabwe Dollar'}
3184 ],
3185
3186 // return the names of all valide colors
3187 colorNames : [ "AliceBlue", "Black", "Navy", "DarkBlue", "MediumBlue", "Blue", "DarkGreen", "Green", "Teal", "DarkCyan", "DeepSkyBlue", "DarkTurquoise", "MediumSpringGreen", "Lime", "SpringGreen",
3188 "Aqua", "Cyan", "MidnightBlue", "DodgerBlue", "LightSeaGreen", "ForestGreen", "SeaGreen", "DarkSlateGray", "LimeGreen", "MediumSeaGreen", "Turquoise", "RoyalBlue", "SteelBlue", "DarkSlateBlue", "MediumTurquoise",
3189 "Indigo", "DarkOliveGreen", "CadetBlue", "CornflowerBlue", "RebeccaPurple", "MediumAquaMarine", "DimGray", "SlateBlue", "OliveDrab", "SlateGray", "LightSlateGray", "MediumSlateBlue", "LawnGreen", "Chartreuse",
3190 "Aquamarine", "Maroon", "Purple", "Olive", "Gray", "SkyBlue", "LightSkyBlue", "BlueViolet", "DarkRed", "DarkMagenta", "SaddleBrown", "Ivory", "White",
3191 "DarkSeaGreen", "LightGreen", "MediumPurple", "DarkViolet", "PaleGreen", "DarkOrchid", "YellowGreen", "Sienna", "Brown", "DarkGray", "LightBlue", "GreenYellow", "PaleTurquoise", "LightSteelBlue", "PowderBlue",
3192 "FireBrick", "DarkGoldenRod", "MediumOrchid", "RosyBrown", "DarkKhaki", "Silver", "MediumVioletRed", "IndianRed", "Peru", "Chocolate", "Tan", "LightGray", "Thistle", "Orchid", "GoldenRod", "PaleVioletRed",
3193 "Crimson", "Gainsboro", "Plum", "BurlyWood", "LightCyan", "Lavender", "DarkSalmon", "Violet", "PaleGoldenRod", "LightCoral", "Khaki", "AliceBlue", "HoneyDew", "Azure", "SandyBrown", "Wheat", "Beige", "WhiteSmoke",
3194 "MintCream", "GhostWhite", "Salmon", "AntiqueWhite", "Linen", "LightGoldenRodYellow", "OldLace", "Red", "Fuchsia", "Magenta", "DeepPink", "OrangeRed", "Tomato", "HotPink", "Coral", "DarkOrange", "LightSalmon", "Orange",
3195 "LightPink", "Pink", "Gold", "PeachPuff", "NavajoWhite", "Moccasin", "Bisque", "MistyRose", "BlanchedAlmond", "PapayaWhip", "LavenderBlush", "SeaShell", "Cornsilk", "LemonChiffon", "FloralWhite", "Snow", "Yellow", "LightYellow"
3196 ],
3197
3198 fileExtension : {
3199 "raster" : ["bmp", "gif", "gpl", "ico", "jpeg", "psd", "png", "psp", "raw", "tiff"],
3200 "vector" : ["3dv", "amf", "awg", "ai", "cgm", "cdr", "cmx", "dxf", "e2d", "egt", "eps", "fs", "odg", "svg", "xar"],
3201 "3d" : ["3dmf", "3dm", "3mf", "3ds", "an8", "aoi", "blend", "cal3d", "cob", "ctm", "iob", "jas", "max", "mb", "mdx", "obj", "x", "x3d"],
3202 "document" : ["doc", "docx", "dot", "html", "xml", "odt", "odm", "ott", "csv", "rtf", "tex", "xhtml", "xps"]
3203 },
3204
3205 // Data taken from https://github.com/dmfilipenko/timezones.json/blob/master/timezones.json
3206 timezones: [
3207 {
3208 "name": "Dateline Standard Time",
3209 "abbr": "DST",
3210 "offset": -12,
3211 "isdst": false,
3212 "text": "(UTC-12:00) International Date Line West",
3213 "utc": [
3214 "Etc/GMT+12"
3215 ]
3216 },
3217 {
3218 "name": "UTC-11",
3219 "abbr": "U",
3220 "offset": -11,
3221 "isdst": false,
3222 "text": "(UTC-11:00) Coordinated Universal Time-11",
3223 "utc": [
3224 "Etc/GMT+11",
3225 "Pacific/Midway",
3226 "Pacific/Niue",
3227 "Pacific/Pago_Pago"
3228 ]
3229 },
3230 {
3231 "name": "Hawaiian Standard Time",
3232 "abbr": "HST",
3233 "offset": -10,
3234 "isdst": false,
3235 "text": "(UTC-10:00) Hawaii",
3236 "utc": [
3237 "Etc/GMT+10",
3238 "Pacific/Honolulu",
3239 "Pacific/Johnston",
3240 "Pacific/Rarotonga",
3241 "Pacific/Tahiti"
3242 ]
3243 },
3244 {
3245 "name": "Alaskan Standard Time",
3246 "abbr": "AKDT",
3247 "offset": -8,
3248 "isdst": true,
3249 "text": "(UTC-09:00) Alaska",
3250 "utc": [
3251 "America/Anchorage",
3252 "America/Juneau",
3253 "America/Nome",
3254 "America/Sitka",
3255 "America/Yakutat"
3256 ]
3257 },
3258 {
3259 "name": "Pacific Standard Time (Mexico)",
3260 "abbr": "PDT",
3261 "offset": -7,
3262 "isdst": true,
3263 "text": "(UTC-08:00) Baja California",
3264 "utc": [
3265 "America/Santa_Isabel"
3266 ]
3267 },
3268 {
3269 "name": "Pacific Standard Time",
3270 "abbr": "PDT",
3271 "offset": -7,
3272 "isdst": true,
3273 "text": "(UTC-08:00) Pacific Time (US & Canada)",
3274 "utc": [
3275 "America/Dawson",
3276 "America/Los_Angeles",
3277 "America/Tijuana",
3278 "America/Vancouver",
3279 "America/Whitehorse",
3280 "PST8PDT"
3281 ]
3282 },
3283 {
3284 "name": "US Mountain Standard Time",
3285 "abbr": "UMST",
3286 "offset": -7,
3287 "isdst": false,
3288 "text": "(UTC-07:00) Arizona",
3289 "utc": [
3290 "America/Creston",
3291 "America/Dawson_Creek",
3292 "America/Hermosillo",
3293 "America/Phoenix",
3294 "Etc/GMT+7"
3295 ]
3296 },
3297 {
3298 "name": "Mountain Standard Time (Mexico)",
3299 "abbr": "MDT",
3300 "offset": -6,
3301 "isdst": true,
3302 "text": "(UTC-07:00) Chihuahua, La Paz, Mazatlan",
3303 "utc": [
3304 "America/Chihuahua",
3305 "America/Mazatlan"
3306 ]
3307 },
3308 {
3309 "name": "Mountain Standard Time",
3310 "abbr": "MDT",
3311 "offset": -6,
3312 "isdst": true,
3313 "text": "(UTC-07:00) Mountain Time (US & Canada)",
3314 "utc": [
3315 "America/Boise",
3316 "America/Cambridge_Bay",
3317 "America/Denver",
3318 "America/Edmonton",
3319 "America/Inuvik",
3320 "America/Ojinaga",
3321 "America/Yellowknife",
3322 "MST7MDT"
3323 ]
3324 },
3325 {
3326 "name": "Central America Standard Time",
3327 "abbr": "CAST",
3328 "offset": -6,
3329 "isdst": false,
3330 "text": "(UTC-06:00) Central America",
3331 "utc": [
3332 "America/Belize",
3333 "America/Costa_Rica",
3334 "America/El_Salvador",
3335 "America/Guatemala",
3336 "America/Managua",
3337 "America/Tegucigalpa",
3338 "Etc/GMT+6",
3339 "Pacific/Galapagos"
3340 ]
3341 },
3342 {
3343 "name": "Central Standard Time",
3344 "abbr": "CDT",
3345 "offset": -5,
3346 "isdst": true,
3347 "text": "(UTC-06:00) Central Time (US & Canada)",
3348 "utc": [
3349 "America/Chicago",
3350 "America/Indiana/Knox",
3351 "America/Indiana/Tell_City",
3352 "America/Matamoros",
3353 "America/Menominee",
3354 "America/North_Dakota/Beulah",
3355 "America/North_Dakota/Center",
3356 "America/North_Dakota/New_Salem",
3357 "America/Rainy_River",
3358 "America/Rankin_Inlet",
3359 "America/Resolute",
3360 "America/Winnipeg",
3361 "CST6CDT"
3362 ]
3363 },
3364 {
3365 "name": "Central Standard Time (Mexico)",
3366 "abbr": "CDT",
3367 "offset": -5,
3368 "isdst": true,
3369 "text": "(UTC-06:00) Guadalajara, Mexico City, Monterrey",
3370 "utc": [
3371 "America/Bahia_Banderas",
3372 "America/Cancun",
3373 "America/Merida",
3374 "America/Mexico_City",
3375 "America/Monterrey"
3376 ]
3377 },
3378 {
3379 "name": "Canada Central Standard Time",
3380 "abbr": "CCST",
3381 "offset": -6,
3382 "isdst": false,
3383 "text": "(UTC-06:00) Saskatchewan",
3384 "utc": [
3385 "America/Regina",
3386 "America/Swift_Current"
3387 ]
3388 },
3389 {
3390 "name": "SA Pacific Standard Time",
3391 "abbr": "SPST",
3392 "offset": -5,
3393 "isdst": false,
3394 "text": "(UTC-05:00) Bogota, Lima, Quito",
3395 "utc": [
3396 "America/Bogota",
3397 "America/Cayman",
3398 "America/Coral_Harbour",
3399 "America/Eirunepe",
3400 "America/Guayaquil",
3401 "America/Jamaica",
3402 "America/Lima",
3403 "America/Panama",
3404 "America/Rio_Branco",
3405 "Etc/GMT+5"
3406 ]
3407 },
3408 {
3409 "name": "Eastern Standard Time",
3410 "abbr": "EDT",
3411 "offset": -4,
3412 "isdst": true,
3413 "text": "(UTC-05:00) Eastern Time (US & Canada)",
3414 "utc": [
3415 "America/Detroit",
3416 "America/Havana",
3417 "America/Indiana/Petersburg",
3418 "America/Indiana/Vincennes",
3419 "America/Indiana/Winamac",
3420 "America/Iqaluit",
3421 "America/Kentucky/Monticello",
3422 "America/Louisville",
3423 "America/Montreal",
3424 "America/Nassau",
3425 "America/New_York",
3426 "America/Nipigon",
3427 "America/Pangnirtung",
3428 "America/Port-au-Prince",
3429 "America/Thunder_Bay",
3430 "America/Toronto",
3431 "EST5EDT"
3432 ]
3433 },
3434 {
3435 "name": "US Eastern Standard Time",
3436 "abbr": "UEDT",
3437 "offset": -4,
3438 "isdst": true,
3439 "text": "(UTC-05:00) Indiana (East)",
3440 "utc": [
3441 "America/Indiana/Marengo",
3442 "America/Indiana/Vevay",
3443 "America/Indianapolis"
3444 ]
3445 },
3446 {
3447 "name": "Venezuela Standard Time",
3448 "abbr": "VST",
3449 "offset": -4.5,
3450 "isdst": false,
3451 "text": "(UTC-04:30) Caracas",
3452 "utc": [
3453 "America/Caracas"
3454 ]
3455 },
3456 {
3457 "name": "Paraguay Standard Time",
3458 "abbr": "PST",
3459 "offset": -4,
3460 "isdst": false,
3461 "text": "(UTC-04:00) Asuncion",
3462 "utc": [
3463 "America/Asuncion"
3464 ]
3465 },
3466 {
3467 "name": "Atlantic Standard Time",
3468 "abbr": "ADT",
3469 "offset": -3,
3470 "isdst": true,
3471 "text": "(UTC-04:00) Atlantic Time (Canada)",
3472 "utc": [
3473 "America/Glace_Bay",
3474 "America/Goose_Bay",
3475 "America/Halifax",
3476 "America/Moncton",
3477 "America/Thule",
3478 "Atlantic/Bermuda"
3479 ]
3480 },
3481 {
3482 "name": "Central Brazilian Standard Time",
3483 "abbr": "CBST",
3484 "offset": -4,
3485 "isdst": false,
3486 "text": "(UTC-04:00) Cuiaba",
3487 "utc": [
3488 "America/Campo_Grande",
3489 "America/Cuiaba"
3490 ]
3491 },
3492 {
3493 "name": "SA Western Standard Time",
3494 "abbr": "SWST",
3495 "offset": -4,
3496 "isdst": false,
3497 "text": "(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",
3498 "utc": [
3499 "America/Anguilla",
3500 "America/Antigua",
3501 "America/Aruba",
3502 "America/Barbados",
3503 "America/Blanc-Sablon",
3504 "America/Boa_Vista",
3505 "America/Curacao",
3506 "America/Dominica",
3507 "America/Grand_Turk",
3508 "America/Grenada",
3509 "America/Guadeloupe",
3510 "America/Guyana",
3511 "America/Kralendijk",
3512 "America/La_Paz",
3513 "America/Lower_Princes",
3514 "America/Manaus",
3515 "America/Marigot",
3516 "America/Martinique",
3517 "America/Montserrat",
3518 "America/Port_of_Spain",
3519 "America/Porto_Velho",
3520 "America/Puerto_Rico",
3521 "America/Santo_Domingo",
3522 "America/St_Barthelemy",
3523 "America/St_Kitts",
3524 "America/St_Lucia",
3525 "America/St_Thomas",
3526 "America/St_Vincent",
3527 "America/Tortola",
3528 "Etc/GMT+4"
3529 ]
3530 },
3531 {
3532 "name": "Pacific SA Standard Time",
3533 "abbr": "PSST",
3534 "offset": -4,
3535 "isdst": false,
3536 "text": "(UTC-04:00) Santiago",
3537 "utc": [
3538 "America/Santiago",
3539 "Antarctica/Palmer"
3540 ]
3541 },
3542 {
3543 "name": "Newfoundland Standard Time",
3544 "abbr": "NDT",
3545 "offset": -2.5,
3546 "isdst": true,
3547 "text": "(UTC-03:30) Newfoundland",
3548 "utc": [
3549 "America/St_Johns"
3550 ]
3551 },
3552 {
3553 "name": "E. South America Standard Time",
3554 "abbr": "ESAST",
3555 "offset": -3,
3556 "isdst": false,
3557 "text": "(UTC-03:00) Brasilia",
3558 "utc": [
3559 "America/Sao_Paulo"
3560 ]
3561 },
3562 {
3563 "name": "Argentina Standard Time",
3564 "abbr": "AST",
3565 "offset": -3,
3566 "isdst": false,
3567 "text": "(UTC-03:00) Buenos Aires",
3568 "utc": [
3569 "America/Argentina/La_Rioja",
3570 "America/Argentina/Rio_Gallegos",
3571 "America/Argentina/Salta",
3572 "America/Argentina/San_Juan",
3573 "America/Argentina/San_Luis",
3574 "America/Argentina/Tucuman",
3575 "America/Argentina/Ushuaia",
3576 "America/Buenos_Aires",
3577 "America/Catamarca",
3578 "America/Cordoba",
3579 "America/Jujuy",
3580 "America/Mendoza"
3581 ]
3582 },
3583 {
3584 "name": "SA Eastern Standard Time",
3585 "abbr": "SEST",
3586 "offset": -3,
3587 "isdst": false,
3588 "text": "(UTC-03:00) Cayenne, Fortaleza",
3589 "utc": [
3590 "America/Araguaina",
3591 "America/Belem",
3592 "America/Cayenne",
3593 "America/Fortaleza",
3594 "America/Maceio",
3595 "America/Paramaribo",
3596 "America/Recife",
3597 "America/Santarem",
3598 "Antarctica/Rothera",
3599 "Atlantic/Stanley",
3600 "Etc/GMT+3"
3601 ]
3602 },
3603 {
3604 "name": "Greenland Standard Time",
3605 "abbr": "GDT",
3606 "offset": -2,
3607 "isdst": true,
3608 "text": "(UTC-03:00) Greenland",
3609 "utc": [
3610 "America/Godthab"
3611 ]
3612 },
3613 {
3614 "name": "Montevideo Standard Time",
3615 "abbr": "MST",
3616 "offset": -3,
3617 "isdst": false,
3618 "text": "(UTC-03:00) Montevideo",
3619 "utc": [
3620 "America/Montevideo"
3621 ]
3622 },
3623 {
3624 "name": "Bahia Standard Time",
3625 "abbr": "BST",
3626 "offset": -3,
3627 "isdst": false,
3628 "text": "(UTC-03:00) Salvador",
3629 "utc": [
3630 "America/Bahia"
3631 ]
3632 },
3633 {
3634 "name": "UTC-02",
3635 "abbr": "U",
3636 "offset": -2,
3637 "isdst": false,
3638 "text": "(UTC-02:00) Coordinated Universal Time-02",
3639 "utc": [
3640 "America/Noronha",
3641 "Atlantic/South_Georgia",
3642 "Etc/GMT+2"
3643 ]
3644 },
3645 {
3646 "name": "Mid-Atlantic Standard Time",
3647 "abbr": "MDT",
3648 "offset": -1,
3649 "isdst": true,
3650 "text": "(UTC-02:00) Mid-Atlantic - Old"
3651 },
3652 {
3653 "name": "Azores Standard Time",
3654 "abbr": "ADT",
3655 "offset": 0,
3656 "isdst": true,
3657 "text": "(UTC-01:00) Azores",
3658 "utc": [
3659 "America/Scoresbysund",
3660 "Atlantic/Azores"
3661 ]
3662 },
3663 {
3664 "name": "Cape Verde Standard Time",
3665 "abbr": "CVST",
3666 "offset": -1,
3667 "isdst": false,
3668 "text": "(UTC-01:00) Cape Verde Is.",
3669 "utc": [
3670 "Atlantic/Cape_Verde",
3671 "Etc/GMT+1"
3672 ]
3673 },
3674 {
3675 "name": "Morocco Standard Time",
3676 "abbr": "MDT",
3677 "offset": 1,
3678 "isdst": true,
3679 "text": "(UTC) Casablanca",
3680 "utc": [
3681 "Africa/Casablanca",
3682 "Africa/El_Aaiun"
3683 ]
3684 },
3685 {
3686 "name": "UTC",
3687 "abbr": "CUT",
3688 "offset": 0,
3689 "isdst": false,
3690 "text": "(UTC) Coordinated Universal Time",
3691 "utc": [
3692 "America/Danmarkshavn",
3693 "Etc/GMT"
3694 ]
3695 },
3696 {
3697 "name": "GMT Standard Time",
3698 "abbr": "GDT",
3699 "offset": 1,
3700 "isdst": true,
3701 "text": "(UTC) Dublin, Edinburgh, Lisbon, London",
3702 "utc": [
3703 "Atlantic/Canary",
3704 "Atlantic/Faeroe",
3705 "Atlantic/Madeira",
3706 "Europe/Dublin",
3707 "Europe/Guernsey",
3708 "Europe/Isle_of_Man",
3709 "Europe/Jersey",
3710 "Europe/Lisbon",
3711 "Europe/London"
3712 ]
3713 },
3714 {
3715 "name": "Greenwich Standard Time",
3716 "abbr": "GST",
3717 "offset": 0,
3718 "isdst": false,
3719 "text": "(UTC) Monrovia, Reykjavik",
3720 "utc": [
3721 "Africa/Abidjan",
3722 "Africa/Accra",
3723 "Africa/Bamako",
3724 "Africa/Banjul",
3725 "Africa/Bissau",
3726 "Africa/Conakry",
3727 "Africa/Dakar",
3728 "Africa/Freetown",
3729 "Africa/Lome",
3730 "Africa/Monrovia",
3731 "Africa/Nouakchott",
3732 "Africa/Ouagadougou",
3733 "Africa/Sao_Tome",
3734 "Atlantic/Reykjavik",
3735 "Atlantic/St_Helena"
3736 ]
3737 },
3738 {
3739 "name": "W. Europe Standard Time",
3740 "abbr": "WEDT",
3741 "offset": 2,
3742 "isdst": true,
3743 "text": "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",
3744 "utc": [
3745 "Arctic/Longyearbyen",
3746 "Europe/Amsterdam",
3747 "Europe/Andorra",
3748 "Europe/Berlin",
3749 "Europe/Busingen",
3750 "Europe/Gibraltar",
3751 "Europe/Luxembourg",
3752 "Europe/Malta",
3753 "Europe/Monaco",
3754 "Europe/Oslo",
3755 "Europe/Rome",
3756 "Europe/San_Marino",
3757 "Europe/Stockholm",
3758 "Europe/Vaduz",
3759 "Europe/Vatican",
3760 "Europe/Vienna",
3761 "Europe/Zurich"
3762 ]
3763 },
3764 {
3765 "name": "Central Europe Standard Time",
3766 "abbr": "CEDT",
3767 "offset": 2,
3768 "isdst": true,
3769 "text": "(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",
3770 "utc": [
3771 "Europe/Belgrade",
3772 "Europe/Bratislava",
3773 "Europe/Budapest",
3774 "Europe/Ljubljana",
3775 "Europe/Podgorica",
3776 "Europe/Prague",
3777 "Europe/Tirane"
3778 ]
3779 },
3780 {
3781 "name": "Romance Standard Time",
3782 "abbr": "RDT",
3783 "offset": 2,
3784 "isdst": true,
3785 "text": "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",
3786 "utc": [
3787 "Africa/Ceuta",
3788 "Europe/Brussels",
3789 "Europe/Copenhagen",
3790 "Europe/Madrid",
3791 "Europe/Paris"
3792 ]
3793 },
3794 {
3795 "name": "Central European Standard Time",
3796 "abbr": "CEDT",
3797 "offset": 2,
3798 "isdst": true,
3799 "text": "(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",
3800 "utc": [
3801 "Europe/Sarajevo",
3802 "Europe/Skopje",
3803 "Europe/Warsaw",
3804 "Europe/Zagreb"
3805 ]
3806 },
3807 {
3808 "name": "W. Central Africa Standard Time",
3809 "abbr": "WCAST",
3810 "offset": 1,
3811 "isdst": false,
3812 "text": "(UTC+01:00) West Central Africa",
3813 "utc": [
3814 "Africa/Algiers",
3815 "Africa/Bangui",
3816 "Africa/Brazzaville",
3817 "Africa/Douala",
3818 "Africa/Kinshasa",
3819 "Africa/Lagos",
3820 "Africa/Libreville",
3821 "Africa/Luanda",
3822 "Africa/Malabo",
3823 "Africa/Ndjamena",
3824 "Africa/Niamey",
3825 "Africa/Porto-Novo",
3826 "Africa/Tunis",
3827 "Etc/GMT-1"
3828 ]
3829 },
3830 {
3831 "name": "Namibia Standard Time",
3832 "abbr": "NST",
3833 "offset": 1,
3834 "isdst": false,
3835 "text": "(UTC+01:00) Windhoek",
3836 "utc": [
3837 "Africa/Windhoek"
3838 ]
3839 },
3840 {
3841 "name": "GTB Standard Time",
3842 "abbr": "GDT",
3843 "offset": 3,
3844 "isdst": true,
3845 "text": "(UTC+02:00) Athens, Bucharest",
3846 "utc": [
3847 "Asia/Nicosia",
3848 "Europe/Athens",
3849 "Europe/Bucharest",
3850 "Europe/Chisinau"
3851 ]
3852 },
3853 {
3854 "name": "Middle East Standard Time",
3855 "abbr": "MEDT",
3856 "offset": 3,
3857 "isdst": true,
3858 "text": "(UTC+02:00) Beirut",
3859 "utc": [
3860 "Asia/Beirut"
3861 ]
3862 },
3863 {
3864 "name": "Egypt Standard Time",
3865 "abbr": "EST",
3866 "offset": 2,
3867 "isdst": false,
3868 "text": "(UTC+02:00) Cairo",
3869 "utc": [
3870 "Africa/Cairo"
3871 ]
3872 },
3873 {
3874 "name": "Syria Standard Time",
3875 "abbr": "SDT",
3876 "offset": 3,
3877 "isdst": true,
3878 "text": "(UTC+02:00) Damascus",
3879 "utc": [
3880 "Asia/Damascus"
3881 ]
3882 },
3883 {
3884 "name": "E. Europe Standard Time",
3885 "abbr": "EEDT",
3886 "offset": 3,
3887 "isdst": true,
3888 "text": "(UTC+02:00) E. Europe"
3889 },
3890 {
3891 "name": "South Africa Standard Time",
3892 "abbr": "SAST",
3893 "offset": 2,
3894 "isdst": false,
3895 "text": "(UTC+02:00) Harare, Pretoria",
3896 "utc": [
3897 "Africa/Blantyre",
3898 "Africa/Bujumbura",
3899 "Africa/Gaborone",
3900 "Africa/Harare",
3901 "Africa/Johannesburg",
3902 "Africa/Kigali",
3903 "Africa/Lubumbashi",
3904 "Africa/Lusaka",
3905 "Africa/Maputo",
3906 "Africa/Maseru",
3907 "Africa/Mbabane",
3908 "Etc/GMT-2"
3909 ]
3910 },
3911 {
3912 "name": "FLE Standard Time",
3913 "abbr": "FDT",
3914 "offset": 3,
3915 "isdst": true,
3916 "text": "(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",
3917 "utc": [
3918 "Europe/Helsinki",
3919 "Europe/Kiev",
3920 "Europe/Mariehamn",
3921 "Europe/Riga",
3922 "Europe/Sofia",
3923 "Europe/Tallinn",
3924 "Europe/Uzhgorod",
3925 "Europe/Vilnius",
3926 "Europe/Zaporozhye"
3927 ]
3928 },
3929 {
3930 "name": "Turkey Standard Time",
3931 "abbr": "TDT",
3932 "offset": 3,
3933 "isdst": true,
3934 "text": "(UTC+02:00) Istanbul",
3935 "utc": [
3936 "Europe/Istanbul"
3937 ]
3938 },
3939 {
3940 "name": "Israel Standard Time",
3941 "abbr": "JDT",
3942 "offset": 3,
3943 "isdst": true,
3944 "text": "(UTC+02:00) Jerusalem",
3945 "utc": [
3946 "Asia/Jerusalem"
3947 ]
3948 },
3949 {
3950 "name": "Libya Standard Time",
3951 "abbr": "LST",
3952 "offset": 2,
3953 "isdst": false,
3954 "text": "(UTC+02:00) Tripoli",
3955 "utc": [
3956 "Africa/Tripoli"
3957 ]
3958 },
3959 {
3960 "name": "Jordan Standard Time",
3961 "abbr": "JST",
3962 "offset": 3,
3963 "isdst": false,
3964 "text": "(UTC+03:00) Amman",
3965 "utc": [
3966 "Asia/Amman"
3967 ]
3968 },
3969 {
3970 "name": "Arabic Standard Time",
3971 "abbr": "AST",
3972 "offset": 3,
3973 "isdst": false,
3974 "text": "(UTC+03:00) Baghdad",
3975 "utc": [
3976 "Asia/Baghdad"
3977 ]
3978 },
3979 {
3980 "name": "Kaliningrad Standard Time",
3981 "abbr": "KST",
3982 "offset": 3,
3983 "isdst": false,
3984 "text": "(UTC+03:00) Kaliningrad, Minsk",
3985 "utc": [
3986 "Europe/Kaliningrad",
3987 "Europe/Minsk"
3988 ]
3989 },
3990 {
3991 "name": "Arab Standard Time",
3992 "abbr": "AST",
3993 "offset": 3,
3994 "isdst": false,
3995 "text": "(UTC+03:00) Kuwait, Riyadh",
3996 "utc": [
3997 "Asia/Aden",
3998 "Asia/Bahrain",
3999 "Asia/Kuwait",
4000 "Asia/Qatar",
4001 "Asia/Riyadh"
4002 ]
4003 },
4004 {
4005 "name": "E. Africa Standard Time",
4006 "abbr": "EAST",
4007 "offset": 3,
4008 "isdst": false,
4009 "text": "(UTC+03:00) Nairobi",
4010 "utc": [
4011 "Africa/Addis_Ababa",
4012 "Africa/Asmera",
4013 "Africa/Dar_es_Salaam",
4014 "Africa/Djibouti",
4015 "Africa/Juba",
4016 "Africa/Kampala",
4017 "Africa/Khartoum",
4018 "Africa/Mogadishu",
4019 "Africa/Nairobi",
4020 "Antarctica/Syowa",
4021 "Etc/GMT-3",
4022 "Indian/Antananarivo",
4023 "Indian/Comoro",
4024 "Indian/Mayotte"
4025 ]
4026 },
4027 {
4028 "name": "Iran Standard Time",
4029 "abbr": "IDT",
4030 "offset": 4.5,
4031 "isdst": true,
4032 "text": "(UTC+03:30) Tehran",
4033 "utc": [
4034 "Asia/Tehran"
4035 ]
4036 },
4037 {
4038 "name": "Arabian Standard Time",
4039 "abbr": "AST",
4040 "offset": 4,
4041 "isdst": false,
4042 "text": "(UTC+04:00) Abu Dhabi, Muscat",
4043 "utc": [
4044 "Asia/Dubai",
4045 "Asia/Muscat",
4046 "Etc/GMT-4"
4047 ]
4048 },
4049 {
4050 "name": "Azerbaijan Standard Time",
4051 "abbr": "ADT",
4052 "offset": 5,
4053 "isdst": true,
4054 "text": "(UTC+04:00) Baku",
4055 "utc": [
4056 "Asia/Baku"
4057 ]
4058 },
4059 {
4060 "name": "Russian Standard Time",
4061 "abbr": "RST",
4062 "offset": 4,
4063 "isdst": false,
4064 "text": "(UTC+04:00) Moscow, St. Petersburg, Volgograd",
4065 "utc": [
4066 "Europe/Moscow",
4067 "Europe/Samara",
4068 "Europe/Simferopol",
4069 "Europe/Volgograd"
4070 ]
4071 },
4072 {
4073 "name": "Mauritius Standard Time",
4074 "abbr": "MST",
4075 "offset": 4,
4076 "isdst": false,
4077 "text": "(UTC+04:00) Port Louis",
4078 "utc": [
4079 "Indian/Mahe",
4080 "Indian/Mauritius",
4081 "Indian/Reunion"
4082 ]
4083 },
4084 {
4085 "name": "Georgian Standard Time",
4086 "abbr": "GST",
4087 "offset": 4,
4088 "isdst": false,
4089 "text": "(UTC+04:00) Tbilisi",
4090 "utc": [
4091 "Asia/Tbilisi"
4092 ]
4093 },
4094 {
4095 "name": "Caucasus Standard Time",
4096 "abbr": "CST",
4097 "offset": 4,
4098 "isdst": false,
4099 "text": "(UTC+04:00) Yerevan",
4100 "utc": [
4101 "Asia/Yerevan"
4102 ]
4103 },
4104 {
4105 "name": "Afghanistan Standard Time",
4106 "abbr": "AST",
4107 "offset": 4.5,
4108 "isdst": false,
4109 "text": "(UTC+04:30) Kabul",
4110 "utc": [
4111 "Asia/Kabul"
4112 ]
4113 },
4114 {
4115 "name": "West Asia Standard Time",
4116 "abbr": "WAST",
4117 "offset": 5,
4118 "isdst": false,
4119 "text": "(UTC+05:00) Ashgabat, Tashkent",
4120 "utc": [
4121 "Antarctica/Mawson",
4122 "Asia/Aqtau",
4123 "Asia/Aqtobe",
4124 "Asia/Ashgabat",
4125 "Asia/Dushanbe",
4126 "Asia/Oral",
4127 "Asia/Samarkand",
4128 "Asia/Tashkent",
4129 "Etc/GMT-5",
4130 "Indian/Kerguelen",
4131 "Indian/Maldives"
4132 ]
4133 },
4134 {
4135 "name": "Pakistan Standard Time",
4136 "abbr": "PST",
4137 "offset": 5,
4138 "isdst": false,
4139 "text": "(UTC+05:00) Islamabad, Karachi",
4140 "utc": [
4141 "Asia/Karachi"
4142 ]
4143 },
4144 {
4145 "name": "India Standard Time",
4146 "abbr": "IST",
4147 "offset": 5.5,
4148 "isdst": false,
4149 "text": "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",
4150 "utc": [
4151 "Asia/Calcutta"
4152 ]
4153 },
4154 {
4155 "name": "Sri Lanka Standard Time",
4156 "abbr": "SLST",
4157 "offset": 5.5,
4158 "isdst": false,
4159 "text": "(UTC+05:30) Sri Jayawardenepura",
4160 "utc": [
4161 "Asia/Colombo"
4162 ]
4163 },
4164 {
4165 "name": "Nepal Standard Time",
4166 "abbr": "NST",
4167 "offset": 5.75,
4168 "isdst": false,
4169 "text": "(UTC+05:45) Kathmandu",
4170 "utc": [
4171 "Asia/Katmandu"
4172 ]
4173 },
4174 {
4175 "name": "Central Asia Standard Time",
4176 "abbr": "CAST",
4177 "offset": 6,
4178 "isdst": false,
4179 "text": "(UTC+06:00) Astana",
4180 "utc": [
4181 "Antarctica/Vostok",
4182 "Asia/Almaty",
4183 "Asia/Bishkek",
4184 "Asia/Qyzylorda",
4185 "Asia/Urumqi",
4186 "Etc/GMT-6",
4187 "Indian/Chagos"
4188 ]
4189 },
4190 {
4191 "name": "Bangladesh Standard Time",
4192 "abbr": "BST",
4193 "offset": 6,
4194 "isdst": false,
4195 "text": "(UTC+06:00) Dhaka",
4196 "utc": [
4197 "Asia/Dhaka",
4198 "Asia/Thimphu"
4199 ]
4200 },
4201 {
4202 "name": "Ekaterinburg Standard Time",
4203 "abbr": "EST",
4204 "offset": 6,
4205 "isdst": false,
4206 "text": "(UTC+06:00) Ekaterinburg",
4207 "utc": [
4208 "Asia/Yekaterinburg"
4209 ]
4210 },
4211 {
4212 "name": "Myanmar Standard Time",
4213 "abbr": "MST",
4214 "offset": 6.5,
4215 "isdst": false,
4216 "text": "(UTC+06:30) Yangon (Rangoon)",
4217 "utc": [
4218 "Asia/Rangoon",
4219 "Indian/Cocos"
4220 ]
4221 },
4222 {
4223 "name": "SE Asia Standard Time",
4224 "abbr": "SAST",
4225 "offset": 7,
4226 "isdst": false,
4227 "text": "(UTC+07:00) Bangkok, Hanoi, Jakarta",
4228 "utc": [
4229 "Antarctica/Davis",
4230 "Asia/Bangkok",
4231 "Asia/Hovd",
4232 "Asia/Jakarta",
4233 "Asia/Phnom_Penh",
4234 "Asia/Pontianak",
4235 "Asia/Saigon",
4236 "Asia/Vientiane",
4237 "Etc/GMT-7",
4238 "Indian/Christmas"
4239 ]
4240 },
4241 {
4242 "name": "N. Central Asia Standard Time",
4243 "abbr": "NCAST",
4244 "offset": 7,
4245 "isdst": false,
4246 "text": "(UTC+07:00) Novosibirsk",
4247 "utc": [
4248 "Asia/Novokuznetsk",
4249 "Asia/Novosibirsk",
4250 "Asia/Omsk"
4251 ]
4252 },
4253 {
4254 "name": "China Standard Time",
4255 "abbr": "CST",
4256 "offset": 8,
4257 "isdst": false,
4258 "text": "(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",
4259 "utc": [
4260 "Asia/Hong_Kong",
4261 "Asia/Macau",
4262 "Asia/Shanghai"
4263 ]
4264 },
4265 {
4266 "name": "North Asia Standard Time",
4267 "abbr": "NAST",
4268 "offset": 8,
4269 "isdst": false,
4270 "text": "(UTC+08:00) Krasnoyarsk",
4271 "utc": [
4272 "Asia/Krasnoyarsk"
4273 ]
4274 },
4275 {
4276 "name": "Singapore Standard Time",
4277 "abbr": "MPST",
4278 "offset": 8,
4279 "isdst": false,
4280 "text": "(UTC+08:00) Kuala Lumpur, Singapore",
4281 "utc": [
4282 "Asia/Brunei",
4283 "Asia/Kuala_Lumpur",
4284 "Asia/Kuching",
4285 "Asia/Makassar",
4286 "Asia/Manila",
4287 "Asia/Singapore",
4288 "Etc/GMT-8"
4289 ]
4290 },
4291 {
4292 "name": "W. Australia Standard Time",
4293 "abbr": "WAST",
4294 "offset": 8,
4295 "isdst": false,
4296 "text": "(UTC+08:00) Perth",
4297 "utc": [
4298 "Antarctica/Casey",
4299 "Australia/Perth"
4300 ]
4301 },
4302 {
4303 "name": "Taipei Standard Time",
4304 "abbr": "TST",
4305 "offset": 8,
4306 "isdst": false,
4307 "text": "(UTC+08:00) Taipei",
4308 "utc": [
4309 "Asia/Taipei"
4310 ]
4311 },
4312 {
4313 "name": "Ulaanbaatar Standard Time",
4314 "abbr": "UST",
4315 "offset": 8,
4316 "isdst": false,
4317 "text": "(UTC+08:00) Ulaanbaatar",
4318 "utc": [
4319 "Asia/Choibalsan",
4320 "Asia/Ulaanbaatar"
4321 ]
4322 },
4323 {
4324 "name": "North Asia East Standard Time",
4325 "abbr": "NAEST",
4326 "offset": 9,
4327 "isdst": false,
4328 "text": "(UTC+09:00) Irkutsk",
4329 "utc": [
4330 "Asia/Irkutsk"
4331 ]
4332 },
4333 {
4334 "name": "Tokyo Standard Time",
4335 "abbr": "TST",
4336 "offset": 9,
4337 "isdst": false,
4338 "text": "(UTC+09:00) Osaka, Sapporo, Tokyo",
4339 "utc": [
4340 "Asia/Dili",
4341 "Asia/Jayapura",
4342 "Asia/Tokyo",
4343 "Etc/GMT-9",
4344 "Pacific/Palau"
4345 ]
4346 },
4347 {
4348 "name": "Korea Standard Time",
4349 "abbr": "KST",
4350 "offset": 9,
4351 "isdst": false,
4352 "text": "(UTC+09:00) Seoul",
4353 "utc": [
4354 "Asia/Pyongyang",
4355 "Asia/Seoul"
4356 ]
4357 },
4358 {
4359 "name": "Cen. Australia Standard Time",
4360 "abbr": "CAST",
4361 "offset": 9.5,
4362 "isdst": false,
4363 "text": "(UTC+09:30) Adelaide",
4364 "utc": [
4365 "Australia/Adelaide",
4366 "Australia/Broken_Hill"
4367 ]
4368 },
4369 {
4370 "name": "AUS Central Standard Time",
4371 "abbr": "ACST",
4372 "offset": 9.5,
4373 "isdst": false,
4374 "text": "(UTC+09:30) Darwin",
4375 "utc": [
4376 "Australia/Darwin"
4377 ]
4378 },
4379 {
4380 "name": "E. Australia Standard Time",
4381 "abbr": "EAST",
4382 "offset": 10,
4383 "isdst": false,
4384 "text": "(UTC+10:00) Brisbane",
4385 "utc": [
4386 "Australia/Brisbane",
4387 "Australia/Lindeman"
4388 ]
4389 },
4390 {
4391 "name": "AUS Eastern Standard Time",
4392 "abbr": "AEST",
4393 "offset": 10,
4394 "isdst": false,
4395 "text": "(UTC+10:00) Canberra, Melbourne, Sydney",
4396 "utc": [
4397 "Australia/Melbourne",
4398 "Australia/Sydney"
4399 ]
4400 },
4401 {
4402 "name": "West Pacific Standard Time",
4403 "abbr": "WPST",
4404 "offset": 10,
4405 "isdst": false,
4406 "text": "(UTC+10:00) Guam, Port Moresby",
4407 "utc": [
4408 "Antarctica/DumontDUrville",
4409 "Etc/GMT-10",
4410 "Pacific/Guam",
4411 "Pacific/Port_Moresby",
4412 "Pacific/Saipan",
4413 "Pacific/Truk"
4414 ]
4415 },
4416 {
4417 "name": "Tasmania Standard Time",
4418 "abbr": "TST",
4419 "offset": 10,
4420 "isdst": false,
4421 "text": "(UTC+10:00) Hobart",
4422 "utc": [
4423 "Australia/Currie",
4424 "Australia/Hobart"
4425 ]
4426 },
4427 {
4428 "name": "Yakutsk Standard Time",
4429 "abbr": "YST",
4430 "offset": 10,
4431 "isdst": false,
4432 "text": "(UTC+10:00) Yakutsk",
4433 "utc": [
4434 "Asia/Chita",
4435 "Asia/Khandyga",
4436 "Asia/Yakutsk"
4437 ]
4438 },
4439 {
4440 "name": "Central Pacific Standard Time",
4441 "abbr": "CPST",
4442 "offset": 11,
4443 "isdst": false,
4444 "text": "(UTC+11:00) Solomon Is., New Caledonia",
4445 "utc": [
4446 "Antarctica/Macquarie",
4447 "Etc/GMT-11",
4448 "Pacific/Efate",
4449 "Pacific/Guadalcanal",
4450 "Pacific/Kosrae",
4451 "Pacific/Noumea",
4452 "Pacific/Ponape"
4453 ]
4454 },
4455 {
4456 "name": "Vladivostok Standard Time",
4457 "abbr": "VST",
4458 "offset": 11,
4459 "isdst": false,
4460 "text": "(UTC+11:00) Vladivostok",
4461 "utc": [
4462 "Asia/Sakhalin",
4463 "Asia/Ust-Nera",
4464 "Asia/Vladivostok"
4465 ]
4466 },
4467 {
4468 "name": "New Zealand Standard Time",
4469 "abbr": "NZST",
4470 "offset": 12,
4471 "isdst": false,
4472 "text": "(UTC+12:00) Auckland, Wellington",
4473 "utc": [
4474 "Antarctica/McMurdo",
4475 "Pacific/Auckland"
4476 ]
4477 },
4478 {
4479 "name": "UTC+12",
4480 "abbr": "U",
4481 "offset": 12,
4482 "isdst": false,
4483 "text": "(UTC+12:00) Coordinated Universal Time+12",
4484 "utc": [
4485 "Etc/GMT-12",
4486 "Pacific/Funafuti",
4487 "Pacific/Kwajalein",
4488 "Pacific/Majuro",
4489 "Pacific/Nauru",
4490 "Pacific/Tarawa",
4491 "Pacific/Wake",
4492 "Pacific/Wallis"
4493 ]
4494 },
4495 {
4496 "name": "Fiji Standard Time",
4497 "abbr": "FST",
4498 "offset": 12,
4499 "isdst": false,
4500 "text": "(UTC+12:00) Fiji",
4501 "utc": [
4502 "Pacific/Fiji"
4503 ]
4504 },
4505 {
4506 "name": "Magadan Standard Time",
4507 "abbr": "MST",
4508 "offset": 12,
4509 "isdst": false,
4510 "text": "(UTC+12:00) Magadan",
4511 "utc": [
4512 "Asia/Anadyr",
4513 "Asia/Kamchatka",
4514 "Asia/Magadan",
4515 "Asia/Srednekolymsk"
4516 ]
4517 },
4518 {
4519 "name": "Kamchatka Standard Time",
4520 "abbr": "KDT",
4521 "offset": 13,
4522 "isdst": true,
4523 "text": "(UTC+12:00) Petropavlovsk-Kamchatsky - Old"
4524 },
4525 {
4526 "name": "Tonga Standard Time",
4527 "abbr": "TST",
4528 "offset": 13,
4529 "isdst": false,
4530 "text": "(UTC+13:00) Nuku'alofa",
4531 "utc": [
4532 "Etc/GMT-13",
4533 "Pacific/Enderbury",
4534 "Pacific/Fakaofo",
4535 "Pacific/Tongatapu"
4536 ]
4537 },
4538 {
4539 "name": "Samoa Standard Time",
4540 "abbr": "SST",
4541 "offset": 13,
4542 "isdst": false,
4543 "text": "(UTC+13:00) Samoa",
4544 "utc": [
4545 "Pacific/Apia"
4546 ]
4547 }
4548 ]
4549 };
4550
4551 var o_hasOwnProperty = Object.prototype.hasOwnProperty;
4552 var o_keys = (Object.keys || function(obj) {
4553 var result = [];
4554 for (var key in obj) {
4555 if (o_hasOwnProperty.call(obj, key)) {
4556 result.push(key);
4557 }
4558 }
4559
4560 return result;
4561 });
4562
4563 function _copyObject(source, target) {
4564 var keys = o_keys(source);
4565 var key;
4566
4567 for (var i = 0, l = keys.length; i < l; i++) {
4568 key = keys[i];
4569 target[key] = source[key] || target[key];
4570 }
4571 }
4572
4573 function _copyArray(source, target) {
4574 for (var i = 0, l = source.length; i < l; i++) {
4575 target[i] = source[i];
4576 }
4577 }
4578
4579 function copyObject(source, _target) {
4580 var isArray = Array.isArray(source);
4581 var target = _target || (isArray ? new Array(source.length) : {});
4582
4583 if (isArray) {
4584 _copyArray(source, target);
4585 } else {
4586 _copyObject(source, target);
4587 }
4588
4589 return target;
4590 }
4591
4592 /** Get the data based on key**/
4593 Chance.prototype.get = function (name) {
4594 return copyObject(data[name]);
4595 };
4596
4597 // Mac Address
4598 Chance.prototype.mac_address = function(options){
4599 // typically mac addresses are separated by ":"
4600 // however they can also be separated by "-"
4601 // the network variant uses a dot every fourth byte
4602
4603 options = initOptions(options);
4604 if(!options.separator) {
4605 options.separator = options.networkVersion ? "." : ":";
4606 }
4607
4608 var mac_pool="ABCDEF1234567890",
4609 mac = "";
4610 if(!options.networkVersion) {
4611 mac = this.n(this.string, 6, { pool: mac_pool, length:2 }).join(options.separator);
4612 } else {
4613 mac = this.n(this.string, 3, { pool: mac_pool, length:4 }).join(options.separator);
4614 }
4615
4616 return mac;
4617 };
4618
4619 Chance.prototype.normal = function (options) {
4620 options = initOptions(options, {mean : 0, dev : 1, pool : []});
4621
4622 testRange(
4623 options.pool.constructor !== Array,
4624 "Chance: The pool option must be a valid array."
4625 );
4626
4627 // If a pool has been passed, then we are returning an item from that pool,
4628 // using the normal distribution settings that were passed in
4629 if (options.pool.length > 0) {
4630 return this.normal_pool(options);
4631 }
4632
4633 // The Marsaglia Polar method
4634 var s, u, v, norm,
4635 mean = options.mean,
4636 dev = options.dev;
4637
4638 do {
4639 // U and V are from the uniform distribution on (-1, 1)
4640 u = this.random() * 2 - 1;
4641 v = this.random() * 2 - 1;
4642
4643 s = u * u + v * v;
4644 } while (s >= 1);
4645
4646 // Compute the standard normal variate
4647 norm = u * Math.sqrt(-2 * Math.log(s) / s);
4648
4649 // Shape and scale
4650 return dev * norm + mean;
4651 };
4652
4653 Chance.prototype.normal_pool = function(options) {
4654 var performanceCounter = 0;
4655 do {
4656 var idx = Math.round(this.normal({ mean: options.mean, dev: options.dev }));
4657 if (idx < options.pool.length && idx >= 0) {
4658 return options.pool[idx];
4659 } else {
4660 performanceCounter++;
4661 }
4662 } while(performanceCounter < 100);
4663
4664 throw new RangeError("Chance: Your pool is too small for the given mean and standard deviation. Please adjust.");
4665 };
4666
4667 Chance.prototype.radio = function (options) {
4668 // Initial Letter (Typically Designated by Side of Mississippi River)
4669 options = initOptions(options, {side : "?"});
4670 var fl = "";
4671 switch (options.side.toLowerCase()) {
4672 case "east":
4673 case "e":
4674 fl = "W";
4675 break;
4676 case "west":
4677 case "w":
4678 fl = "K";
4679 break;
4680 default:
4681 fl = this.character({pool: "KW"});
4682 break;
4683 }
4684
4685 return fl + this.character({alpha: true, casing: "upper"}) +
4686 this.character({alpha: true, casing: "upper"}) +
4687 this.character({alpha: true, casing: "upper"});
4688 };
4689
4690 // Set the data as key and data or the data map
4691 Chance.prototype.set = function (name, values) {
4692 if (typeof name === "string") {
4693 data[name] = values;
4694 } else {
4695 data = copyObject(name, data);
4696 }
4697 };
4698
4699 Chance.prototype.tv = function (options) {
4700 return this.radio(options);
4701 };
4702
4703 // ID number for Brazil companies
4704 Chance.prototype.cnpj = function () {
4705 var n = this.n(this.natural, 8, { max: 9 });
4706 var d1 = 2+n[7]*6+n[6]*7+n[5]*8+n[4]*9+n[3]*2+n[2]*3+n[1]*4+n[0]*5;
4707 d1 = 11 - (d1 % 11);
4708 if (d1>=10){
4709 d1 = 0;
4710 }
4711 var d2 = d1*2+3+n[7]*7+n[6]*8+n[5]*9+n[4]*2+n[3]*3+n[2]*4+n[1]*5+n[0]*6;
4712 d2 = 11 - (d2 % 11);
4713 if (d2>=10){
4714 d2 = 0;
4715 }
4716 return ''+n[0]+n[1]+'.'+n[2]+n[3]+n[4]+'.'+n[5]+n[6]+n[7]+'/0001-'+d1+d2;
4717 };
4718
4719 // -- End Miscellaneous --
4720
4721 Chance.prototype.mersenne_twister = function (seed) {
4722 return new MersenneTwister(seed);
4723 };
4724
4725 Chance.prototype.blueimp_md5 = function () {
4726 return new BlueImpMD5();
4727 };
4728
4729 // Mersenne Twister from https://gist.github.com/banksean/300494
4730 var MersenneTwister = function (seed) {
4731 if (seed === undefined) {
4732 // kept random number same size as time used previously to ensure no unexpected results downstream
4733 seed = Math.floor(Math.random()*Math.pow(10,13));
4734 }
4735 /* Period parameters */
4736 this.N = 624;
4737 this.M = 397;
4738 this.MATRIX_A = 0x9908b0df; /* constant vector a */
4739 this.UPPER_MASK = 0x80000000; /* most significant w-r bits */
4740 this.LOWER_MASK = 0x7fffffff; /* least significant r bits */
4741
4742 this.mt = new Array(this.N); /* the array for the state vector */
4743 this.mti = this.N + 1; /* mti==N + 1 means mt[N] is not initialized */
4744
4745 this.init_genrand(seed);
4746 };
4747
4748 /* initializes mt[N] with a seed */
4749 MersenneTwister.prototype.init_genrand = function (s) {
4750 this.mt[0] = s >>> 0;
4751 for (this.mti = 1; this.mti < this.N; this.mti++) {
4752 s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);
4753 this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253) + this.mti;
4754 /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
4755 /* In the previous versions, MSBs of the seed affect */
4756 /* only MSBs of the array mt[]. */
4757 /* 2002/01/09 modified by Makoto Matsumoto */
4758 this.mt[this.mti] >>>= 0;
4759 /* for >32 bit machines */
4760 }
4761 };
4762
4763 /* initialize by an array with array-length */
4764 /* init_key is the array for initializing keys */
4765 /* key_length is its length */
4766 /* slight change for C++, 2004/2/26 */
4767 MersenneTwister.prototype.init_by_array = function (init_key, key_length) {
4768 var i = 1, j = 0, k, s;
4769 this.init_genrand(19650218);
4770 k = (this.N > key_length ? this.N : key_length);
4771 for (; k; k--) {
4772 s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);
4773 this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525))) + init_key[j] + j; /* non linear */
4774 this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */
4775 i++;
4776 j++;
4777 if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; }
4778 if (j >= key_length) { j = 0; }
4779 }
4780 for (k = this.N - 1; k; k--) {
4781 s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);
4782 this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941)) - i; /* non linear */
4783 this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */
4784 i++;
4785 if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; }
4786 }
4787
4788 this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */
4789 };
4790
4791 /* generates a random number on [0,0xffffffff]-interval */
4792 MersenneTwister.prototype.genrand_int32 = function () {
4793 var y;
4794 var mag01 = new Array(0x0, this.MATRIX_A);
4795 /* mag01[x] = x * MATRIX_A for x=0,1 */
4796
4797 if (this.mti >= this.N) { /* generate N words at one time */
4798 var kk;
4799
4800 if (this.mti === this.N + 1) { /* if init_genrand() has not been called, */
4801 this.init_genrand(5489); /* a default initial seed is used */
4802 }
4803 for (kk = 0; kk < this.N - this.M; kk++) {
4804 y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk + 1]&this.LOWER_MASK);
4805 this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];
4806 }
4807 for (;kk < this.N - 1; kk++) {
4808 y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk + 1]&this.LOWER_MASK);
4809 this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];
4810 }
4811 y = (this.mt[this.N - 1]&this.UPPER_MASK)|(this.mt[0]&this.LOWER_MASK);
4812 this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];
4813
4814 this.mti = 0;
4815 }
4816
4817 y = this.mt[this.mti++];
4818
4819 /* Tempering */
4820 y ^= (y >>> 11);
4821 y ^= (y << 7) & 0x9d2c5680;
4822 y ^= (y << 15) & 0xefc60000;
4823 y ^= (y >>> 18);
4824
4825 return y >>> 0;
4826 };
4827
4828 /* generates a random number on [0,0x7fffffff]-interval */
4829 MersenneTwister.prototype.genrand_int31 = function () {
4830 return (this.genrand_int32() >>> 1);
4831 };
4832
4833 /* generates a random number on [0,1]-real-interval */
4834 MersenneTwister.prototype.genrand_real1 = function () {
4835 return this.genrand_int32() * (1.0 / 4294967295.0);
4836 /* divided by 2^32-1 */
4837 };
4838
4839 /* generates a random number on [0,1)-real-interval */
4840 MersenneTwister.prototype.random = function () {
4841 return this.genrand_int32() * (1.0 / 4294967296.0);
4842 /* divided by 2^32 */
4843 };
4844
4845 /* generates a random number on (0,1)-real-interval */
4846 MersenneTwister.prototype.genrand_real3 = function () {
4847 return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0);
4848 /* divided by 2^32 */
4849 };
4850
4851 /* generates a random number on [0,1) with 53-bit resolution*/
4852 MersenneTwister.prototype.genrand_res53 = function () {
4853 var a = this.genrand_int32()>>>5, b = this.genrand_int32()>>>6;
4854 return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
4855 };
4856
4857 // BlueImp MD5 hashing algorithm from https://github.com/blueimp/JavaScript-MD5
4858 var BlueImpMD5 = function () {};
4859
4860 BlueImpMD5.prototype.VERSION = '1.0.1';
4861
4862 /*
4863 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
4864 * to work around bugs in some JS interpreters.
4865 */
4866 BlueImpMD5.prototype.safe_add = function safe_add(x, y) {
4867 var lsw = (x & 0xFFFF) + (y & 0xFFFF),
4868 msw = (x >> 16) + (y >> 16) + (lsw >> 16);
4869 return (msw << 16) | (lsw & 0xFFFF);
4870 };
4871
4872 /*
4873 * Bitwise rotate a 32-bit number to the left.
4874 */
4875 BlueImpMD5.prototype.bit_roll = function (num, cnt) {
4876 return (num << cnt) | (num >>> (32 - cnt));
4877 };
4878
4879 /*
4880 * These functions implement the five basic operations the algorithm uses.
4881 */
4882 BlueImpMD5.prototype.md5_cmn = function (q, a, b, x, s, t) {
4883 return this.safe_add(this.bit_roll(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
4884 };
4885 BlueImpMD5.prototype.md5_ff = function (a, b, c, d, x, s, t) {
4886 return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
4887 };
4888 BlueImpMD5.prototype.md5_gg = function (a, b, c, d, x, s, t) {
4889 return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
4890 };
4891 BlueImpMD5.prototype.md5_hh = function (a, b, c, d, x, s, t) {
4892 return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
4893 };
4894 BlueImpMD5.prototype.md5_ii = function (a, b, c, d, x, s, t) {
4895 return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
4896 };
4897
4898 /*
4899 * Calculate the MD5 of an array of little-endian words, and a bit length.
4900 */
4901 BlueImpMD5.prototype.binl_md5 = function (x, len) {
4902 /* append padding */
4903 x[len >> 5] |= 0x80 << (len % 32);
4904 x[(((len + 64) >>> 9) << 4) + 14] = len;
4905
4906 var i, olda, oldb, oldc, oldd,
4907 a = 1732584193,
4908 b = -271733879,
4909 c = -1732584194,
4910 d = 271733878;
4911
4912 for (i = 0; i < x.length; i += 16) {
4913 olda = a;
4914 oldb = b;
4915 oldc = c;
4916 oldd = d;
4917
4918 a = this.md5_ff(a, b, c, d, x[i], 7, -680876936);
4919 d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
4920 c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
4921 b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
4922 a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
4923 d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
4924 c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
4925 b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
4926 a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
4927 d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
4928 c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063);
4929 b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
4930 a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
4931 d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
4932 c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
4933 b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
4934
4935 a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
4936 d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
4937 c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
4938 b = this.md5_gg(b, c, d, a, x[i], 20, -373897302);
4939 a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
4940 d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
4941 c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
4942 b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
4943 a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
4944 d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
4945 c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
4946 b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
4947 a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
4948 d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
4949 c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
4950 b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
4951
4952 a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558);
4953 d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
4954 c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
4955 b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
4956 a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
4957 d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
4958 c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
4959 b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
4960 a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
4961 d = this.md5_hh(d, a, b, c, x[i], 11, -358537222);
4962 c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
4963 b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
4964 a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
4965 d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
4966 c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
4967 b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
4968
4969 a = this.md5_ii(a, b, c, d, x[i], 6, -198630844);
4970 d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
4971 c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
4972 b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
4973 a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
4974 d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
4975 c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
4976 b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
4977 a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
4978 d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
4979 c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
4980 b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
4981 a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
4982 d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
4983 c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
4984 b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
4985
4986 a = this.safe_add(a, olda);
4987 b = this.safe_add(b, oldb);
4988 c = this.safe_add(c, oldc);
4989 d = this.safe_add(d, oldd);
4990 }
4991 return [a, b, c, d];
4992 };
4993
4994 /*
4995 * Convert an array of little-endian words to a string
4996 */
4997 BlueImpMD5.prototype.binl2rstr = function (input) {
4998 var i,
4999 output = '';
5000 for (i = 0; i < input.length * 32; i += 8) {
5001 output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
5002 }
5003 return output;
5004 };
5005
5006 /*
5007 * Convert a raw string to an array of little-endian words
5008 * Characters >255 have their high-byte silently ignored.
5009 */
5010 BlueImpMD5.prototype.rstr2binl = function (input) {
5011 var i,
5012 output = [];
5013 output[(input.length >> 2) - 1] = undefined;
5014 for (i = 0; i < output.length; i += 1) {
5015 output[i] = 0;
5016 }
5017 for (i = 0; i < input.length * 8; i += 8) {
5018 output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
5019 }
5020 return output;
5021 };
5022
5023 /*
5024 * Calculate the MD5 of a raw string
5025 */
5026 BlueImpMD5.prototype.rstr_md5 = function (s) {
5027 return this.binl2rstr(this.binl_md5(this.rstr2binl(s), s.length * 8));
5028 };
5029
5030 /*
5031 * Calculate the HMAC-MD5, of a key and some data (raw strings)
5032 */
5033 BlueImpMD5.prototype.rstr_hmac_md5 = function (key, data) {
5034 var i,
5035 bkey = this.rstr2binl(key),
5036 ipad = [],
5037 opad = [],
5038 hash;
5039 ipad[15] = opad[15] = undefined;
5040 if (bkey.length > 16) {
5041 bkey = this.binl_md5(bkey, key.length * 8);
5042 }
5043 for (i = 0; i < 16; i += 1) {
5044 ipad[i] = bkey[i] ^ 0x36363636;
5045 opad[i] = bkey[i] ^ 0x5C5C5C5C;
5046 }
5047 hash = this.binl_md5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8);
5048 return this.binl2rstr(this.binl_md5(opad.concat(hash), 512 + 128));
5049 };
5050
5051 /*
5052 * Convert a raw string to a hex string
5053 */
5054 BlueImpMD5.prototype.rstr2hex = function (input) {
5055 var hex_tab = '0123456789abcdef',
5056 output = '',
5057 x,
5058 i;
5059 for (i = 0; i < input.length; i += 1) {
5060 x = input.charCodeAt(i);
5061 output += hex_tab.charAt((x >>> 4) & 0x0F) +
5062 hex_tab.charAt(x & 0x0F);
5063 }
5064 return output;
5065 };
5066
5067 /*
5068 * Encode a string as utf-8
5069 */
5070 BlueImpMD5.prototype.str2rstr_utf8 = function (input) {
5071 return unescape(encodeURIComponent(input));
5072 };
5073
5074 /*
5075 * Take string arguments and return either raw or hex encoded strings
5076 */
5077 BlueImpMD5.prototype.raw_md5 = function (s) {
5078 return this.rstr_md5(this.str2rstr_utf8(s));
5079 };
5080 BlueImpMD5.prototype.hex_md5 = function (s) {
5081 return this.rstr2hex(this.raw_md5(s));
5082 };
5083 BlueImpMD5.prototype.raw_hmac_md5 = function (k, d) {
5084 return this.rstr_hmac_md5(this.str2rstr_utf8(k), this.str2rstr_utf8(d));
5085 };
5086 BlueImpMD5.prototype.hex_hmac_md5 = function (k, d) {
5087 return this.rstr2hex(this.raw_hmac_md5(k, d));
5088 };
5089
5090 BlueImpMD5.prototype.md5 = function (string, key, raw) {
5091 if (!key) {
5092 if (!raw) {
5093 return this.hex_md5(string);
5094 }
5095
5096 return this.raw_md5(string);
5097 }
5098
5099 if (!raw) {
5100 return this.hex_hmac_md5(key, string);
5101 }
5102
5103 return this.raw_hmac_md5(key, string);
5104 };
5105
5106 // CommonJS module
5107 if (typeof exports !== 'undefined') {
5108 if (typeof module !== 'undefined' && module.exports) {
5109 exports = module.exports = Chance;
5110 }
5111 exports.Chance = Chance;
5112 }
5113
5114 // Register as an anonymous AMD module
5115 if (typeof define === 'function' && define.amd) {
5116 define([], function () {
5117 return Chance;
5118 });
5119 }
5120
5121 // if there is a importsScrips object define chance for worker
5122 if (typeof importScripts !== 'undefined') {
5123 chance = new Chance();
5124 }
5125
5126 // If there is a window object, that at least has a document property,
5127 // instantiate and define chance on the window
5128 if (typeof window === "object" && typeof window.document === "object") {
5129 window.Chance = Chance;
5130 window.chance = new Chance();
5131 }
5132})();