pixpipe
Version:
A image processing pipeline in pure Javascript for browsers and Node
1 lines • 736 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.pixpipe={})}(this,function(exports){"use strict";var ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array;function setMatrixArrayType(e){ARRAY_TYPE=e}var degree=Math.PI/180;function create$2(){var e=new ARRAY_TYPE(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function create$3(){var e=new ARRAY_TYPE(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function fromValues$3(e,t,r,n,i,a,o,s,l,u,c,h,f,d,p,g){var _=new ARRAY_TYPE(16);return _[0]=e,_[1]=t,_[2]=r,_[3]=n,_[4]=i,_[5]=a,_[6]=o,_[7]=s,_[8]=l,_[9]=u,_[10]=c,_[11]=h,_[12]=f,_[13]=d,_[14]=p,_[15]=g,_}function invert$3(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],g=t[13],_=t[14],y=t[15],m=r*s-n*o,v=r*l-i*o,b=r*u-a*o,w=n*l-i*s,E=n*u-a*s,T=i*u-a*l,S=c*g-h*p,x=c*_-f*p,I=c*y-d*p,A=h*_-f*g,k=h*y-d*g,M=f*y-d*_,C=m*M-v*k+b*A+w*I-E*x+T*S;return C?(C=1/C,e[0]=(s*M-l*k+u*A)*C,e[1]=(i*k-n*M-a*A)*C,e[2]=(g*T-_*E+y*w)*C,e[3]=(f*E-h*T-d*w)*C,e[4]=(l*I-o*M-u*x)*C,e[5]=(r*M-i*I+a*x)*C,e[6]=(_*b-p*T-y*v)*C,e[7]=(c*T-f*b+d*v)*C,e[8]=(o*k-s*I+u*S)*C,e[9]=(n*I-r*k-a*S)*C,e[10]=(p*E-g*b+y*m)*C,e[11]=(h*b-c*E-d*m)*C,e[12]=(s*x-o*A-l*S)*C,e[13]=(r*A-n*x+i*S)*C,e[14]=(g*v-p*w-_*m)*C,e[15]=(c*w-h*v+f*m)*C,e):null}function multiply$3(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],g=t[12],_=t[13],y=t[14],m=t[15],v=r[0],b=r[1],w=r[2],E=r[3];return e[0]=v*n+b*s+w*h+E*g,e[1]=v*i+b*l+w*f+E*_,e[2]=v*a+b*u+w*d+E*y,e[3]=v*o+b*c+w*p+E*m,v=r[4],b=r[5],w=r[6],E=r[7],e[4]=v*n+b*s+w*h+E*g,e[5]=v*i+b*l+w*f+E*_,e[6]=v*a+b*u+w*d+E*y,e[7]=v*o+b*c+w*p+E*m,v=r[8],b=r[9],w=r[10],E=r[11],e[8]=v*n+b*s+w*h+E*g,e[9]=v*i+b*l+w*f+E*_,e[10]=v*a+b*u+w*d+E*y,e[11]=v*o+b*c+w*p+E*m,v=r[12],b=r[13],w=r[14],E=r[15],e[12]=v*n+b*s+w*h+E*g,e[13]=v*i+b*l+w*f+E*_,e[14]=v*a+b*u+w*d+E*y,e[15]=v*o+b*c+w*p+E*m,e}function create$4(){var e=new ARRAY_TYPE(3);return e[0]=0,e[1]=0,e[2]=0,e}function length(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function fromValues$4(e,t,r){var n=new ARRAY_TYPE(3);return n[0]=e,n[1]=t,n[2]=r,n}function normalize(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function cross(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=i*l-a*s,e[1]=a*o-n*l,e[2]=n*s-i*o,e}var len=length,forEach=(vec=create$4(),function(e,t,r,n,i,a){var o=void 0,s=void 0;for(t||(t=3),r||(r=0),s=n?Math.min(n*t+r,e.length):e.length,o=r;o<s;o+=t)vec[0]=e[o],vec[1]=e[o+1],vec[2]=e[o+2],i(vec,vec,a),e[o]=vec[0],e[o+1]=vec[1],e[o+2]=vec[2];return e}),vec;function create$5(){var e=new ARRAY_TYPE(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function fromValues$5(e,t,r,n){var i=new ARRAY_TYPE(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function normalize$1(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o),e}function transformMat4$1(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e}var forEach$1=function(){var e=create$5();return function(t,r,n,i,a,o){var s=void 0,l=void 0;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,t.length):t.length,s=n;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();function create$6(){var e=new ARRAY_TYPE(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function setAxisAngle(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function slerp(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3],l=r[0],u=r[1],c=r[2],h=r[3],f=void 0,d=void 0,p=void 0,g=void 0,_=void 0;return(d=i*l+a*u+o*c+s*h)<0&&(d=-d,l=-l,u=-u,c=-c,h=-h),1-d>1e-6?(f=Math.acos(d),p=Math.sin(f),g=Math.sin((1-n)*f)/p,_=Math.sin(n*f)/p):(g=1-n,_=n),e[0]=g*i+_*l,e[1]=g*a+_*u,e[2]=g*o+_*c,e[3]=g*s+_*h,e}function fromMat3(e,t){var r=t[0]+t[4]+t[8],n=void 0;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[3*a+o]-t[3*o+a])*n,e[a]=(t[3*a+i]+t[3*i+a])*n,e[o]=(t[3*o+i]+t[3*i+o])*n}return e}var normalize$2=normalize$1,rotationTo=(tmpvec3=create$4(),xUnitVec3=fromValues$4(1,0,0),yUnitVec3=fromValues$4(0,1,0),function(e,t,r){var n=dot(t,r);return n<-.999999?(cross(tmpvec3,xUnitVec3,t),len(tmpvec3)<1e-6&&cross(tmpvec3,yUnitVec3,t),normalize(tmpvec3,tmpvec3),setAxisAngle(e,tmpvec3,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(cross(tmpvec3,t,r),e[0]=tmpvec3[0],e[1]=tmpvec3[1],e[2]=tmpvec3[2],e[3]=1+n,normalize$2(e,e))}),tmpvec3,xUnitVec3,yUnitVec3,sqlerp=(temp1=create$6(),temp2=create$6(),function(e,t,r,n,i,a){return slerp(temp1,t,i,a),slerp(temp2,r,n,a),slerp(e,temp1,temp2,2*a*(1-a)),e}),temp1,temp2,setAxes=(matr=create$2(),function(e,t,r,n){return matr[0]=r[0],matr[3]=r[1],matr[6]=r[2],matr[1]=n[0],matr[4]=n[1],matr[7]=n[2],matr[2]=-t[0],matr[5]=-t[1],matr[8]=-t[2],normalize$2(e,fromMat3(e,matr))}),matr;function create$7(){var e=new ARRAY_TYPE(2);return e[0]=0,e[1]=0,e}var forEach$2=function(){var e=create$7();return function(t,r,n,i,a,o){var s=void 0,l=void 0;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,t.length):t.length,s=n;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),get=function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0},inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},coreTypes={},CoreTypes=function(){function e(){classCallCheck(this,e)}return createClass(e,null,[{key:"addCoreType",value:function(e){"function"==typeof e&&(coreTypes[e.name]=e)}},{key:"getCoreType",value:function(e){return e in coreTypes?coreTypes[e]:null}}]),e}(),commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var joiBrowser=createCommonjsModule(function(e,t){var r;r=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){var n=r(1);e.exports=n},function(e,t,r){var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":_typeof(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):function(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var i=r[n],a=Object.getOwnPropertyDescriptor(t,i);a&&a.configurable&&void 0===e[i]&&Object.defineProperty(e,i,a)}}(e,t))}var a=r(2),o=r(11),s=r(16),l=r(13),u=r(29),c=r(12),h={alternatives:r(25),array:r(30),boolean:r(24),binary:r(31),date:r(17),number:r(23),object:r(26),string:r(18)};h.root=function(){var e=new o,t=e.clone();return t.any=function(){return a.assert(0===arguments.length,"Joi.any() does not allow arguments."),e},t.alternatives=t.alt=function(){return arguments.length?h.alternatives.try.apply(h.alternatives,arguments):h.alternatives},t.array=function(){return a.assert(0===arguments.length,"Joi.array() does not allow arguments."),h.array},t.boolean=t.bool=function(){return a.assert(0===arguments.length,"Joi.boolean() does not allow arguments."),h.boolean},t.binary=function(){return a.assert(0===arguments.length,"Joi.binary() does not allow arguments."),h.binary},t.date=function(){return a.assert(0===arguments.length,"Joi.date() does not allow arguments."),h.date},t.func=function(){return a.assert(0===arguments.length,"Joi.func() does not allow arguments."),h.object._func()},t.number=function(){return a.assert(0===arguments.length,"Joi.number() does not allow arguments."),h.number},t.object=function(){return arguments.length?h.object.keys.apply(h.object,arguments):h.object},t.string=function(){return a.assert(0===arguments.length,"Joi.string() does not allow arguments."),h.string},t.ref=function(){return c.create.apply(null,arguments)},t.isRef=function(e){return c.isRef(e)},t.validate=function(r){var n=arguments[arguments.length-1],i="function"==typeof n?n:null,a=arguments.length-(i?1:0);if(1===a)return e.validate(r,i);var o=3===a?arguments[2]:{};return t.compile(arguments[1])._validateWithOptions(r,o,i)},t.describe=function(){return(arguments.length?t.compile(arguments[0]):e).describe()},t.compile=function(e){try{return s.schema(e)}catch(e){throw e.hasOwnProperty("path")&&(e.message=e.message+"("+e.path+")"),e}},t.assert=function(e,r,n){t.attempt(e,r,n)},t.attempt=function(e,r,n){var i=t.validate(e,r),a=i.error;if(a){if(!n)throw"function"==typeof a.annotate&&(a.message=a.annotate()),a;if(!(n instanceof Error))throw"function"==typeof a.annotate&&(a.message=n+" "+a.annotate()),a;throw n}return i.value},t.reach=function(e,t){if(a.assert(e&&e instanceof o,"you must provide a joi schema"),a.assert("string"==typeof t,"path must be a string"),""===t)return e;var r=t.split("."),n=e._inner.children;if(n)for(var i=r[0],s=0;s<n.length;++s){var l=n[s];if(l.key===i)return this.reach(l.schema,t.substr(i.length+1))}},t.lazy=function(e){return u.set(e)},t.extend=function(){var e=this,r=a.flatten(Array.prototype.slice.call(arguments));a.assert(r.length>0,"You need to provide at least one extension"),this.assert(r,t.extensionsSchema);var u=Object.create(this.any());n(u,this);for(var h=function(h){var f=r[h];"function"==typeof f&&(f=f(u)),e.assert(f,t.extensionSchema);var d=(f.base||e.any()).clone(),p=d.constructor,g=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r,i,o,s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":_typeof(t))&&"function"!=typeof t?e:t}(this,e.call(this));return f.base&&n(s,d),s._type=f.name,f.language&&(s._settings=s._settings||{language:{}},s._settings.language=a.applyToDefaults(s._settings.language,(r={},i=f.name,o=f.language,i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r))),s}return i(t,e),t}(p);if(f.coerce&&(g.prototype._coerce=function(e,t,r){if(p.prototype._coerce){var n=p.prototype._coerce.call(this,e,t,r);if(n.errors)return n;e=n.value}var i=f.coerce.call(this,e,t,r);return i instanceof l.Err?{value:e,errors:i}:{value:i}}),f.pre&&(g.prototype._base=function(e,t,r){if(p.prototype._base){var n=p.prototype._base.call(this,e,t,r);if(n.errors)return n;e=n.value}var i=f.pre.call(this,e,t,r);return i instanceof l.Err?{value:e,errors:i}:{value:i}}),f.rules)for(var _=function(e){var t=f.rules[e],r=t.params?t.params instanceof o?t.params._inner.children.map(function(e){return e.key}):Object.keys(t.params):[],n=t.params?s.schema(t.params):null;g.prototype[t.name]=function(){if(arguments.length>r.length)throw new Error("Unexpected number of arguments");for(var e=Array.prototype.slice.call(arguments),i=!1,s={},l=0;l<r.length;++l)s[r[l]]=e[l],!i&&c.isRef(e[l])&&(i=!0);n&&(s=u.attempt(s,n));var h=void 0;if(t.validate){h=this._test(t.name,s,function(e,r,n){return t.validate.call(this,s,e,r,n)},{description:t.description,hasRef:i})}else h=this.clone();if(t.setup){var f=t.setup.call(h,s);void 0!==f&&(a.assert(f instanceof o,"Setup of extension Joi."+this._type+"()."+t.name+"() must return undefined or a Joi object"),h=f)}return h}},y=0;y<f.rules.length;++y)_(y);f.describe&&(g.prototype.describe=function(){var e=p.prototype.describe.call(this);return f.describe.call(this,e)});var m=new g;u[f.name]=function(){return m}},f=0;f<r.length;++f)h(f);return u},t.extensionSchema=h.object.keys({base:h.object.type(o,"Joi object"),name:h.string.required(),coerce:h.object._func().arity(3),pre:h.object._func().arity(3),language:h.object,describe:h.object._func().arity(1),rules:h.array.items(h.object.keys({name:h.string.required(),setup:h.object._func().arity(1),validate:h.object._func().arity(4),params:[h.object.pattern(/.*/,h.object.type(o,"Joi object")),h.object.type(h.object.constructor,"Joi object")],description:[h.string,h.object._func().arity(1)]}).or("setup","validate"))}).strict(),t.extensionsSchema=h.array.items([h.object,h.object._func().arity(1)]).strict(),t.version=r(32).version,t},e.exports=h.root()},function(e,t,r){(function(e,n){var i="function"==typeof Symbol&&"symbol"===_typeof(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_typeof(e)},a=r(5),o=r(6),s=r(7),l=r(10),u={};t.clone=function(r,n){if("object"!==(void 0===r?"undefined":i(r))||null===r)return r;var a=(n=n||new Map).get(r);if(a)return a;var o=void 0,s=!1;if(Array.isArray(r))o=[],s=!0;else if(e.isBuffer(r))o=new e(r);else if(r instanceof Date)o=new Date(r.getTime());else if(r instanceof RegExp)o=new RegExp(r);else{var l=Object.getPrototypeOf(r);l&&l.isImmutable?o=r:(o=Object.create(l),s=!0)}if(n.set(r,o),s)for(var u=Object.getOwnPropertyNames(r),c=0;c<u.length;++c){var h=u[c],f=Object.getOwnPropertyDescriptor(r,h);f&&(f.get||f.set)?Object.defineProperty(o,h,f):o[h]=t.clone(r[h],n)}return o},t.merge=function(r,n,a,o){if(t.assert(r&&"object"===(void 0===r?"undefined":i(r)),"Invalid target value: must be an object"),t.assert(null===n||void 0===n||"object"===(void 0===n?"undefined":i(n)),"Invalid source value: must be null, undefined, or an object"),!n)return r;if(Array.isArray(n)){t.assert(Array.isArray(r),"Cannot merge array onto an object"),!1===o&&(r.length=0);for(var s=0;s<n.length;++s)r.push(t.clone(n[s]));return r}for(var l=Object.keys(n),u=0;u<l.length;++u){var c=l[u],h=n[c];h&&"object"===(void 0===h?"undefined":i(h))?!r[c]||"object"!==i(r[c])||Array.isArray(r[c])!==Array.isArray(h)||h instanceof Date||e.isBuffer(h)||h instanceof RegExp?r[c]=t.clone(h):t.merge(r[c],h,a,o):null!==h&&void 0!==h?r[c]=h:!1!==a&&(r[c]=h)}return r},t.applyToDefaults=function(e,r,n){if(t.assert(e&&"object"===(void 0===e?"undefined":i(e)),"Invalid defaults value: must be an object"),t.assert(!r||!0===r||"object"===(void 0===r?"undefined":i(r)),"Invalid options value: must be true, falsy or an object"),!r)return null;var a=t.clone(e);return!0===r?a:t.merge(a,r,!0===n,!1)},t.cloneWithShallow=function(e,r){if(!e||"object"!==(void 0===e?"undefined":i(e)))return e;var n=u.store(e,r),a=t.clone(e);return u.restore(a,e,n),a},u.store=function(e,r){for(var n={},i=0;i<r.length;++i){var a=r[i],o=t.reach(e,a);void 0!==o&&(n[a]=o,u.reachSet(e,a,void 0))}return n},u.restore=function(e,t,r){for(var n=Object.keys(r),i=0;i<n.length;++i){var a=n[i];u.reachSet(e,a,r[a]),u.reachSet(t,a,r[a])}},u.reachSet=function(e,t,r){for(var n=t.split("."),i=e,a=0;a<n.length;++a){var o=n[a];a+1===n.length&&(i[o]=r),i=i[o]}},t.applyToDefaultsWithShallow=function(e,r,n){if(t.assert(e&&"object"===(void 0===e?"undefined":i(e)),"Invalid defaults value: must be an object"),t.assert(!r||!0===r||"object"===(void 0===r?"undefined":i(r)),"Invalid options value: must be true, falsy or an object"),t.assert(n&&Array.isArray(n),"Invalid keys"),!r)return null;var a=t.cloneWithShallow(e,n);if(!0===r)return a;var o=u.store(r,n);return t.merge(a,r,!1,!1),u.restore(a,r,o),a},t.deepEqual=function(r,n,a,o){a=a||{prototype:!0};var s=void 0===r?"undefined":i(r);if(s!==(void 0===n?"undefined":i(n)))return!1;if("object"!==s||null===r||null===n)return r===n?0!==r||1/r==1/n:r!=r&&n!=n;if(-1!==(o=o||[]).indexOf(r))return!0;if(o.push(r),Array.isArray(r)){if(!Array.isArray(n))return!1;if(!a.part&&r.length!==n.length)return!1;for(var l=0;l<r.length;++l){if(a.part){for(var u=!1,c=0;c<n.length;++c)if(t.deepEqual(r[l],n[c],a)){u=!0;break}return u}if(!t.deepEqual(r[l],n[l],a))return!1}return!0}if(e.isBuffer(r)){if(!e.isBuffer(n))return!1;if(r.length!==n.length)return!1;for(var h=0;h<r.length;++h)if(r[h]!==n[h])return!1;return!0}if(r instanceof Date)return n instanceof Date&&r.getTime()===n.getTime();if(r instanceof RegExp)return n instanceof RegExp&&r.toString()===n.toString();if(a.prototype&&Object.getPrototypeOf(r)!==Object.getPrototypeOf(n))return!1;var f=Object.getOwnPropertyNames(r);if(!a.part&&f.length!==Object.getOwnPropertyNames(n).length)return!1;for(var d=0;d<f.length;++d){var p=f[d],g=Object.getOwnPropertyDescriptor(r,p);if(g.get){if(!t.deepEqual(g,Object.getOwnPropertyDescriptor(n,p),a,o))return!1}else if(!t.deepEqual(r[p],n[p],a,o))return!1}return!0},t.unique=function(e,t){var r=void 0;return t?function(){r=[];var n=new Set;e.forEach(function(e){var i=e[t];n.has(i)||(n.add(i),r.push(e))})}():r=Array.from(new Set(e)),r},t.mapToObject=function(e,t){if(!e)return null;for(var r={},n=0;n<e.length;++n)t?e[n][t]&&(r[e[n][t]]=!0):r[e[n]]=!0;return r},t.intersect=function(e,r,n){if(!e||!r)return[];for(var i=[],a=Array.isArray(e)?t.mapToObject(e):e,o={},s=0;s<r.length;++s)if(a[r[s]]&&!o[r[s]]){if(n)return r[s];i.push(r[s]),o[r[s]]=!0}return n?null:i},t.contain=function(e,r,n){var a=null;"object"!==(void 0===e?"undefined":i(e))||"object"!==(void 0===r?"undefined":i(r))||Array.isArray(e)||Array.isArray(r)?r=[].concat(r):(a=r,r=Object.keys(r)),n=n||{},t.assert(arguments.length>=2,"Insufficient arguments"),t.assert("string"==typeof e||"object"===(void 0===e?"undefined":i(e)),"Reference must be string or an object"),t.assert(r.length,"Values array cannot be empty");var o=void 0,s=void 0;if(n.deep){o=t.deepEqual;var l=n.hasOwnProperty("only"),u=n.hasOwnProperty("part");s={prototype:l?n.only:!!u&&!n.part,part:l?!n.only:!u||n.part}}else o=function(e,t){return e===t};for(var c=!1,h=new Array(r.length),f=0;f<h.length;++f)h[f]=0;if("string"==typeof e){for(var d="(",p=0;p<r.length;++p){var g=r[p];t.assert("string"==typeof g,"Cannot compare string reference to non-string value"),d+=(p?"|":"")+t.escapeRegex(g)}var _=new RegExp(d+")","g");c=!!e.replace(_,function(e,t){var n=r.indexOf(t);return++h[n],""})}else if(Array.isArray(e))for(var y=0;y<e.length;++y){for(var m=!1,v=0;v<r.length&&!1===m;++v)m=o(r[v],e[y],s)&&v;!1!==m?++h[m]:c=!0}else for(var b=Object.getOwnPropertyNames(e),w=0;w<b.length;++w){var E=b[w],T=r.indexOf(E);if(-1!==T){if(a&&!o(a[E],e[E],s))return!1;++h[T]}else c=!0}for(var S=!1,x=0;x<h.length;++x)if(S=S||!!h[x],n.once&&h[x]>1||!n.part&&!h[x])return!1;return(!n.only||!c)&&S},t.flatten=function(e,r){for(var n=r||[],i=0;i<e.length;++i)Array.isArray(e[i])?t.flatten(e[i],n):n.push(e[i]);return n},t.reach=function(e,r,n){if(!1===r||null===r||void 0===r)return e;"string"==typeof(n=n||{})&&(n={separator:n});for(var a=r.split(n.separator||"."),o=e,s=0;s<a.length;++s){var l=a[s];if("-"===l[0]&&Array.isArray(o)&&(l=l.slice(1,l.length),l=o.length-l),!o||"object"!==(void 0===o?"undefined":i(o))&&"function"!=typeof o||!(l in o)||"object"!==(void 0===o?"undefined":i(o))&&!1===n.functions){t.assert(!n.strict||s+1===a.length,"Missing segment",l,"in reach path ",r),t.assert("object"===(void 0===o?"undefined":i(o))||!0===n.functions||"function"!=typeof o,"Invalid segment",l,"in reach path ",r),o=n.default;break}o=o[l]}return o},t.reachTemplate=function(e,r,n){return r.replace(/{([^}]+)}/g,function(r,i){var a=t.reach(e,i,n);return void 0===a||null===a?"":a})},t.formatStack=function(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];t.push([n.getFileName(),n.getLineNumber(),n.getColumnNumber(),n.getFunctionName(),n.isConstructor()])}return t},t.formatTrace=function(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];t.push((n[4]?"new ":"")+n[3]+" ("+n[0]+":"+n[1]+":"+n[2]+")")}return t},t.callStack=function(e){var r=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var n={};Error.captureStackTrace(n,this);var i=n.stack;return Error.prepareStackTrace=r,t.formatStack(i).slice(1+e)},t.displayStack=function(e){var r=t.callStack(void 0===e?1:e+1);return t.formatTrace(r)},t.abortThrow=!1,t.abort=function(e,r){if("test"===n.env.NODE_ENV||!0===t.abortThrow)throw new Error(e||"Unknown error");var i="";r||(i=t.displayStack(1).join("\n\t")),console.log("ABORT: "+e+"\n\t"+i),n.exit(1)},t.assert=function(e){if(!e){if(2===arguments.length&&arguments[1]instanceof Error)throw arguments[1];for(var r=[],n=1;n<arguments.length;++n)""!==arguments[n]&&r.push(arguments[n]);throw r=r.map(function(e){return"string"==typeof e?e:e instanceof Error?e.message:t.stringify(e)}),new Error(r.join(" ")||"Unknown error")}},t.Timer=function(){this.ts=0,this.reset()},t.Timer.prototype.reset=function(){this.ts=Date.now()},t.Timer.prototype.elapsed=function(){return Date.now()-this.ts},t.Bench=function(){this.ts=0,this.reset()},t.Bench.prototype.reset=function(){this.ts=t.Bench.now()},t.Bench.prototype.elapsed=function(){return t.Bench.now()-this.ts},t.Bench.now=function(){var e=n.hrtime();return 1e3*e[0]+e[1]/1e6},t.escapeRegex=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")},t.base64urlEncode=function(r,n){return t.assert("string"==typeof r||e.isBuffer(r),"value must be string or buffer"),(e.isBuffer(r)?r:new e(r,n||"binary")).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")},t.base64urlDecode=function(t,r){if("string"!=typeof t)return new Error("Value not a string");if(!/^[\w\-]*$/.test(t))return new Error("Invalid character");var n=new e(t,"base64");return"buffer"===r?n:n.toString(r||"binary")},t.escapeHeaderAttribute=function(e){return t.assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},t.escapeHtml=function(e){return l.escapeHtml(e)},t.escapeJavaScript=function(e){return l.escapeJavaScript(e)},t.nextTick=function(e){return function(){var t=arguments;n.nextTick(function(){e.apply(null,t)})}},t.once=function(e){if(e._hoekOnce)return e;var t=!1,r=function(){t||(t=!0,e.apply(null,arguments))};return r._hoekOnce=!0,r},t.isInteger=Number.isSafeInteger,t.ignore=function(){},t.inherits=s.inherits,t.format=s.format,t.transform=function(e,r,n){t.assert(null===e||void 0===e||"object"===(void 0===e?"undefined":i(e))||Array.isArray(e),"Invalid source object: must be null, undefined, an object, or an array");var a="object"===(void 0===n?"undefined":i(n))&&null!==n&&n.separator||".";if(Array.isArray(e)){for(var o=[],s=0;s<e.length;++s)o.push(t.transform(e[s],r,n));return o}for(var l={},u=Object.keys(r),c=0;c<u.length;++c){var h=u[c],f=h.split(a),d=r[h];t.assert("string"==typeof d,'All mappings must be "." delineated strings');for(var p=void 0,g=l;f.length>1;)g[p=f.shift()]||(g[p]={}),g=g[p];g[p=f.shift()]=t.reach(e,d,n)}return l},t.uniqueFilename=function(e,t){t=t?"."!==t[0]?"."+t:t:"",e=o.resolve(e);var r=[Date.now(),n.pid,a.randomBytes(8).toString("hex")].join("-")+t;return o.join(e,r)},t.stringify=function(){try{return JSON.stringify.apply(null,arguments)}catch(e){return"[Cannot display object: "+e.message+"]"}},t.shallow=function(e){for(var t={},r=Object.keys(e),n=0;n<r.length;++n){var i=r[n];t[i]=e[i]}return t}}).call(t,r(3).Buffer,r(4))},function(e,t){function r(){throw new Error("Buffer is not included.")}r.isBuffer=function(){return!1},t.INSPECT_MAX_BYTES=50,t.SlowBuffer=r,t.Buffer=r},function(e,t){var r,n,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var l,u=[],c=!1,h=-1;function f(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&d())}function d(){if(!c){var e=s(f);c=!0;for(var t=u.length;t;){for(l=u,u=[];++h<t;)l&&l[h].run();h=-1,t=u.length}l=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||c||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return n.exec(e).slice(1)};function a(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}t.resolve=function(){for(var t="",n=!1,i=arguments.length-1;i>=-1&&!n;i--){var o=i>=0?arguments[i]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,n="/"===o.charAt(0))}return t=r(a(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),i="/"===o(e,-1);return(e=r(a(e.split("/"),function(e){return!!e}),!n).join("/"))||n||(e="."),e&&i&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(a(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),a=n(r.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l<o;l++)if(i[l]!==a[l]){s=l;break}var u=[];for(l=s;l<i.length;l++)u.push("..");return(u=u.concat(a.slice(s))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=i(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},t.basename=function(e,t){var r=i(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){return i(e)[3]};var o="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(t,r(4))},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!y(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(s(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,a=n.length,o=String(e).replace(i,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),l=n[r];r<a;l=n[++r])g(l)||!b(l)?o+=" "+l:o+=" "+s(l);return o},t.deprecate=function(r,i){if(m(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var a=!1;return function(){if(!a){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),a=!0}return r.apply(this,arguments)}};var a,o={};function s(e,r){var n={seen:[],stylize:u};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(r)?n.showHidden=r:r&&t._extend(n,r),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),c(n,e,n.depth)}function l(e,t){var r=s.styles[t];return r?"["+s.colors[r][0]+"m"+e+"["+s.colors[r][1]+"m":e}function u(e,t){return e}function c(e,r,n){if(e.customInspect&&r&&T(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return y(i)||(i=c(e,i,n)),i}var a=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(_(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,r);if(a)return a;var o=Object.keys(r),s=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),E(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(r);if(0===o.length){if(T(r)){var l=r.name?": "+r.name:"";return e.stylize("[Function"+l+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return h(r)}var u,b="",S=!1,x=["{","}"];(d(r)&&(S=!0,x=["[","]"]),T(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(b=" "+RegExp.prototype.toString.call(r)),w(r)&&(b=" "+Date.prototype.toUTCString.call(r)),E(r)&&(b=" "+h(r)),0!==o.length||S&&0!=r.length?n<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=S?function(e,t,r,n,i){for(var a=[],o=0,s=t.length;o<s;++o)A(t,String(o))?a.push(f(e,t,r,n,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(f(e,t,r,n,i,!0))}),a}(e,r,n,s,o):o.map(function(t){return f(e,r,n,s,t,S)}),e.seen.pop(),function(e,t,r){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,b,x)):x[0]+b+x[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,n,i,a){var o,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),A(n,i)||(o="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=g(r)?c(e,l.value,null):c(e,l.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),m(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function g(e){return null===e}function _(e){return"number"==typeof e}function y(e){return"string"==typeof e}function m(e){return void 0===e}function v(e){return b(e)&&"[object RegExp]"===S(e)}function b(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e}function w(e){return b(e)&&"[object Date]"===S(e)}function E(e){return b(e)&&("[object Error]"===S(e)||e instanceof Error)}function T(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(m(a)&&(a=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(a)){var r=n.pid;o[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else o[e]=function(){};return o[e]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=_,t.isString=y,t.isSymbol=function(e){return"symbol"===(void 0===e?"undefined":_typeof(e))},t.isUndefined=m,t.isRegExp=v,t.isObject=b,t.isDate=w,t.isError=E,t.isFunction=T,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===(void 0===e?"undefined":_typeof(e))||void 0===e},t.isBuffer=r(8);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(e=new Date,r=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":"),[e.getDate(),I[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(9),t._extend=function(e,t){if(!t||!b(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(t,function(){return this}(),r(4))},function(e,t){e.exports=function(e){return e&&"object"===(void 0===e?"undefined":_typeof(e))&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){(function(e){var r={};t.escapeJavaScript=function(e){if(!e)return"";for(var t="",n=0;n<e.length;++n){var i=e.charCodeAt(n);r.isSafe(i)?t+=e[n]:t+=r.escapeJavaScriptChar(i)}return t},t.escapeHtml=function(e){if(!e)return"";for(var t="",n=0;n<e.length;++n){var i=e.charCodeAt(n);r.isSafe(i)?t+=e[n]:t+=r.escapeHtmlChar(i)}return t},r.escapeJavaScriptChar=function(t){if(t>=256)return"\\u"+r.padLeft(""+t,4);var n=new e(String.fromCharCode(t),"ascii").toString("hex");return"\\x"+r.padLeft(n,2)},r.escapeHtmlChar=function(t){var n=r.namedHtml[t];if(void 0!==n)return n;if(t>=256)return"&#"+t+";";var i=new e(String.fromCharCode(t),"ascii").toString("hex");return"&#x"+r.padLeft(i,2)+";"},r.padLeft=function(e,t){for(;e.length<t;)e="0"+e;return e},r.isSafe=function(e){return void 0!==r.safeCharCodes[e]},r.namedHtml={38:"&",60:"<",62:">",34:""",160:" ",162:"¢",163:"£",164:"¤",169:"©",174:"®"},r.safeCharCodes=function(){for(var e={},t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&(e[t]=null);return e}()}).call(t,r(3).Buffer)},function(e,t,r){var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i="function"==typeof Symbol&&"symbol"===_typeof(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_typeof(e)};var a=r(2),o=r(12),s=r(13),l=null,u=null,c={Set:r(15),defaults:{abortEarly:!0,convert:!0,allowUnknown:!1,skipFunctions:!1,stripUnknown:!1,language:{},presence:"optional",strip:!1,noDefaults:!1}};e.exports=c.Any=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u=u||r(16),this.isJoi=!0,this._type="any",this._settings=null,this._valids=new c.Set,this._invalids=new c.Set,this._tests=[],this._refs=[],this._flags={},this._description=null,this._unit=null,this._notes=[],this._tags=[],this._examples=[],this._meta=[],this._inner={}}return e.prototype.createError=function(e,t,r,n){return s.create(e,t,r,n,this._flags)},e.prototype.createOverrideError=function(e,t,r,n,i,a){return s.create(e,t,r,n,this._flags,i,a)},e.prototype.checkOptions=function(e){var t=r(28).options.validate(e);if(t.error)throw new Error(t.error.details[0].message)},e.prototype.clone=function(){var e=Object.create(Object.getPrototypeOf(this));e.isJoi=!0,e._type=this._type,e._settings=c.concatSettings(this._settings),e._baseType=this._baseType,e._valids=a.clone(this._valids),e._invalids=a.clone(this._invalids),e._tests=this._tests.slice(),e._refs=this._refs.slice(),e._flags=a.clone(this._flags),e._description=this._description,e._unit=this._unit,e._notes=this._notes.slice(),e._tags=this._tags.slice(),e._examples=this._examples.slice(),e._meta=this._meta.slice(),e._inner={};for(var t=Object.keys(this._inner),r=0;r<t.length;++r){var n=t[r];e._inner[n]=this._inner[n]?this._inner[n].slice():null}return e},e.prototype.concat=function(e){a.assert(e instanceof c.Any,"Invalid schema object"),a.assert("any"===this._type||"any"===e._type||e._type===this._type,"Cannot merge type",this._type,"with another type:",e._type);var t=this.clone();if("any"===this._type&&"any"!==e._type){for(var r=e.clone(),n=["_settings","_valids","_invalids","_tests","_refs","_flags","_description","_unit","_notes","_tags","_examples","_meta","_inner"],i=0;i<n.length;++i)r[n[i]]=t[n[i]];t=r}t._settings=t._settings?c.concatSettings(t._settings,e._settings):e._settings,t._valids.merge(e._valids,e._invalids),t._invalids.merge(e._invalids,e._valids),t._tests=t._tests.concat(e._tests),t._refs=t._refs.concat(e._refs),a.merge(t._flags,e._flags),t._description=e._description||t._description,t._unit=e._unit||t._unit,t._notes=t._notes.concat(e._notes),t._tags=t._tags.concat(e._tags),t._examples=t._examples.concat(e._examples),t._meta=t._meta.concat(e._meta);for(var o=Object.keys(e._inner),s="object"===t._type,l=0;l<o.length;++l){var u=o[l],h=e._inner[u];if(h){var f=t._inner[u];if(f)if(s&&"children"===u){for(var d={},p=0;p<f.length;++p)d[f[p].key]=p;for(var g=0;g<h.length;++g){var _=h[g].key;d[_]>=0?f[d[_]]={key:_,schema:f[d[_]].schema.concat(h[g].schema)}:f.push(h[g])}}else t._inner[u]=t._inner[u].concat(h);else t._inner[u]=h.slice()}}return t},e.prototype._test=function(e,t,r,n){var i=this.clone();return i._tests.push({func:r,name:e,arg:t,options:n}),i},e.prototype.options=function(e){a.assert(!e.context,"Cannot override context"),this.checkOptions(e);var t=this.clone();return t._settings=c.concatSettings(t._settings,e),t},e.prototype.strict=function(e){var t=this.clone();return t._settings=t._settings||{},t._settings.convert=void 0!==e&&!e,t},e.prototype.raw=function(e){var t=void 0===e||e;if(this._flags.raw===t)return this;var r=this.clone();return r._flags.raw=t,r},e.prototype.error=function(e){a.assert(e&&(e instanceof Error||"function"==typeof e),"Must provide a valid Error object or a function");var t=this.clone();return t._flags.error=e,t},e.prototype.allow=function(){for(var e=this.clone(),t=a.flatten(Array.prototype.slice.call(arguments)),r=0;r<t.length;++r){var n=t[r];a.assert(void 0!==n,"Cannot call allow/valid/invalid with undefined"),e._invalids.remove(n),e._valids.add(n,e._refs)}return e},e.prototype.valid=function(){var e=this.allow.apply(this,arguments);return e._flags.allowOnly=!0,e},e.prototype.invalid=function(e){for(var t=this.clone(),r=a.flatten(Array.prototype.slice.call(arguments)),n=0;n<r.length;++n)e=r[n],a.assert(void 0!==e,"Cannot call allow/valid/invalid with undefined"),t._valids.remove(e),t._invalids.add(e,this._refs);return t},e.prototype.required=function(){if("required"===this._flags.presence)return this;var e=this.clone();return e._flags.presence="required",e},e.prototype.optional=function(){if("optional"===this._flags.presence)return this;var e=this.clone();return e._flags.presence="optional",e},e.prototype.forbidden=function(){if("forbidden"===this._flags.presence)return this;var e=this.clone();return e._flags.presence="forbidden",e},e.prototype.strip=function(){if(this._flags.strip)return this;var e=this.clone();return e._flags.strip=!0,e},e.prototype.applyFunctionToChildren=function(e,t,r,n){if(1!==(e=[].concat(e)).length||""!==e[0]){n=n?n+".":"";var i=(""===e[0]?e.slice(1):e).map(function(e){return n+e});throw new Error("unknown key(s) "+i.join(", "))}return this[t].apply(this,r)},e.prototype.default=function(e,t){"function"!=typeof e||o.isRef(e)||(!e.description&&t&&(e.description=t),this._flags.func||a.assert("string"==typeof e.description&&e.description.length>0,"description must be provided when default value is a function"));var r=this.clone();return r._flags.default=e,o.push(r._refs,e),r},e.prototype.empty=function(e){var t=this.clone();return t._flags.empty=void 0===e?void 0:u.schema(e),t},e.prototype.when=function(e,t){a.assert(t&&"object"===(void 0===t?"undefined":i(t)),"Invalid options"),a.assert(void 0!==t.then||void 0!==t.otherwise,'options must have at least one of "then" or "otherwise"');var n=t.hasOwnProperty("then")?this.concat(u.schema(t.then)):void 0,o=t.hasOwnProperty("otherwise")?this.concat(u.schema(t.otherwise)):void 0,s=(l=l||r(25)).when(e,{is:t.is,then:n,otherwise:o});return s._flags.presence="ignore",s._baseType=this,s},e.prototype.description=function(e){a.assert(e&&"string"==typeof e,"Description must be a non-empty string");var t=this.clone();return t._description=e,t},e.prototype.notes=function(e){a.assert(e&&("string"==typeof e||Array.isArray(e)),"Notes must be a non-empty string or array");var t=this.clone();return t._notes=t._notes.concat(e),t},e.prototype.tags=function(e){a.assert(e&&("string"==typeof e||Array.isArray(e)),"Tags must be a non-empty string or array");var t=this.clone();return t._tags=t._tags.concat(e),t},e.prototype.meta=function(e){a.assert(void 0!==e,"Meta cannot be undefined");var t=this.clone();return t._meta=t._meta.concat(e),t},e.prototype.example=function(e){a.assert(arguments.length,"Missing example");var t=this._validate(e,null,c.defaults);a.assert(!t.errors,"Bad example:",t.errors&&s.process(t.errors,e));var r=this.clone();return r._examples.push(e),r},e.prototype.unit=function(e){a.assert(e&&"string"==typeof e,"Unit name must be a non-empty string");var t=this.clone();return t._unit=e,t},e.prototype._prepareEmptyValue=function(e){return"string"==typeof e&&this._flags.trim?e.trim():e},e.prototype._validate=function(e,t,r,n){var i=this,l=e;t=t||{key:"",path:"",parent:null,reference:n},this._settings&&(r=c.concatSettings(r,this._settings));var u=[],h=function(){var n=void 0;if(void 0!==e)n=i._flags.raw?l:e;else if(r.noDefaults)n=e;else if(o.isRef(i._flags.default))n=i._flags.default(t.parent,r);else if("function"!=typeof i._flags.default||i._flags.func&&!i._flags.default.description)n=a.clone(i._flags.default);else{var s=void 0;null!==t.parent&&i._flags.default.length>0&&(s=[a.clone(t.parent),r]);var h=c._try(i._flags.default,s);n=h.value,h.error&&u.push(i.createError("any.default",h.error,t,r))}if(u.length&&"function"==typeof i._flags.error){var f=i._flags.error.call(i,u);u="string"==typeof f?[i.createOverrideError("override",{reason:u},t,r,f)]:[].concat(f).map(function(e){return e instanceof Error?e:i.createOverrideError(e.type||"override",e.context,t,r,e.message,e.template)})}return{value:i._flags.strip?void 0:n,finalValue:n,errors:u.length?u:null}};if(this._coerce){var f=this._coerce.call(this,e,t,r);if(f.errors)return e=f.value,u=u.concat(f.errors),h();e=f.value}this._flags.empty&&!this._flags.empty._validate(this._prepareEmptyValue(e),null,c.defaults).errors&&(e=void 0);var d=this._flags.presence||r.presence;if("optional"===d){if(void 0===e){if(!(this._flags.hasOwnProperty("default")&&void 0===this._flags.default)||"object"!==this._type)return h();e={}}}else{if("required"===d&&void 0===e)return u.push(this.createError("any.required",null,t,r)),h();if("forbidden"===d)return void 0===e?h():(u.push(this.createError("any.unknown",null,t,r)),h())}if(this._valids.has(e,t,r,this._flags.insensitive))return h();if(this._invalids.has(e,t,r,this._flags.insensitive)&&(u.push(this.createError(""===e?"any.empty":"any.invalid",null,t,r)),r.abortEarly||void 0===e))return h();if(this._base){var p=this._base.call(this,e,t,r);if(p.errors)return e=p.value,u=u.concat(p.errors),h();if(p.value!==e){if(e=p.value,this._valids.has(e,t,r,this._flags.insensitive))return h();if(this._invalids.has(e,t,r,this._flags.insensitive)&&(u.push(this.createError(""===e?"any.empty":"any.invalid",null,t,r)),r.abortEarly))return h()}}if(this._flags.allowOnly&&(u.push(this.createError("any.allowOnly",{valids:this._valids.values({stripUndefined:!0})},t,r)),r.abortEarly))return h();for(var g=0;g<this._tests.length;++g){var _=this._tests[g].func.call(this,e,t,r);if(_ instanceof s.Err){if(u.push(_),r.abortEarly)return h()}else e=_}return h()},e.prototype._validateWithOptions=function(e,t,r){t&&this.checkOptions(t);var n=c.concatSettings(c.defaults,t),i=this._validate(e,null,n),a=s.process(i.errors,e);return r?r(a,i.value):{error:a,value:i.value}},e.prototype.validate=function(e,t,r){return"function"==typeof t?this._validateWithOptions(e,null,t):this._validateWithOptions(e,t,r)},e.prototype.describe=function(){var e=this,t={type:this._type},r=Object.keys(this._flags);if(r.length)if(["empty","default","lazy","label"].some(function(t){return e._flags.hasOwnProperty(t)})){t.flags={};for(var n=0;n<r.length;++n){var i=r[n];"empty"===i?t.flags[i]=this._flags[i].describe():"default"===i?o.isRef(this._flags[i])?t.flags[i]=this._flags[i].toString():"function"==typeof this._flags[i]?t.flags[i]=this._flags[i].description:t.flags[i]=this._flags[i]:"lazy"===i||"label"===i||(t.flags[i]=this._flags[i])}}else t.flags=this._flags;this._settings&&(t.options=a.clone(this._settings)),this._baseType&&(t.base=this._baseType.describe()),this._description&&(t.description=this._description),this._notes.length&&(t.notes=this._notes),this._tags.length&&(t.tags=this._tags),this._meta.length&&(t.meta=this._meta),this._examples.length&&(t.examples=this._examples),this._unit&&(t.unit=this._unit);var s=this._valids.values();s.length&&(t.valids=s.map(function(e){return o.isRef(e)?e.toString():e}));var l=this._invalids.values();l.length&&(t.invalids=l.map(function(e){return o.isRef(e)?e.toString():e})),t.rules=[];for(var u=0;u<this._tests.length;++u){var c=this._tests[u],h={name:c.name};void 0!==c.arg&&(h.arg=o.isRef(c.arg)?c.arg.toString():c.arg);var f=c.options;if(f){if(f.hasRef){h.arg={};for(var d=Object.keys(c.arg),p=0;p<d.length;++p){var g=d[p],_=c.arg[g];h.arg[g]=o.isRef(_)?_.toString():_}}"string"==typeof f.description?h.description=f.description:"function"==typeof f.description&&(h.description=f.description(h.arg))}t.rules.push(h)}t.rules.length||delete t.rules;var y=this._getLabel();return y&&(t.label=y),t},e.prototype.label=function(e){a.assert(e&&"string"==typeof e,"Label name must be a non-empty string");var t=this.clone();return t._flags.label=e,t},e.prototype._getLabel=function(e){return this._flags.label||e},e}(),c.Any.prototype.isImmutable=!0,c.Any.prototype.only=c.Any.prototype.equal=c.Any.prototype.valid,c.Any.prototype.disallow=c.Any.prototype.not=c.Any.prototype.invalid,c.Any.prototype.exist=c.Any.prototype.required,c._try=function(e,t){var r=void 0,n=void 0;try{n=e.apply(null,t)}catch(e){r=e}return{value:n,error:r}},c.concatSettings=function(e,t){if(!e&&!t)return null;var r={};if(e&&n(r,e),t)for(var i=Object.keys(t),o=0;o<i.length;++o){var s=i[o];"language"===s&&r.hasOwnProperty(s)?r[s]=a.applyToDefaults(r[s],t[s]):r[s]=t[s]}return r}},function(e,t,r){var n=r(2);t.create=function(e,t){n.assert("string"==typeof e,"Invalid reference key:",e);var r=n.clone(t),i=function e(t,i){return n.reach(e.isContext?i.context:t,e.key,r)};return i.isContext=e[0]===(r&&r.contextPrefix||"$"),i.key=i.isContext?e.slice(1):e,i.path=i.key.split(r&&r.separator||"."),i.depth=i.path.length,i.root=i.path[0],i.isJoi=!0,i.toString=function(){return(i.isContext?"context:":"ref:")+i.key},i},t.isRef=function(e){return"function"==typeof e&&e.isJoi},t.push=function(e,r){t.isRef(r)&&!r.isContext&&e.push(r.root)}},function(e,t,r){var n="function"==typeof Symbol&&"symbol"===_typeof(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof(e)}:function(e){return e&&"function"==typeof Symbol&&e