UNPKG

tempmail.js

Version:

Programatically generate and receive mail from temporary email addresses. Works in browsers and in node.js.

1 lines 213 kB
(function(a){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return a[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=a,e.c=n,e.d=function(a,n,i){e.o(a,n)||Object.defineProperty(a,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(a){var n=a&&a.__esModule?function(){return a['default']}:function(){return a};return e.d(n,'a',n),n},e.o=function(a,e){return Object.prototype.hasOwnProperty.call(a,e)},e.p='',e(e.s=1)})([function(a,e){'use strict';Object.defineProperty(e,'__esModule',{value:!0});var n=e.IS_NODE='undefined'==typeof window,i=e.API_BASE='https://api.temp-mail.ru/request/',r=e.API_FORMAT='/format/'+(n?'json':'jsonp?callback=messages'),o=e.ENDPOINT_INBOX='mail/id',t=e.ENDPOINT_DOMAINS='domains',s=e.ENDPOINT_DELETE='delete/id'},function(a,e,n){'use strict';function i(a){return function(){var e=a.apply(this,arguments);return new Promise(function(a,n){function i(r,o){try{var t=e[r](o),s=t.value}catch(a){return void n(a)}return t.done?void a(s):Promise.resolve(s).then(function(a){i('next',a)},function(a){i('throw',a)})}return i('next')})}}function r(a,e){if(!(a instanceof e))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(e,'__esModule',{value:!0});var o=function(){function a(a,e){for(var n=0,i;n<e.length;n++)i=e[n],i.enumerable=i.enumerable||!1,i.configurable=!0,'value'in i&&(i.writable=!0),Object.defineProperty(a,i.key,i)}return function(e,n,i){return n&&a(e.prototype,n),i&&a(e,i),e}}();n(2),n(4);var t=n(0),s=n(5),l=function(){function a(e){var n=this;r(this,a),this.active=!1,this._useOrCreateEmail(e).then(function(a){if(!a)throw new Error('Address unable to be created');n.address=a,n.address_id=(0,s.emailId)(n.address),n.fetch=t.IS_NODE?fetch:fetchJsonp,n.active=!0})}return o(a,[{key:'getMail',value:function(){var a=i(regeneratorRuntime.mark(function a(){var e,n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.fetch((0,s.inboxURL)(this.address_id));case 3:return e=a.sent,a.next=6,e.json();case 6:if(n=a.sent,!n.length){a.next=9;break}return a.abrupt('return',n.map(s.formatMessage));case 9:return a.abrupt('return',n);case 12:a.prev=12,a.t0=a['catch'](0),console.error(a.t0);case 15:return a.abrupt('return',[]);case 16:case'end':return a.stop();}},a,this,[[0,12]])}));return function(){return a.apply(this,arguments)}}()},{key:'domains',value:function(){var a=i(regeneratorRuntime.mark(function a(){var e;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.fetch((0,s.domainsURL)());case 3:return e=a.sent,a.next=6,e.json();case 6:return a.abrupt('return',a.sent);case 9:a.prev=9,a.t0=a['catch'](0),console.error(a.t0);case 12:return a.abrupt('return',[]);case 13:case'end':return a.stop();}},a,this,[[0,9]])}));return function(){return a.apply(this,arguments)}}()},{key:'deleteMessage',value:function(){var a=i(regeneratorRuntime.mark(function a(e){var n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.fetch((0,s.deleteMessageURL)(e));case 3:return n=a.sent,a.next=6,n.json();case 6:return a.abrupt('return',a.sent);case 9:a.prev=9,a.t0=a['catch'](0),console.error(a.t0);case 12:return a.abrupt('return',[]);case 13:case'end':return a.stop();}},a,this,[[0,9]])}));return function(){return a.apply(this,arguments)}}()},{key:'_useOrCreateEmail',value:function(){var a=i(regeneratorRuntime.mark(function a(e){var n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!e.includes('@')){a.next=2;break}return a.abrupt('return',e);case 2:return a.prev=2,a.next=5,this.domains();case 5:return n=a.sent,a.abrupt('return',e+'@'+chance.pickone(n));case 9:a.prev=9,a.t0=a['catch'](2),console.error(a.t0);case 12:return a.abrupt('return',!1);case 13:case'end':return a.stop();}},a,this,[[2,9]])}));return function(){return a.apply(this,arguments)}}()}]),a}();e.default=l},function(a,e,n){n(3),a.exports=self.fetch.bind(self)},function(){(function(a){'use strict';function e(a){if('string'!=typeof a&&(a+=''),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(a))throw new TypeError('Invalid character in header field name');return a.toLowerCase()}function n(a){return'string'!=typeof a&&(a+=''),a}function i(a){var e={next:function(){var e=a.shift();return{done:void 0===e,value:e}}};return C.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(a){this.map={},a instanceof r?a.forEach(function(a,e){this.append(e,a)},this):Array.isArray(a)?a.forEach(function(a){this.append(a[0],a[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(e){this.append(e,a[e])},this)}function o(a){return a.bodyUsed?Promise.reject(new TypeError('Already read')):void(a.bodyUsed=!0)}function t(a){return new Promise(function(e,n){a.onload=function(){e(a.result)},a.onerror=function(){n(a.error)}})}function s(a){var e=new FileReader,n=t(e);return e.readAsArrayBuffer(a),n}function l(a){var e=new FileReader,n=t(e);return e.readAsText(a),n}function c(a){for(var e=new Uint8Array(a),n=Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join('')}function m(a){if(a.slice)return a.slice(0);var e=new Uint8Array(a.byteLength);return e.set(new Uint8Array(a)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(a){if(this._bodyInit=a,!a)this._bodyText='';else if('string'==typeof a)this._bodyText=a;else if(C.blob&&Blob.prototype.isPrototypeOf(a))this._bodyBlob=a;else if(C.formData&&FormData.prototype.isPrototypeOf(a))this._bodyFormData=a;else if(C.searchParams&&URLSearchParams.prototype.isPrototypeOf(a))this._bodyText=a.toString();else if(C.arrayBuffer&&C.blob&&y(a))this._bodyArrayBuffer=m(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else if(C.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(a)||S(a)))this._bodyArrayBuffer=m(a);else throw new Error('unsupported BodyInit type');this.headers.get('content-type')||('string'==typeof a?this.headers.set('content-type','text/plain;charset=UTF-8'):this._bodyBlob&&this._bodyBlob.type?this.headers.set('content-type',this._bodyBlob.type):C.searchParams&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set('content-type','application/x-www-form-urlencoded;charset=UTF-8'))},C.blob&&(this.blob=function(){var a=o(this);if(a)return a;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error('could not read FormData body as blob');else return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var a=o(this);if(a)return a;if(this._bodyBlob)return l(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(c(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error('could not read FormData body as text');else return Promise.resolve(this._bodyText)},C.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}function u(a){var e=a.toUpperCase();return-1<A.indexOf(e)?e:a}function p(a,e){e=e||{};var n=e.body;if(a instanceof p){if(a.bodyUsed)throw new TypeError('Already read');this.url=a.url,this.credentials=a.credentials,e.headers||(this.headers=new r(a.headers)),this.method=a.method,this.mode=a.mode,n||null==a._bodyInit||(n=a._bodyInit,a.bodyUsed=!0)}else this.url=a+'';if(this.credentials=e.credentials||this.credentials||'omit',(e.headers||!this.headers)&&(this.headers=new r(e.headers)),this.method=u(e.method||this.method||'GET'),this.mode=e.mode||this.mode||null,this.referrer=null,('GET'===this.method||'HEAD'===this.method)&&n)throw new TypeError('Body not allowed for GET or HEAD requests');this._initBody(n)}function b(a){var e=new FormData;return a.trim().split('&').forEach(function(a){if(a){var n=a.split('='),i=n.shift().replace(/\+/g,' '),r=n.join('=').replace(/\+/g,' ');e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function h(a){var e=new r;return a.split(/\r?\n/).forEach(function(a){var n=a.split(':'),i=n.shift().trim();if(i){var r=n.join(':').trim();e.append(i,r)}}),e}function g(a,e){e||(e={}),this.type='default',this.status='status'in e?e.status:200,this.ok=200<=this.status&&300>this.status,this.statusText='statusText'in e?e.statusText:'OK',this.headers=new r(e.headers),this.url=e.url||'',this._initBody(a)}if(!a.fetch){var C={searchParams:'URLSearchParams'in a,iterable:'Symbol'in a&&'iterator'in Symbol,blob:'FileReader'in a&&'Blob'in a&&function(){try{return new Blob,!0}catch(a){return!1}}(),formData:'FormData'in a,arrayBuffer:'ArrayBuffer'in a};if(C.arrayBuffer)var f=['[object Int8Array]','[object Uint8Array]','[object Uint8ClampedArray]','[object Int16Array]','[object Uint16Array]','[object Int32Array]','[object Uint32Array]','[object Float32Array]','[object Float64Array]'],y=function(a){return a&&DataView.prototype.isPrototypeOf(a)},S=ArrayBuffer.isView||function(a){return a&&-1<f.indexOf(Object.prototype.toString.call(a))};r.prototype.append=function(a,i){a=e(a),i=n(i);var r=this.map[a];this.map[a]=r?r+','+i:i},r.prototype['delete']=function(a){delete this.map[e(a)]},r.prototype.get=function(a){return a=e(a),this.has(a)?this.map[a]:null},r.prototype.has=function(a){return this.map.hasOwnProperty(e(a))},r.prototype.set=function(a,i){this.map[e(a)]=n(i)},r.prototype.forEach=function(a,e){for(var n in this.map)this.map.hasOwnProperty(n)&&a.call(e,this.map[n],n,this)},r.prototype.keys=function(){var a=[];return this.forEach(function(e,n){a.push(n)}),i(a)},r.prototype.values=function(){var a=[];return this.forEach(function(e){a.push(e)}),i(a)},r.prototype.entries=function(){var a=[];return this.forEach(function(e,n){a.push([n,e])}),i(a)},C.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var A=['DELETE','GET','HEAD','OPTIONS','POST','PUT'];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},d.call(p.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},g.error=function(){var a=new g(null,{status:0,statusText:''});return a.type='error',a};var v=[301,302,303,307,308];g.redirect=function(a,e){if(-1===v.indexOf(e))throw new RangeError('Invalid status code');return new g(null,{status:e,headers:{location:a}})},a.Headers=r,a.Request=p,a.Response=g,a.fetch=function(a,e){return new Promise(function(n,i){var r=new p(a,e),o=new XMLHttpRequest;o.onload=function(){var a={status:o.status,statusText:o.statusText,headers:h(o.getAllResponseHeaders()||'')};a.url='responseURL'in o?o.responseURL:a.headers.get('X-Request-URL');var e='response'in o?o.response:o.responseText;n(new g(e,a))},o.onerror=function(){i(new TypeError('Network request failed'))},o.ontimeout=function(){i(new TypeError('Network request failed'))},o.open(r.method,r.url,!0),'include'===r.credentials&&(o.withCredentials=!0),'responseType'in o&&C.blob&&(o.responseType='blob'),r.headers.forEach(function(a,e){o.setRequestHeader(e,a)}),o.send('undefined'==typeof r._bodyInit?null:r._bodyInit)})},a.fetch.polyfill=!0}})('undefined'==typeof self?this:self)},function(a,e){var n,i,r;(function(o,t){i=[e,a],n=t,r='function'==typeof n?n.apply(e,i):n,!(void 0!==r&&(a.exports=r))})(this,function(a,e){'use strict';function n(){return'jsonp_'+Date.now()+'_'+Math.ceil(1e5*Math.random())}function i(a){try{delete window[a]}catch(n){window[a]=void 0}}function r(a){var e=document.getElementById(a);e&&document.getElementsByTagName('head')[0].removeChild(e)}var o={timeout:5e3,jsonpCallback:'callback',jsonpCallbackFunction:null};e.exports=function(a){var e=1>=arguments.length||arguments[1]===void 0?{}:arguments[1],t=a,s=e.timeout||o.timeout,l=e.jsonpCallback||o.jsonpCallback,c;return new Promise(function(o,m){var d=e.jsonpCallbackFunction||n(),u=l+'_'+d;window[d]=function(a){o({ok:!0,json:function(){return Promise.resolve(a)}}),c&&clearTimeout(c),r(u),i(d)},t+=-1===t.indexOf('?')?'?':'&';var p=document.createElement('script');p.setAttribute('src',''+t+l+'='+d),e.charset&&p.setAttribute('charset',e.charset),p.id=u,document.getElementsByTagName('head')[0].appendChild(p),c=setTimeout(function(){m(new Error('JSONP request to '+a+' timed out')),i(d),r(u),window[d]=function(){i(d)}},s),p.onerror=function(){m(new Error('JSONP request to '+a+' failed')),i(d),r(u),c&&clearTimeout(c)}})}})},function(a,e,n){'use strict';function i(a){return t.API_BASE+a+t.API_FORMAT}Object.defineProperty(e,'__esModule',{value:!0}),e.formatMessage=function(a){return{id:a.mail_id,uid:a.mail_unique_id,from:a.mail_from,subject:a.mail_subject,preview:a.mail_preview,text:a.mail_preview.replace(/\s/g,' ').trim(),text_only:a.mail_text_only,html:a.mail_html,timestamp:new Date(parseInt(a.mail_timestamp+'000'))}},e.randomEmailPrefix=function(){var a=o.default.name({middle_initial:!0}).toLowerCase().split(' ').join('.'),e=o.default.integer({min:1970,max:new Date().getFullYear()-8});return a+'-'+e},e.emailId=function(a){var e=a.split('').map(function(a){return a.codePointAt(0)}).join('');return parseInt(e).toString(16).substr(2,12)},e.endpoint=i,e.inboxURL=function(a){return i(t.ENDPOINT_INBOX+'/'+a)},e.domainsURL=function(){return i(t.ENDPOINT_DOMAINS)},e.deleteMessageURL=function(a){return i(t.ENDPOINT_DELETE+'/'+a)};var r=n(6),o=function(a){return a&&a.__esModule?a:{default:a}}(r),t=n(0)},function(a,e,n){var i=Math.floor,r=Math.pow;(function(n){var o,t;(function(){function s(a){if(!(this instanceof s))return a||(a=null),null===a?new s:new s(a);if('function'==typeof a)return this.random=a,this;arguments.length&&(this.seed=0);for(var e=0,n;e<arguments.length;e++){if(n=0,'[object String]'===Object.prototype.toString.call(arguments[e]))for(var i=0,r;i<arguments[e].length;i++){r=0;for(var o=0;o<arguments[e].length;o++)r=arguments[e].charCodeAt(o)+(r<<6)+(r<<16)-r;n+=r}else n=arguments[e];this.seed+=(arguments.length-e)*n}return this.mt=this.mersenne_twister(this.seed),this.bimd5=this.blueimp_md5(),this.random=function(){return this.mt.random(this.seed)},this}function l(a,e){if(a=a||{},e)for(var n in e)'undefined'==typeof a[n]&&(a[n]=e[n]);return a}function c(a,e){if(a)throw new RangeError(e)}function m(a){return function(){return this.natural(a)}}function d(a,e){for(var n=M(a),r=0,i=n.length,o;r<i;r++)o=n[r],e[o]=a[o]||e[o]}function u(a,e){for(var n=0,i=a.length;n<i;n++)e[n]=a[n]}function p(a,e){var n=Array.isArray(a),i=e||(n?Array(a.length):{});return n?u(a,i):d(a,i),i}var b=9007199254740992,h='0123456789',g='abcdefghijklmnopqrstuvwxyz',C=g.toUpperCase(),f=h+'abcdef',y=Array.prototype.slice;s.prototype.VERSION='1.0.13';var S=function(){throw new Error('No Base64 encoder available.')};(function(){'function'==typeof btoa?S=btoa:'function'==typeof n&&(S=function(a){return new n(a).toString('base64')})})(),s.prototype.bool=function(a){return a=l(a,{likelihood:50}),c(0>a.likelihood||100<a.likelihood,'Chance: Likelihood accepts values from 0 to 100.'),100*this.random()<a.likelihood},s.prototype.animal=function(a){return(a=l(a),'undefined'!=typeof a.type)?(c(!this.get('animals')[a.type.toLowerCase()],'Please pick from desert, ocean, grassland, forest, zoo, pets, farm.'),this.pick(this.get('animals')[a.type.toLowerCase()])):(animalTypeArray=['desert','forest','ocean','zoo','farm','pet','grassland'],this.pick(this.get('animals')[this.pick(animalTypeArray)]))},s.prototype.character=function(a){a=l(a),c(a.alpha&&a.symbols,'Chance: Cannot specify both alpha and symbols.');var e='!@#$%^&*()[]',n,i;return n='lower'===a.casing?g:'upper'===a.casing?C:g+C,i=a.pool?a.pool:a.alpha?n:a.symbols?e:n+h+e,i.charAt(this.natural({max:i.length-1}))},s.prototype.floating=function(a){a=l(a,{fixed:4}),c(a.fixed&&a.precision,'Chance: Cannot specify both fixed and precision.');var e=r(10,a.fixed),n=b/e,i=-n,o;c(a.min&&a.fixed&&a.min<i,'Chance: Min specified is out of range with fixed. Min should be, at least, '+i),c(a.max&&a.fixed&&a.max>n,'Chance: Max specified is out of range with fixed. Max should be, at most, '+n),a=l(a,{min:i,max:n}),o=this.integer({min:a.min*e,max:a.max*e});var t=(o/e).toFixed(a.fixed);return parseFloat(t)},s.prototype.integer=function(a){return a=l(a,{min:-b,max:b}),c(a.min>a.max,'Chance: Min cannot be greater than Max.'),i(this.random()*(a.max-a.min+1)+a.min)},s.prototype.natural=function(a){return a=l(a,{min:0,max:b}),'number'==typeof a.numerals&&(c(1>a.numerals,'Chance: Numerals cannot be less than one.'),a.min=r(10,a.numerals-1),a.max=r(10,a.numerals)-1),c(0>a.min,'Chance: Min cannot be less than zero.'),this.integer(a)},s.prototype.hex=function(a){a=l(a,{min:0,max:b,casing:'lower'}),c(0>a.min,'Chance: Min cannot be less than zero.');var e=this.natural({min:a.min,max:a.max});return'upper'===a.casing?e.toString(16).toUpperCase():e.toString(16)},s.prototype.letter=function(a){a=l(a,{casing:'lower'});var e=this.character({pool:'abcdefghijklmnopqrstuvwxyz'});return'upper'===a.casing&&(e=e.toUpperCase()),e},s.prototype.string=function(a){a=l(a,{length:this.natural({min:5,max:20})}),c(0>a.length,'Chance: Length cannot be less than zero.');var e=a.length,n=this.n(this.character,e,a);return n.join('')},s.prototype.capitalize=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},s.prototype.mixin=function(a){for(var e in a)s.prototype[e]=a[e];return this},s.prototype.unique=function(a,e,n){c('function'!=typeof a,'Chance: The first argument must be a function.');var i=function(a,e){return-1!==a.indexOf(e)};n&&(i=n.comparator||i);for(var r=[],o=0,t=y.call(arguments,2),s,l;r.length<e;)if(l=JSON.parse(JSON.stringify(t)),s=a.apply(this,l),i(r,s)||(r.push(s),o=0),++o>50*e)throw new RangeError('Chance: num is likely too large for sample set');return r},s.prototype.n=function(a,e){c('function'!=typeof a,'Chance: The first argument must be a function.'),'undefined'==typeof e&&(e=1);var r=e,i=[],o=y.call(arguments,2);for(r=Math.max(0,r),null;r--;null)i.push(a.apply(this,o));return i},s.prototype.pad=function(a,e,n){return n=n||'0',a+='',a.length>=e?a:Array(e-a.length+1).join(n)+a},s.prototype.pick=function(a,e){if(0===a.length)throw new RangeError('Chance: Cannot pick() from an empty array');return e&&1!==e?this.shuffle(a).slice(0,e):a[this.natural({max:a.length-1})]},s.prototype.pickone=function(a){if(0===a.length)throw new RangeError('Chance: Cannot pickone() from an empty array');return a[this.natural({max:a.length-1})]},s.prototype.pickset=function(a,e){if(0===e)return[];if(0===a.length)throw new RangeError('Chance: Cannot pickset() from an empty array');if(0>e)throw new RangeError('Chance: Count must be a positive number');return e&&1!==e?this.shuffle(a).slice(0,e):[this.pickone(a)]},s.prototype.shuffle=function(a){for(var e=a.slice(0),n=[],r=0,o=+e.length,t=0;t<o;t++)r=this.natural({max:e.length-1}),n[t]=e[r],e.splice(r,1);return n},s.prototype.weighted=function(a,e,n){if(a.length!==e.length)throw new RangeError('Chance: Length of array and weights must match');for(var i=0,r=0,o;r<e.length;++r){if(o=e[r],isNaN(o))throw new RangeError('Chance: All weights must be numbers');0<o&&(i+=o)}if(0==i)throw new RangeError('Chance: No valid entries in array weights');var t=this.random()*i,s=0,l=-1,c;for(r=0;r<e.length;++r){if(o=e[r],s+=o,0<o){if(t<=s){c=r;break}l=r}r===e.length-1&&(c=l)}var m=a[c];return n='undefined'!=typeof n&&n,n&&(a.splice(c,1),e.splice(c,1)),m},s.prototype.paragraph=function(a){a=l(a);var e=a.sentences||this.natural({min:3,max:7}),n=this.n(this.sentence,e);return n.join(' ')},s.prototype.sentence=function(a){a=l(a);var e=a.words||this.natural({min:12,max:18}),n=a.punctuation,i=this.n(this.word,e),r;return r=i.join(' '),r=this.capitalize(r),!1===n||/^[\.\?;!:]$/.test(n)||(n='.'),n&&(r+=n),r},s.prototype.syllable=function(a){a=l(a);for(var e=a.length||this.natural({min:2,max:3}),n='bcdfghjklmnprstvwz',r='aeiou',o='',t=0,i;t<e;t++)i=0===t?this.character({pool:n+r}):-1===n.indexOf(i)?this.character({pool:n}):this.character({pool:r}),o+=i;return a.capitalize&&(o=this.capitalize(o)),o},s.prototype.word=function(a){a=l(a),c(a.syllables&&a.length,'Chance: Cannot specify both syllables AND length.');var e=a.syllables||this.natural({min:1,max:3}),n='';if(a.length){do n+=this.syllable();while(n.length<a.length);n=n.substring(0,a.length)}else for(var r=0;r<e;r++)n+=this.syllable();return a.capitalize&&(n=this.capitalize(n)),n},s.prototype.age=function(a){a=l(a);var e;switch(a.type){case'child':e={min:0,max:12};break;case'teen':e={min:13,max:19};break;case'adult':e={min:18,max:65};break;case'senior':e={min:65,max:100};break;case'all':e={min:0,max:100};break;default:e={min:18,max:65};}return this.natural(e)},s.prototype.birthday=function(a){var e=this.age(a),n=new Date().getFullYear();if(a&&a.type){var i=new Date,r=new Date;i.setFullYear(n-e-1),r.setFullYear(n-e),a=l(a,{min:i,max:r})}else a=l(a,{year:n-e});return this.date(a)},s.prototype.cpf=function(a){a=l(a,{formatted:!0});var e=this.n(this.natural,9,{max:9}),n=2*e[8]+3*e[7]+4*e[6]+5*e[5]+6*e[4]+7*e[3]+8*e[2]+9*e[1]+10*e[0];n=11-n%11,10<=n&&(n=0);var i=2*n+3*e[8]+4*e[7]+5*e[6]+6*e[5]+7*e[4]+8*e[3]+9*e[2]+10*e[1]+11*e[0];i=11-i%11,10<=i&&(i=0);var r=''+e[0]+e[1]+e[2]+'.'+e[3]+e[4]+e[5]+'.'+e[6]+e[7]+e[8]+'-'+n+i;return a.formatted?r:r.replace(/\D/g,'')},s.prototype.cnpj=function(a){a=l(a,{formatted:!0});var e=this.n(this.natural,12,{max:12}),n=2*e[11]+3*e[10]+4*e[9]+5*e[8]+6*e[7]+7*e[6]+8*e[5]+9*e[4]+2*e[3]+3*e[2]+4*e[1]+5*e[0];n=11-n%11,2>n&&(n=0);var i=2*n+3*e[11]+4*e[10]+5*e[9]+6*e[8]+7*e[7]+8*e[6]+9*e[5]+2*e[4]+3*e[3]+4*e[2]+5*e[1]+6*e[0];i=11-i%11,2>i&&(i=0);var r=''+e[0]+e[1]+'.'+e[2]+e[3]+e[4]+'.'+e[5]+e[6]+e[7]+'/'+e[8]+e[9]+e[10]+e[11]+'-'+n+i;return a.formatted?r:r.replace(/\D/g,'')},s.prototype.first=function(a){return a=l(a,{gender:this.gender(),nationality:'en'}),this.pick(this.get('firstNames')[a.gender.toLowerCase()][a.nationality.toLowerCase()])},s.prototype.profession=function(a){return a=l(a),a.rank?this.pick(['Apprentice ','Junior ','Senior ','Lead '])+this.pick(this.get('profession')):this.pick(this.get('profession'))},s.prototype.company=function(){return this.pick(this.get('company'))},s.prototype.gender=function(a){return a=l(a,{extraGenders:[]}),this.pick(['Male','Female'].concat(a.extraGenders))},s.prototype.last=function(a){return a=l(a,{nationality:'en'}),this.pick(this.get('lastNames')[a.nationality.toLowerCase()])},s.prototype.israelId=function(){for(var a=this.string({pool:'0123456789',length:8}),e=0,n=0,i;n<a.length;n++)i=a[n]*(n/2===parseInt(n/2)?1:2),i=this.pad(i,2).toString(),i=parseInt(i[0])+parseInt(i[1]),e+=i;return a+=(10-parseInt(e.toString().slice(-1))).toString().slice(-1),a},s.prototype.mrz=function(a){var e=function(a){var e=['<','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','X','Z'],n=[7,3,1],i=0;return'string'!=typeof a&&(a=a.toString()),a.split('').forEach(function(a,r){var o=e.indexOf(a);a=-1===o?parseInt(a,10):0===o?0:o+9,a*=n[r%n.length],i+=a}),i%10},n=this;return a=l(a,{first:this.first(),last:this.last(),passportNumber:this.integer({min:1e8,max:999999999}),dob:function(){var a=n.birthday({type:'adult'});return[a.getFullYear().toString().substr(2),n.pad(a.getMonth()+1,2),n.pad(a.getDate(),2)].join('')}(),expiry:function(){var a=new Date;return[(a.getFullYear()+5).toString().substr(2),n.pad(a.getMonth()+1,2),n.pad(a.getDate(),2)].join('')}(),gender:'Female'===this.gender()?'F':'M',issuer:'GBR',nationality:'GBR'}),function(a){var n=function(a){return Array(a+1).join('<')},i=['P<',a.issuer,a.last.toUpperCase(),'<<',a.first.toUpperCase(),n(39-(a.last.length+a.first.length+2)),a.passportNumber,e(a.passportNumber),a.nationality,a.dob,e(a.dob),a.gender,a.expiry,e(a.expiry),n(14),e(n(14))].join('');return i+e(i.substr(44,10)+i.substr(57,7)+i.substr(65,7))}(a)},s.prototype.name=function(a){a=l(a);var e=this.first(a),n=this.last(a),i;return i=a.middle?e+' '+this.first(a)+' '+n:a.middle_initial?e+' '+this.character({alpha:!0,casing:'upper'})+'. '+n:e+' '+n,a.prefix&&(i=this.prefix(a)+' '+i),a.suffix&&(i=i+' '+this.suffix(a)),i},s.prototype.name_prefixes=function(a){a=a||'all',a=a.toLowerCase();var e=[{name:'Doctor',abbreviation:'Dr.'}];return('male'===a||'all'===a)&&e.push({name:'Mister',abbreviation:'Mr.'}),('female'===a||'all'===a)&&(e.push({name:'Miss',abbreviation:'Miss'}),e.push({name:'Misses',abbreviation:'Mrs.'})),e},s.prototype.prefix=function(a){return this.name_prefix(a)},s.prototype.name_prefix=function(a){return a=l(a,{gender:'all'}),a.full?this.pick(this.name_prefixes(a.gender)).name:this.pick(this.name_prefixes(a.gender)).abbreviation},s.prototype.HIDN=function(){var a='';return a+=this.string({pool:'0123456789',length:6}),a+=this.string({pool:'ABCDEFGHIJKLMNOPQRSTUVWXYXZ',length:2}),a},s.prototype.ssn=function(a){a=l(a,{ssnFour:!1,dashes:!0});var e='1234567890',n=a.dashes?'-':'',i;return i=a.ssnFour?this.string({pool:e,length:4}):this.string({pool:e,length:3})+n+this.string({pool:e,length:2})+n+this.string({pool:e,length:4}),i},s.prototype.name_suffixes=function(){return[{name:'Doctor of Osteopathic Medicine',abbreviation:'D.O.'},{name:'Doctor of Philosophy',abbreviation:'Ph.D.'},{name:'Esquire',abbreviation:'Esq.'},{name:'Junior',abbreviation:'Jr.'},{name:'Juris Doctor',abbreviation:'J.D.'},{name:'Master of Arts',abbreviation:'M.A.'},{name:'Master of Business Administration',abbreviation:'M.B.A.'},{name:'Master of Science',abbreviation:'M.S.'},{name:'Medical Doctor',abbreviation:'M.D.'},{name:'Senior',abbreviation:'Sr.'},{name:'The Third',abbreviation:'III'},{name:'The Fourth',abbreviation:'IV'},{name:'Bachelor of Engineering',abbreviation:'B.E'},{name:'Bachelor of Technology',abbreviation:'B.TECH'}]},s.prototype.suffix=function(a){return this.name_suffix(a)},s.prototype.name_suffix=function(a){return a=l(a),a.full?this.pick(this.name_suffixes()).name:this.pick(this.name_suffixes()).abbreviation},s.prototype.nationalities=function(){return this.get('nationalities')},s.prototype.nationality=function(){var a=this.pick(this.nationalities());return a.name},s.prototype.android_id=function(){return'APA91'+this.string({pool:'0123456789abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',length:178})},s.prototype.apple_token=function(){return this.string({pool:'abcdef1234567890',length:64})},s.prototype.wp8_anid2=function(){return S(this.hash({length:32}))},s.prototype.wp7_anid=function(){return'A='+this.guid().replace(/-/g,'').toUpperCase()+'&E='+this.hash({length:3})+'&W='+this.integer({min:0,max:9})},s.prototype.bb_pin=function(){return this.hash({length:8})},s.prototype.avatar=function(a){var e=null,n={protocol:null,email:null,fileExtension:null,size:null,fallback:null,rating:null};if(!a)n.email=this.email(),a={};else if('string'==typeof a)n.email=a,a={};else{if('object'!=typeof a)return null;if('Array'===a.constructor)return null}return n=l(a,n),n.email||(n.email=this.email()),n.protocol={http:'http',https:'https'}[n.protocol]?n.protocol+':':'',n.size=parseInt(n.size,0)?n.size:'',n.rating={g:'g',pg:'pg',r:'r',x:'x'}[n.rating]?n.rating:'',n.fallback={404:'404',mm:'mm',identicon:'identicon',monsterid:'monsterid',wavatar:'wavatar',retro:'retro',blank:'blank'}[n.fallback]?n.fallback:'',n.fileExtension={bmp:'bmp',gif:'gif',jpg:'jpg',png:'png'}[n.fileExtension]?n.fileExtension:'',e=n.protocol+'//www.gravatar.com/avatar/'+this.bimd5.md5(n.email)+(n.fileExtension?'.'+n.fileExtension:'')+(n.size||n.rating||n.fallback?'?':'')+(n.size?'&s='+n.size.toString():'')+(n.rating?'&r='+n.rating:'')+(n.fallback?'&d='+n.fallback:''),e},s.prototype.color=function(a){function e(a,e){return[a,a,a].join(e||'')}function n(a){var n=a?'rgba':'rgb',i=a?','+this.floating({min:h,max:g}):'',r=o?e(this.natural({min:t,max:s}),','):this.natural({min:d,max:u})+','+this.natural({min:p,max:b})+','+this.natural({max:255});return n+'('+r+i+')'}function r(n,r,l){var h=l?'#':'',g='';return o?(g=e(this.pad(this.hex({min:t,max:s}),2)),'shorthex'===a.format&&(g=e(this.hex({min:0,max:15})))):'shorthex'===a.format?g=this.pad(this.hex({min:i(c/16),max:i(m/16)}),1)+this.pad(this.hex({min:i(d/16),max:i(u/16)}),1)+this.pad(this.hex({min:i(p/16),max:i(b/16)}),1):void 0!==c||void 0!==m||void 0!==d||void 0!==u||void 0!==p||void 0!==b?g=this.pad(this.hex({min:c,max:m}),2)+this.pad(this.hex({min:d,max:u}),2)+this.pad(this.hex({min:p,max:b}),2):g=this.pad(this.hex({min:t,max:s}),2)+this.pad(this.hex({min:t,max:s}),2)+this.pad(this.hex({min:t,max:s}),2),h+g}a=l(a,{format:this.pick(['hex','shorthex','rgb','rgba','0x','name']),grayscale:!1,casing:'lower',min:0,max:255,min_red:void 0,max_red:void 0,min_green:void 0,max_green:void 0,min_blue:void 0,max_blue:void 0,min_alpha:0,max_alpha:1});var o=a.grayscale,t=a.min,s=a.max,c=a.min_red,m=a.max_red,d=a.min_green,u=a.max_green,p=a.min_blue,b=a.max_blue,h=a.min_alpha,g=a.max_alpha;void 0===a.min_red&&(c=t),void 0===a.max_red&&(m=s),void 0===a.min_green&&(d=t),void 0===a.max_green&&(u=s),void 0===a.min_blue&&(p=t),void 0===a.max_blue&&(b=s),void 0===a.min_alpha&&(h=0),void 0===a.max_alpha&&(g=1),o&&0===t&&255===s&&void 0!==c&&void 0!==m&&(t=(c+d+p)/3,s=(m+u+b)/3);var C;if('hex'===a.format)C=r.call(this,2,6,!0);else if('shorthex'===a.format)C=r.call(this,1,3,!0);else if('rgb'===a.format)C=n.call(this,!1);else if('rgba'===a.format)C=n.call(this,!0);else if('0x'===a.format)C='0x'+r.call(this,2,6);else{if('name'===a.format)return this.pick(this.get('colorNames'));throw new RangeError('Invalid format provided. Please provide one of "hex", "shorthex", "rgb", "rgba", "0x" or "name".')}return'upper'===a.casing&&(C=C.toUpperCase()),C},s.prototype.domain=function(a){return a=l(a),this.word()+'.'+(a.tld||this.tld())},s.prototype.email=function(a){return a=l(a),this.word({length:a.length})+'@'+(a.domain||this.domain())},s.prototype.fbid=function(){return'10000'+this.string({pool:'1234567890',length:11})},s.prototype.google_analytics=function(){var a=this.pad(this.natural({max:999999}),6),e=this.pad(this.natural({max:99}),2);return'UA-'+a+'-'+e},s.prototype.hashtag=function(){return'#'+this.word()},s.prototype.ip=function(){return this.natural({min:1,max:254})+'.'+this.natural({max:255})+'.'+this.natural({max:255})+'.'+this.natural({min:1,max:254})},s.prototype.ipv6=function(){var a=this.n(this.hash,8,{length:4});return a.join(':')},s.prototype.klout=function(){return this.natural({min:1,max:99})},s.prototype.semver=function(a){a=l(a,{include_prerelease:!0});var e=this.pickone(['^','~','<','>','<=','>=','=']);a.range&&(e=a.range);var n='';return a.include_prerelease&&(n=this.weighted(['','-dev','-beta','-alpha'],[50,10,5,1])),e+this.rpg('3d10').join('.')+n},s.prototype.tlds=function(){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']},s.prototype.tld=function(){return this.pick(this.tlds())},s.prototype.twitter=function(){return'@'+this.word()},s.prototype.url=function(a){a=l(a,{protocol:'http',domain:this.domain(a),domain_prefix:'',path:this.word(),extensions:[]});var e=0<a.extensions.length?'.'+this.pick(a.extensions):'',n=a.domain_prefix?a.domain_prefix+'.'+a.domain:a.domain;return a.protocol+'://'+n+'/'+a.path+e},s.prototype.port=function(){return this.integer({min:0,max:65535})},s.prototype.locale=function(a){return a=l(a),a.region?this.pick(this.get('locale_regions')):this.pick(this.get('locale_languages'))},s.prototype.locales=function(a){return a=l(a),a.region?this.get('locale_regions'):this.get('locale_languages')},s.prototype.address=function(a){return a=l(a),this.natural({min:5,max:2e3})+' '+this.street(a)},s.prototype.altitude=function(a){return a=l(a,{fixed:5,min:0,max:8848}),this.floating({min:a.min,max:a.max,fixed:a.fixed})},s.prototype.areacode=function(a){a=l(a,{parens:!0});var e=this.natural({min:2,max:9}).toString()+this.natural({min:0,max:8}).toString()+this.natural({min:0,max:9}).toString();return a.parens?'('+e+')':e},s.prototype.city=function(){return this.capitalize(this.word({syllables:3}))},s.prototype.coordinates=function(a){return this.latitude(a)+', '+this.longitude(a)},s.prototype.countries=function(){return this.get('countries')},s.prototype.country=function(a){a=l(a);var e=this.pick(this.countries());return a.full?e.name:e.abbreviation},s.prototype.depth=function(a){return a=l(a,{fixed:5,min:-10994,max:0}),this.floating({min:a.min,max:a.max,fixed:a.fixed})},s.prototype.geohash=function(a){return a=l(a,{length:7}),this.string({length:a.length,pool:'0123456789bcdefghjkmnpqrstuvwxyz'})},s.prototype.geojson=function(a){return this.latitude(a)+', '+this.longitude(a)+', '+this.altitude(a)},s.prototype.latitude=function(a){return a=l(a,{fixed:5,min:-90,max:90}),this.floating({min:a.min,max:a.max,fixed:a.fixed})},s.prototype.longitude=function(a){return a=l(a,{fixed:5,min:-180,max:180}),this.floating({min:a.min,max:a.max,fixed:a.fixed})},s.prototype.phone=function(a){var e=this,n=function(a){var i=[];return a.sections.forEach(function(a){i.push(e.string({pool:'0123456789',length:a}))}),a.area+i.join(' ')},i;a=l(a,{formatted:!0,country:'us',mobile:!1}),a.formatted||(a.parens=!1);var r;switch(a.country){case'fr':a.mobile?(i=this.pick(['06','07'])+e.string({pool:'0123456789',length:8}),r=a.formatted?i.match(/../g).join(' '):i):(i=this.pick(['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'])+e.string({pool:'0123456789',length:6}),'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'])+e.string({pool:'0123456789',length:6}),'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'])+e.string({pool:'0123456789',length:6}),'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'])+e.string({pool:'0123456789',length:6}),'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'])+e.string({pool:'0123456789',length:6}),'09'+e.string({pool:'0123456789',length:8})]),r=a.formatted?i.match(/../g).join(' '):i);break;case'uk':a.mobile?(i=this.pick([{area:'07'+this.pick(['4','5','7','8','9']),sections:[2,6]},{area:'07624 ',sections:[6]}]),r=a.formatted?n(i):n(i).replace(' ','')):(i=this.pick([{area:'01'+this.character({pool:'234569'})+'1 ',sections:[3,4]},{area:'020 '+this.character({pool:'378'}),sections:[3,4]},{area:'023 '+this.character({pool:'89'}),sections:[3,4]},{area:'024 7',sections:[3,4]},{area:'028 '+this.pick(['25','28','37','71','82','90','92','95']),sections:[2,4]},{area:'012'+this.pick(['04','08','54','76','97','98'])+' ',sections:[6]},{area:'013'+this.pick(['63','64','84','86'])+' ',sections:[6]},{area:'014'+this.pick(['04','20','60','61','80','88'])+' ',sections:[6]},{area:'015'+this.pick(['24','27','62','66'])+' ',sections:[6]},{area:'016'+this.pick(['06','29','35','47','59','95'])+' ',sections:[6]},{area:'017'+this.pick(['26','44','50','68'])+' ',sections:[6]},{area:'018'+this.pick(['27','37','84','97'])+' ',sections:[6]},{area:'019'+this.pick(['00','05','35','46','49','63','95'])+' ',sections:[6]}]),r=a.formatted?n(i):n(i).replace(' ','','g'));break;case'za':a.mobile?(i=this.pick(['060'+this.pick(['3','4','5','6','7','8','9'])+e.string({pool:'0123456789',length:6}),'061'+this.pick(['0','1','2','3','4','5','8'])+e.string({pool:'0123456789',length:6}),'06'+e.string({pool:'0123456789',length:7}),'071'+this.pick(['0','1','2','3','4','5','6','7','8','9'])+e.string({pool:'0123456789',length:6}),'07'+this.pick(['2','3','4','6','7','8','9'])+e.string({pool:'0123456789',length:7}),'08'+this.pick(['0','1','2','3','4','5'])+e.string({pool:'0123456789',length:7})]),r=a.formatted||i):(i=this.pick(['01'+this.pick(['0','1','2','3','4','5','6','7','8'])+e.string({pool:'0123456789',length:7}),'02'+this.pick(['1','2','3','4','7','8'])+e.string({pool:'0123456789',length:7}),'03'+this.pick(['1','2','3','5','6','9'])+e.string({pool:'0123456789',length:7}),'04'+this.pick(['1','2','3','4','5','6','7','8','9'])+e.string({pool:'0123456789',length:7}),'05'+this.pick(['1','3','4','6','7','8'])+e.string({pool:'0123456789',length:7})]),r=a.formatted||i);break;case'us':var o=this.areacode(a).toString(),t=this.natural({min:2,max:9}).toString()+this.natural({min:0,max:9}).toString()+this.natural({min:0,max:9}).toString(),s=this.natural({min:1e3,max:9999}).toString();r=a.formatted?o+' '+t+'-'+s:o+t+s;}return r},s.prototype.postal=function(){var a=this.character({pool:'XVTSRPNKLMHJGECBA'}),e=a+this.natural({max:9})+this.character({alpha:!0,casing:'upper'}),n=this.natural({max:9})+this.character({alpha:!0,casing:'upper'})+this.natural({max:9});return e+' '+n},s.prototype.counties=function(a){return a=l(a,{country:'uk'}),this.get('counties')[a.country.toLowerCase()]},s.prototype.county=function(a){return this.pick(this.counties(a)).name},s.prototype.provinces=function(a){return a=l(a,{country:'ca'}),this.get('provinces')[a.country.toLowerCase()]},s.prototype.province=function(a){return a&&a.full?this.pick(this.provinces(a)).name:this.pick(this.provinces(a)).abbreviation},s.prototype.state=function(a){return a&&a.full?this.pick(this.states(a)).name:this.pick(this.states(a)).abbreviation},s.prototype.states=function(a){a=l(a,{country:'us',us_states_and_dc:!0});var e;switch(a.country.toLowerCase()){case'us':var n=this.get('us_states_and_dc'),i=this.get('territories'),r=this.get('armed_forces');e=[],a.us_states_and_dc&&(e=e.concat(n)),a.territories&&(e=e.concat(i)),a.armed_forces&&(e=e.concat(r));break;case'it':e=this.get('country_regions')[a.country.toLowerCase()];break;case'uk':e=this.get('counties')[a.country.toLowerCase()];}return e},s.prototype.street=function(a){a=l(a,{country:'us',syllables:2});var e;switch(a.country.toLowerCase()){case'us':e=this.word({syllables:a.syllables}),e=this.capitalize(e),e+=' ',e+=a.short_suffix?this.street_suffix(a).abbreviation:this.street_suffix(a).name;break;case'it':e=this.word({syllables:a.syllables}),e=this.capitalize(e),e=(a.short_suffix?this.street_suffix(a).abbreviation:this.street_suffix(a).name)+' '+e;}return e},s.prototype.street_suffix=function(a){return a=l(a,{country:'us'}),this.pick(this.street_suffixes(a))},s.prototype.street_suffixes=function(a){return a=l(a,{country:'us'}),this.get('street_suffixes')[a.country.toLowerCase()]},s.prototype.zip=function(a){var e=this.n(this.natural,5,{max:9});return a&&!0===a.plusfour&&(e.push('-'),e=e.concat(this.n(this.natural,4,{max:9}))),e.join('')},s.prototype.ampm=function(){return this.bool()?'am':'pm'},s.prototype.date=function(a){var e,n;if(a&&(a.min||a.max)){a=l(a,{american:!0,string:!1});var i='undefined'==typeof a.min?1:a.min.getTime(),r='undefined'==typeof a.max?864e13:a.max.getTime();n=new Date(this.integer({min:i,max:r}))}else{var o=this.month({raw:!0}),t=o.days;a&&a.month&&(t=this.get('months')[(a.month%12+12)%12].days),a=l(a,{year:parseInt(this.year(),10),month:o.numeric-1,day:this.natural({min:1,max:t}),hour:this.hour({twentyfour:!0}),minute:this.minute(),second:this.second(),millisecond:this.millisecond(),american:!0,string:!1}),n=new Date(a.year,a.month,a.day,a.hour,a.minute,a.second,a.millisecond)}return e=a.american?n.getMonth()+1+'/'+n.getDate()+'/'+n.getFullYear():n.getDate()+'/'+(n.getMonth()+1)+'/'+n.getFullYear(),a.string?e:n},s.prototype.hammertime=function(a){return this.date(a).getTime()},s.prototype.hour=function(a){return a=l(a,{min:a&&a.twentyfour?0:1,max:a&&a.twentyfour?23:12}),c(0>a.min,'Chance: Min cannot be less than 0.'),c(a.twentyfour&&23<a.max,'Chance: Max cannot be greater than 23 for twentyfour option.'),c(!a.twentyfour&&12<a.max,'Chance: Max cannot be greater than 12.'),c(a.min>a.max,'Chance: Min cannot be greater than Max.'),this.natural({min:a.min,max:a.max})},s.prototype.millisecond=function(){return this.natural({max:999})},s.prototype.minute=s.prototype.second=function(a){return a=l(a,{min:0,max:59}),c(0>a.min,'Chance: Min cannot be less than 0.'),c(59<a.max,'Chance: Max cannot be greater than 59.'),c(a.min>a.max,'Chance: Min cannot be greater than Max.'),this.natural({min:a.min,max:a.max})},s.prototype.month=function(a){a=l(a,{min:1,max:12}),c(1>a.min,'Chance: Min cannot be less than 1.'),c(12<a.max,'Chance: Max cannot be greater than 12.'),c(a.min>a.max,'Chance: Min cannot be greater than Max.');var e=this.pick(this.months().slice(a.min-1,a.max));return a.raw?e:e.name},s.prototype.months=function(){return this.get('months')},s.prototype.second=function(){return this.natural({max:59})},s.prototype.timestamp=function(){return this.natural({min:1,max:parseInt(new Date().getTime()/1e3,10)})},s.prototype.weekday=function(a){a=l(a,{weekday_only:!1});var e=['Monday','Tuesday','Wednesday','Thursday','Friday'];return a.weekday_only||(e.push('Saturday'),e.push('Sunday')),this.pickone(e)},s.prototype.year=function(a){return a=l(a,{min:new Date().getFullYear()}),a.max='undefined'==typeof a.max?a.min+100:a.max,this.natural(a).toString()},s.prototype.cc=function(a){a=l(a);var e,n,i;return e=a.type?this.cc_type({name:a.type,raw:!0}):this.cc_type({raw:!0}),n=e.prefix.split(''),i=e.length-e.prefix.length-1,n=n.concat(this.n(this.integer,i,{min:0,max:9})),n.push(this.luhn_calculate(n.join(''))),n.join('')},s.prototype.cc_types=function(){return this.get('cc_types')},s.prototype.cc_type=function(a){a=l(a);var e=this.cc_types(),n=null;if(a.name){for(var r=0;r<e.length;r++)if(e[r].name===a.name||e[r].short_name===a.name){n=e[r];break}if(null===n)throw new RangeError('Chance: Credit card type \''+a.name+'\' is not supported')}else n=this.pick(e);return a.raw?n:n.name},s.prototype.currency_types=function(){return this.get('currency_types')},s.prototype.currency=function(){return this.pick(this.currency_types())},s.prototype.timezones=function(){return this.get('timezones')},s.prototype.timezone=function(){return this.pick(this.timezones())},s.prototype.currency_pair=function(a){var e=this.unique(this.currency,2,{comparator:function(a,e){return a.reduce(function(a,n){return a||n.code===e.code},!1)}});return a?e[0].code+'/'+e[1].code:e},s.prototype.dollar=function(a){a=l(a,{max:1e4,min:0});var e=this.floating({min:a.min,max:a.max,fixed:2}).toString(),n=e.split('.')[1];return void 0===n?e+='.00':2>n.length&&(e+='0'),0>e?'-$'+e.replace('-',''):'$'+e},s.prototype.euro=function(a){return(+this.dollar(a).replace('$','')).toLocaleString()+'\u20AC'},s.prototype.exp=function(a){a=l(a);var e={};return e.year=this.exp_year(),e.month=e.year===new Date().getFullYear().toString()?this.exp_month({future:!0}):this.exp_month(),a.raw?e:e.month+'/'+e.year},s.prototype.exp_month=function(a){a=l(a);var e=new Date().getMonth()+1,n,i;if(a.future&&12!==e)do n=this.month({raw:!0}).numeric,i=parseInt(n,10);while(i<=e);else n=this.month({raw:!0}).numeric;return n},s.prototype.exp_year=function(){var a=new Date().getMonth()+1,e=new Date().getFullYear();return this.year({min:12===a?e+1:e,max:e+10})},s.prototype.vat=function(a){switch(a=l(a,{country:'it'}),a.country.toLowerCase()){case'it':return this.it_vat();}},s.prototype.iban=function(){var a='ABCDEFGHIJKLMNOPQRSTUVWXYZ',e=this.string({length:2,pool:a})+this.pad(this.integer({min:0,max:99}),2)+this.string({length:4,pool:a+'0123456789'})+this.pad(this.natural(),this.natural({min:6,max:26}));return e},s.prototype.it_vat=function(){var a=this.natural({min:1,max:18e5});return a=this.pad(a,7)+this.pad(this.pick(this.provinces({country:'it'})).code,3),a+this.luhn_calculate(a)},s.prototype.cf=function(a){a=a||{};var e=a.gender?a.gender:this.gender(),n=a.first?a.first:this.first({gender:e,nationality:'it'}),i=a.last?a.last:this.last({nationality:'it'}),r=a.birthday?a.birthday:this.birthday(),o=a.city?a.city:this.pickone(['A','B','C','D','E','F','G','H','I','L','M','Z'])+this.pad(this.natural({max:999}),3),t=[],s=function(a,e){var n=[],i;return 3>a.length?n=a.split('').concat(['X','X','X']).splice(0,3):(i=a.toUpperCase().split('').map(function(a){return-1==='BCDFGHJKLMNPRSTVWZ'.indexOf(a)?void 0:a}).join(''),3<i.length&&(e?i=i.substr(0,3):i=i[0]+i.substr(2,2)),3>i.length&&(n=i,i=a.toUpperCase().split('').map(function(a){return-1==='AEIOU'.indexOf(a)?void 0:a}).join('').substr(0,3-n.length)),n+=i),n},l=function(a){for(var e='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',n='ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ',r='ABCDEFGHIJKLMNOPQRSTUVWXYZ',o=0,t=0;15>t;t++)o+=0==t%2?'BAKPLCQDREVOSFTGUHMINJWZYX'.indexOf(n[e.indexOf(a[t])]):r.indexOf(n[e.indexOf(a[t])]);return r[o%26]};return t=t.concat(s(i,!0),s(n),function(a,e,n){return a.getFullYear().toString().substr(2)+['A','B','C','D','E','H','L','M','P','R','S','T'][a.getMonth()]+n.pad(a.getDate()+('female'===e.toLowerCase()?40:0),2)}(r,e,this),o.toUpperCase().split('')).join(''),t+=l(t.toUpperCase(),this),t.toUpperCase()},s.prototype.pl_pesel=function(){for(var a=this.natural({min:1,max:9999999999}),e=this.pad(a,10).split(''),n=0;n<e.length;n++)e[n]=parseInt(e[n]);var i=(1*e[0]+3*e[1]+7*e[2]+9*e[3]+1*e[4]+3*e[5]+7*e[6]+9*e[7]+1*e[8]+3*e[9])%10;return 0!=i&&(i=10-i),e.join('')+i},s.prototype.pl_nip=function(){for(var a=this.natural({min:1,max:999999999}),e=this.pad(a,9).split(''),n=0;n<e.length;n++)e[n]=parseInt(e[n]);var i=(6*e[0]+5*e[1]+7*e[2]+2*e[3]+3*e[4]+4*e[5]+5*e[6]+6*e[7]+7*e[8])%11;return 10==i?this.pl_nip():e.join('')+i},s.prototype.pl_regon=function(){for(var a=this.natural({min:1,max:99999999}),e=this.pad(a,8).split(''),n=0;n<e.length;n++)e[n]=parseInt(e[n]);var i=(8*e[0]+9*e[1]+2*e[2]+3*e[3]+4*e[4]+5*e[5]+6*e[6]+7*e[7])%11;return 10==i&&(i=0),e.join('')+i},s.prototype.note=function(a){a=l(a,{notes:'flatKey'});var e={naturals:['C','D','E','F','G','A','B'],flats:['D\u266D','E\u266D','G\u266D','A\u266D','B\u266D'],sharps:['C\u266F','D\u266F','F\u266F','G\u266F','A\u266F']};return e.all=e.naturals.concat(e.flats.concat(e.sharps)),e.flatKey=e.naturals.concat(e.flats),e.sharpKey=e.naturals.concat(e.sharps),this.pickone(e[a.notes])},s.prototype.midi_note=function(a){return a=l(a,{min:0,max:127}),this.integer({min:a.min,max:a.max})},s.prototype.chord_quality=function(a){a=l(a,{jazz:!0});var e=['maj','min','aug','dim'];return a.jazz&&(e=['maj7','min7','7','sus','dim','\xF8']),this.pickone(e)},s.prototype.chord=function(a){return a=l(a),this.note(a)+this.chord_quality(a)},s.prototype.tempo=function(a){return a=l(a,{min:40,max:320}),this.integer({min:a.min,max:a.max})},s.prototype.coin=function(){return this.bool()?'heads':'tails'},s.prototype.d4=m({min:1,max:4}),s.prototype.d6=m({min:1,max:6}),s.prototype.d8=m({min:1,max:8}),s.prototype.d10=m({min:1,max:10}),s.prototype.d12=m({min:1,max:12}),s.prototype.d20=m({min:1,max:20}),s.prototype.d30=m({min:1,max:30}),s.prototype.d100=m({min:1,max:100}),s.prototype.rpg=function(a,e){if(e=l(e),!a)throw new RangeError('Chance: A type of die roll must be included');else{var n=a.toLowerCase().split('d'),r=[];if(2!==n.length||!parseInt(n[0],10)||!parseInt(n[1],10))throw new Error('Chance: Invalid format provided. Please provide #d# where the first # is the number of dice to roll, the second # is the max of each die');for(var o=n[0];0<o;o--)r[o-1]=this.natural({min:1,max:n[1]});return'undefined'!=typeof e.sum&&e.sum?r.reduce(function(a,e){return a+e}):r}},s.prototype.guid=function(a){a=l(a,{version:5});var e='abcdef1234567890',n=this.string({pool:e,length:8})+'-'+this.string({pool:e,length:4})+'-'+a.version+this.string({pool:e,length:3})+'-'+this.string({pool:'ab89',length:1})+this.string({pool:e,length:3})+'-'+this.string({pool:e,length:12});return n},s.prototype.hash=function(a){a=l(a,{length:40,casing:'lower'});var e='upper'===a.casing?f.toUpperCase():f;return this.string({pool:e,length:a.length})},s.prototype.luhn_check=function(a){var e=a.toString(),n=+e.substring(e.length-1);return n===this.luhn_calculate(+e.substring(0,e.length-1))},s.prototype.luhn_calculate=function(a){for(var e=a.toString().split('').reverse(),n=0,r=0,i=e.length,o;i>r;++r)o=+e[r],0==r%2&&(o*=2,9<o&&(o-=9)),n+=o;return 9*n%10},s.prototype.md5=function(a){var e={str:'',key:null,raw:!1};if(!a)e.str=this.string(),a={};else if('string'==typeof a)e.str=a,a={};else{if('object'!=typeof a)return null;if('Array'===a.constructor)return