{"code":"!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,\"a\",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p=\"\",r(r.s=120)}([function(t,e){\"function\"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){t.exports=lodash},function(t,e,r){var n=r(3),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if(\"number\"==typeof t)throw new TypeError(\"Argument must not be a number\");return i(t,e,r)},s.alloc=function(t,e,r){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");var n=i(t);return void 0!==e?\"string\"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return i(t)},s.allocUnsafeSlow=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Argument must be a number\");return n.SlowBuffer(t)}},function(t,e,r){\"use strict\";(function(t){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\nvar n=r(131),i=r(132),o=r(66);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+s().toString(16)+\" bytes\");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if(\"undefined\"!=typeof ArrayBuffer&&\"function\"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;\"string\"!=typeof t&&(t=\"\"+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":case void 0:return U(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return D(t).length;default:if(n)return U(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if(\"string\"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,i);if(\"number\"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&\"function\"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,i);throw new TypeError(\"val must be string, number or Buffer\")}function g(t,e,r,n,i){var o,s=1,a=t.length,c=e.length;if(void 0!==n&&(\"ucs2\"===(n=String(n).toLowerCase())||\"ucs-2\"===n||\"utf16le\"===n||\"utf-16le\"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var f=!0,l=0;li&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError(\"Invalid hex string\");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+f<=r)switch(f){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(h=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,f=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=f}return function(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var r=\"\",n=0;for(;nthis.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return R(this,e,r);case\"utf8\":case\"utf-8\":return A(this,e,r);case\"ascii\":return k(this,e,r);case\"latin1\":case\"binary\":return T(this,e,r);case\"base64\":return S(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return M(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError(\"Argument must be a Buffer\");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t=\"\",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString(\"hex\",0,r).match(/.{2}/g).join(\" \"),this.length>r&&(t+=\" ... \")),\"\"},c.prototype.compare=function(t,e,r,n,i){if(!c.isBuffer(t))throw new TypeError(\"Argument must be a Buffer\");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError(\"out of range index\");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(n,i),h=t.slice(e,r),f=0;fi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");n||(n=\"utf8\");for(var o=!1;;)switch(n){case\"hex\":return y(this,t,e,r);case\"utf8\":case\"utf-8\":return _(this,t,e,r);case\"ascii\":return v(this,t,e,r);case\"latin1\":case\"binary\":return w(this,t,e,r);case\"base64\":return E(this,t,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return x(this,t,e,r);default:if(o)throw new TypeError(\"Unknown encoding: \"+n);n=(\"\"+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function k(t,e,r){var n=\"\";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i=\"\",o=e;or)throw new RangeError(\"Trying to access beyond buffer length\")}function I(t,e,r,n,i,o){if(!c.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError(\"Index out of range\")}function N(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function O(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function B(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function q(t,e,r,n,o){return o||B(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,o){return o||B(t,0,r,8),i.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},c.prototype.readUInt8=function(t,e){return e||j(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||j(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||j(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||j(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||j(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||j(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||j(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||j(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,r){return q(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return q(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError(\"sourceStart out of bounds\");if(n<0)throw new RangeError(\"sourceEnd out of bounds\");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),\"number\"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function D(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\\s+|\\s+$/g,\"\")}(t).replace(L,\"\")).length<2)return\"\";for(;t.length%4!=0;)t+=\"=\";return t}(t))}function F(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(8))},function(t,e,r){(function(t){!function(t,e){\"use strict\";function n(t,e){if(!t)throw new Error(e||\"Assertion failed\")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(\"le\"!==e&&\"be\"!==e||(r=e,e=10),this._init(t||0,e||10,r||\"be\"))}var s;\"object\"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s=r(210).Buffer}catch(t){}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;o=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&\"object\"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if(\"number\"==typeof t)return this._initNumber(t,e,r);if(\"object\"==typeof t)return this._initArray(t,e,r);\"hex\"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;\"-\"===(t=t.toString().replace(/\\s+/g,\"\"))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),\"-\"===t[0]&&(this.negative=1),this.strip(),\"le\"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),\"le\"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n(\"number\"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if(\"le\"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=a(t,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=a(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?\"\"};var u=[\"\",\"0\",\"00\",\"000\",\"0000\",\"00000\",\"000000\",\"0000000\",\"00000000\",\"000000000\",\"0000000000\",\"00000000000\",\"000000000000\",\"0000000000000\",\"00000000000000\",\"000000000000000\",\"0000000000000000\",\"00000000000000000\",\"000000000000000000\",\"0000000000000000000\",\"00000000000000000000\",\"000000000000000000000\",\"0000000000000000000000\",\"00000000000000000000000\",\"000000000000000000000000\",\"0000000000000000000000000\"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,f=67108863&c,l=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=l;d++){var p=u-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,c=0|h}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||\"hex\"===t){r=\"\";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?u[6-c.length]+c+r:c+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=h[t],d=f[t];r=\"\";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:u[l-m.length]+m+r}for(this.isZero()&&(r=\"0\"+r);r.length%e!=0;)r=\"0\"+r;return 0!==this.negative&&(r=\"-\"+r),r}n(!1,\"Base should be between 2 and 36\")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,\"Number can only safely store up to 53 bits\"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,\"byte array longer than desired length\"),n(o>0,\"Requested array length <= 0\"),this.strip();var s,a,c=\"le\"===e,u=new t(o),h=this.clone();if(c){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n(\"number\"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n(\"number\"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,b=0|s[2],g=8191&b,y=b>>>13,_=0|s[3],v=8191&_,w=_>>>13,E=0|s[4],x=8191&E,S=E>>>13,A=0|s[5],C=8191&A,k=A>>>13,T=0|s[6],R=8191&T,M=T>>>13,j=0|s[7],I=8191&j,N=j>>>13,O=0|s[8],B=8191&O,q=O>>>13,P=0|s[9],L=8191&P,$=P>>>13,U=0|a[0],D=8191&U,F=U>>>13,z=0|a[1],H=8191&z,Q=z>>>13,W=0|a[2],K=8191&W,V=W>>>13,Y=0|a[3],G=8191&Y,X=Y>>>13,J=0|a[4],Z=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ct=8191&at,ut=at>>>13,ht=0|a[8],ft=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(u+(n=Math.imul(f,D))|0)+((8191&(i=(i=Math.imul(f,F))+Math.imul(l,D)|0))<<13)|0;u=((o=Math.imul(l,F))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,F))+Math.imul(m,D)|0,o=Math.imul(m,F);var gt=(u+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,Q)|0)+Math.imul(l,H)|0))<<13)|0;u=((o=o+Math.imul(l,Q)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,F))+Math.imul(y,D)|0,o=Math.imul(y,F),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,Q)|0;var yt=(u+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(l,K)|0))<<13)|0;u=((o=o+Math.imul(l,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(v,D),i=(i=Math.imul(v,F))+Math.imul(w,D)|0,o=Math.imul(w,F),n=n+Math.imul(g,H)|0,i=(i=i+Math.imul(g,Q)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,Q)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var _t=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(l,G)|0))<<13)|0;u=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,D),i=(i=Math.imul(x,F))+Math.imul(S,D)|0,o=Math.imul(S,F),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,V)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,X)|0;var vt=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(l,Z)|0))<<13)|0;u=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(C,D),i=(i=Math.imul(C,F))+Math.imul(k,D)|0,o=Math.imul(k,F),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,Q)|0,n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,tt)|0;var wt=(u+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(l,rt)|0))<<13)|0;u=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,F))+Math.imul(M,D)|0,o=Math.imul(M,F),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,Q)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,Q)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(v,G)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;u=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(I,D),i=(i=Math.imul(I,F))+Math.imul(N,D)|0,o=Math.imul(N,F),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,Q)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var xt=(u+(n=n+Math.imul(f,ct)|0)|0)+((8191&(i=(i=i+Math.imul(f,ut)|0)+Math.imul(l,ct)|0))<<13)|0;u=((o=o+Math.imul(l,ut)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,F))+Math.imul(q,D)|0,o=Math.imul(q,F),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,Q)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,X)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ut)|0;var St=(u+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;u=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,D),i=(i=Math.imul(L,F))+Math.imul($,D)|0,o=Math.imul($,F),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,Q)|0)+Math.imul(q,H)|0,o=o+Math.imul(q,Q)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,lt)|0;var At=(u+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(l,pt)|0))<<13)|0;u=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,H),i=(i=Math.imul(L,Q))+Math.imul($,H)|0,o=Math.imul($,Q),n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(q,K)|0,o=o+Math.imul(q,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(v,ct)|0,i=(i=i+Math.imul(v,ut)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,ut)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,lt)|0;var Ct=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,V))+Math.imul($,K)|0,o=Math.imul($,V),n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(q,G)|0,o=o+Math.imul(q,X)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,lt)|0)+Math.imul(w,ft)|0,o=o+Math.imul(w,lt)|0;var kt=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,mt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(L,G),i=(i=Math.imul(L,X))+Math.imul($,G)|0,o=Math.imul($,X),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(q,Z)|0,o=o+Math.imul(q,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(C,ct)|0,i=(i=i+Math.imul(C,ut)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,lt)|0)+Math.imul(S,ft)|0,o=o+Math.imul(S,lt)|0;var Tt=(u+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(w,pt)|0))<<13)|0;u=((o=o+Math.imul(w,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,tt))+Math.imul($,Z)|0,o=Math.imul($,tt),n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(q,rt)|0,o=o+Math.imul(q,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ut)|0,n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,lt)|0;var Rt=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(L,rt),i=(i=Math.imul(L,nt))+Math.imul($,rt)|0,o=Math.imul($,nt),n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,st)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ut)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Mt=(u+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,ot),i=(i=Math.imul(L,st))+Math.imul($,ot)|0,o=Math.imul($,st),n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,ut)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,ut)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,lt)|0;var jt=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(L,ct),i=(i=Math.imul(L,ut))+Math.imul($,ct)|0,o=Math.imul($,ut),n=n+Math.imul(B,ft)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(q,ft)|0,o=o+Math.imul(q,lt)|0;var It=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,ft),i=(i=Math.imul(L,lt))+Math.imul($,ft)|0,o=Math.imul($,lt);var Nt=(u+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,mt)|0)+Math.imul(q,pt)|0))<<13)|0;u=((o=o+Math.imul(q,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ot=(u+(n=Math.imul(L,pt))|0)+((8191&(i=(i=Math.imul(L,mt))+Math.imul($,pt)|0))<<13)|0;return u=((o=Math.imul($,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,c[0]=bt,c[1]=gt,c[2]=yt,c[3]=_t,c[4]=vt,c[5]=wt,c[6]=Et,c[7]=xt,c[8]=St,c[9]=At,c[10]=Ct,c[11]=kt,c[12]=Tt,c[13]=Rt,c[14]=Mt,c[15]=jt,c[16]=It,c[17]=Nt,c[18]=Ot,0!==u&&(c[19]=u,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-o|f>>>o,h=f&a}return c&&0!==h&&(c.words[c.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n(\"number\"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,\"imaskn works only with positive numbers\"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n(\"number\"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if(\"mod\"!==e){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;f--){var l=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),\"div\"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),\"mod\"!==e&&(i=a.div.neg()),\"div\"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),\"mod\"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),\"div\"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?\"div\"===e?{div:this.divn(t.words[0]),mod:null}:\"mod\"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,\"div\",!1).div},o.prototype.mod=function(t){return this.divmod(t,\"mod\",!1).mod},o.prototype.umod=function(t){return this.divmod(t,\"mod\",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(h),c.isub(f)),a.iushrn(1),c.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(c)):(r.isub(e),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),c=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n(\"number\"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,\"Number is too big\");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,\"Already a number in reduction context\"),n(0===this.negative,\"red works only with positives\"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,\"fromRed works only with numbers in reduction context\"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,\"Already a number in reduction context\"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,\"redAdd works only with red numbers\"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,\"redIAdd works only with red numbers\"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,\"redSub works only with red numbers\"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,\"redISub works only with red numbers\"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,\"redShl works only with red numbers\"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,\"redMul works only with red numbers\"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,\"redSqr works only with red numbers\"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,\"redISqr works only with red numbers\"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,\"redSqrt works only with red numbers\"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,\"redInvm works only with red numbers\"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,\"redNeg works only with red numbers\"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,\"redPow(normalNum)\"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,\"k256\",\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\")}function _(){g.call(this,\"p224\",\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\")}function v(){g.call(this,\"p192\",\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\")}function w(){g.call(this,\"25519\",\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\")}function E(t){if(\"string\"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),\"modulus must be greater than 1\"),this.m=t,this.prime=null}function x(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(b[t])return b[t];var e;if(\"k256\"===t)e=new y;else if(\"p224\"===t)e=new _;else if(\"p192\"===t)e=new v;else{if(\"p25519\"!==t)throw new Error(\"Unknown prime \"+t);e=new w}return b[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,\"red works only with positives\"),n(t.red,\"red works only with red numbers\")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),\"red works only with positives\"),n(t.red&&t.red===e.red,\"red works only with red numbers\")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,u).cmp(c);)h.redIAdd(c);for(var f=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,b=0;0!==m.cmp(a);b++)m=m.redSqr();n(b=0;n--){for(var u=e.words[n],h=c-1;h>=0;h--){var f=u>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},i(x,E),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(77)(t))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error(\"setTimeout has not been defined\")}function s(){throw new Error(\"clearTimeout has not been defined\")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r=\"function\"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n=\"function\"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],h=!1,f=-1;function l(){h&&c&&(h=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!h){var t=a(l);h=!0;for(var e=u.length;e;){for(c=u,u=[];++f1)for(var r=1;r0;)u(t)}function u(t){var e=t.shift();if(\"function\"!=typeof e)e._settlePromises();else{var r=t.shift(),n=t.shift();e.call(r,n)}}a.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},a.prototype.hasCustomScheduler=function(){return this._customScheduler},a.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},a.prototype.fatalError=function(t,r){r?(e.stderr.write(\"Fatal \"+(t instanceof Error?t.stack:t)+\"\\n\"),e.exit(2)):this.throwLater(t)},a.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),\"undefined\"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error(\"No async scheduler available\\n\\n See http://goo.gl/MqrFmX\\n\")}},a.prototype.invokeLater=function(t,e,r){this._lateQueue.push(t,e,r),this._queueTick()},a.prototype.invoke=function(t,e,r){this._normalQueue.push(t,e,r),this._queueTick()},a.prototype.settlePromises=function(t){this._normalQueue._pushOne(t),this._queueTick()},a.prototype._drainQueues=function(){c(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,c(this._lateQueue)},a.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},a.prototype._reset=function(){this._isTickUsed=!1},r.exports=a,r.exports.firstLineError=i},{\"./queue\":26,\"./schedule\":29}],3:[function(t,e,r){\"use strict\";e.exports=function(t,e,r,n){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var u=r(o),h=new t(e);h._propagateFrom(this,1);var f=this._target();if(h._setBoundTo(u),u instanceof t){var l={promiseRejectionQueued:!1,promise:h,target:f,bindingPromise:u};f._then(e,s,void 0,h,l),u._then(a,c,void 0,h,l),h._setOnCancel(u)}else h._resolveCallback(f);return h},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,r){return t.resolve(r).bind(e)}}},{}],4:[function(t,e,r){\"use strict\";var n;\"undefined\"!=typeof Promise&&(n=Promise);var i=t(\"./promise\")();i.noConflict=function(){try{Promise===i&&(Promise=n)}catch(t){}return i},e.exports=i},{\"./promise\":22}],5:[function(t,e,r){\"use strict\";var n=Object.create;if(n){var i=n(null),o=n(null);i[\" size\"]=o[\" size\"]=0}e.exports=function(e){var r=t(\"./util\"),n=r.canEvaluate;r.isIdentifier;function i(t){return function(t,n){var i;if(null!=t&&(i=t[n]),\"function\"!=typeof i){var o=\"Object \"+r.classString(t)+\" has no method '\"+r.toString(n)+\"'\";throw new e.TypeError(o)}return i}(t,this.pop()).apply(t,this)}function o(t){return t[this]}function s(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(i,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if(\"number\"==typeof t)e=s;else if(n){var r=(void 0)(t);e=null!==r?r:o}else e=o;return this._then(e,void 0,void 0,t,void 0)}}},{\"./util\":36}],6:[function(t,e,r){\"use strict\";e.exports=function(e,r,n,i){var o=t(\"./util\"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype.break=e.prototype.cancel=function(){if(!i.cancellation())return this._warn(\"cancellation is disabled\");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var r=t._cancellationParent;if(null==r||!r._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=r}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var r=0;r=0)return r[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var t=r.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},n.CapturedTrace=null,n.create=function(){if(e)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;n.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,e=!1},e=!0,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},n}},{}],9:[function(t,r,n){\"use strict\";r.exports=function(r,n,i,o){var s,a,c,u,h=r._async,f=t(\"./errors\").Warning,l=t(\"./util\"),d=t(\"./es5\"),p=l.canAttachTrace,m=/[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](release|debug|instrumented)/,b=/\\((?:timers\\.js):\\d+:\\d+\\)/,g=/[\\/<\\(](.+?):(\\d+):(\\d+)\\)?\\s*$/,y=null,_=null,v=!1,w=!(0==l.env(\"BLUEBIRD_DEBUG\")),E=!(0==l.env(\"BLUEBIRD_WARNINGS\")||!w&&!l.env(\"BLUEBIRD_WARNINGS\")),x=!(0==l.env(\"BLUEBIRD_LONG_STACK_TRACES\")||!w&&!l.env(\"BLUEBIRD_LONG_STACK_TRACES\")),S=0!=l.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\")&&(E||!!l.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\"));!function(){var t=[];function e(){for(var e=0;e0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},r.prototype._warn=function(t,e,r){return H(t,e,r||this)},r.onPossiblyUnhandledRejection=function(t){var e=r._getContext();a=l.contextBind(e,t)},r.onUnhandledRejectionHandled=function(t){var e=r._getContext();s=l.contextBind(e,t)};var A=function(){};r.longStackTraces=function(){if(h.haveItemsQueued()&&!rt.longStackTraces)throw new Error(\"cannot enable long stack traces after promises have been created\\n\\n See http://goo.gl/MqrFmX\\n\");if(!rt.longStackTraces&&G()){var t=r.prototype._captureStackTrace,e=r.prototype._attachExtraTrace,i=r.prototype._dereferenceTrace;rt.longStackTraces=!0,A=function(){if(h.haveItemsQueued()&&!rt.longStackTraces)throw new Error(\"cannot enable long stack traces after promises have been created\\n\\n See http://goo.gl/MqrFmX\\n\");r.prototype._captureStackTrace=t,r.prototype._attachExtraTrace=e,r.prototype._dereferenceTrace=i,n.deactivateLongStackTraces(),rt.longStackTraces=!1},r.prototype._captureStackTrace=D,r.prototype._attachExtraTrace=F,r.prototype._dereferenceTrace=z,n.activateLongStackTraces()}},r.hasLongStackTraces=function(){return rt.longStackTraces&&G()};var C={unhandledrejection:{before:function(){var t=l.global.onunhandledrejection;return l.global.onunhandledrejection=null,t},after:function(t){l.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=l.global.onrejectionhandled;return l.global.onrejectionhandled=null,t},after:function(t){l.global.onrejectionhandled=t}}},k=function(){var t=function(t,e){if(!t)return!l.global.dispatchEvent(e);var r;try{return r=t.before(),!l.global.dispatchEvent(e)}finally{t.after(r)}};try{if(\"function\"==typeof CustomEvent){var e=new CustomEvent(\"CustomEvent\");return l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=new CustomEvent(e,{detail:r,cancelable:!0});return d.defineProperty(n,\"promise\",{value:r.promise}),d.defineProperty(n,\"reason\",{value:r.reason}),t(C[e],n)}}if(\"function\"==typeof Event){e=new Event(\"CustomEvent\");return l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=new Event(e,{cancelable:!0});return n.detail=r,d.defineProperty(n,\"promise\",{value:r.promise}),d.defineProperty(n,\"reason\",{value:r.reason}),t(C[e],n)}}return(e=document.createEvent(\"CustomEvent\")).initCustomEvent(\"testingtheevent\",!1,!0,{}),l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=document.createEvent(\"CustomEvent\");return n.initCustomEvent(e,!1,!0,r),t(C[e],n)}}catch(t){}return function(){return!1}}(),T=l.isNode?function(){return e.emit.apply(e,arguments)}:l.global?function(t){var e=\"on\"+t.toLowerCase(),r=l.global[e];return!!r&&(r.apply(l.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function R(t,e){return{promise:e}}var M={promiseCreated:R,promiseFulfilled:R,promiseRejected:R,promiseResolved:R,promiseCancelled:R,promiseChained:function(t,e,r){return{promise:e,child:r}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,r){return{reason:e,promise:r}},rejectionHandled:R},j=function(t){var e=!1;try{e=T.apply(null,arguments)}catch(t){h.throwLater(t),e=!0}var r=!1;try{r=k(t,M[t].apply(null,arguments))}catch(t){h.throwLater(t),r=!0}return r||e};function I(){return!1}function N(t,e,r){var n=this;try{t(e,r,function(t){if(\"function\"!=typeof t)throw new TypeError(\"onCancel must be a function, got: \"+l.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function O(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?l.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function B(){return this._onCancelField}function q(t){this._onCancelField=t}function P(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(t,e){if(0!=(1&e)){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}r.config=function(t){if(\"longStackTraces\"in(t=Object(t))&&(t.longStackTraces?r.longStackTraces():!t.longStackTraces&&r.hasLongStackTraces()&&A()),\"warnings\"in t){var e=t.warnings;rt.warnings=!!e,S=rt.warnings,l.isObject(e)&&\"wForgottenReturn\"in e&&(S=!!e.wForgottenReturn)}if(\"cancellation\"in t&&t.cancellation&&!rt.cancellation){if(h.haveItemsQueued())throw new Error(\"cannot enable cancellation after promises are in use\");r.prototype._clearCancellationData=P,r.prototype._propagateFrom=L,r.prototype._onCancel=B,r.prototype._setOnCancel=q,r.prototype._attachCancellationCallback=O,r.prototype._execute=N,$=L,rt.cancellation=!0}if(\"monitoring\"in t&&(t.monitoring&&!rt.monitoring?(rt.monitoring=!0,r.prototype._fireEvent=j):!t.monitoring&&rt.monitoring&&(rt.monitoring=!1,r.prototype._fireEvent=I)),\"asyncHooks\"in t&&l.nodeSupportsAsyncResource){var n=rt.asyncHooks,s=!!t.asyncHooks;n!==s&&(rt.asyncHooks=s,s?i():o())}return r},r.prototype._fireEvent=I,r.prototype._execute=function(t,e,r){try{t(e,r)}catch(t){return t}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(t){},r.prototype._attachCancellationCallback=function(t){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._dereferenceTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(t,e){};var $=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function U(){var t=this._boundTo;return void 0!==t&&t instanceof r?t.isFulfilled()?t.value():void 0:t}function D(){this._trace=new tt(this._peekContext())}function F(t,e){if(p(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=W(t);l.notEnumerableProp(t,\"stack\",n.message+\"\\n\"+n.stack.join(\"\\n\")),l.notEnumerableProp(t,\"__stackCleaned__\",!0)}}}function z(){this._trace=void 0}function H(t,e,n){if(rt.warnings){var i,o=new f(t);if(e)n._attachExtraTrace(o);else if(rt.longStackTraces&&(i=r._peekContext()))i.attachExtraTrace(o);else{var s=W(o);o.stack=s.message+\"\\n\"+s.stack.join(\"\\n\")}j(\"warning\",o)||K(o,\"\",!0)}}function Q(t){for(var e=[],r=0;r0?function(t){for(var e=t.stack.replace(/\\s+$/g,\"\").split(\"\\n\"),r=0;r0&&\"SyntaxError\"!=t.name&&(e=e.slice(r)),e}(t):[\" (No stack trace)\"],{message:r,stack:\"SyntaxError\"==t.name?e:Q(e)}}function K(t,e,r){if(\"undefined\"!=typeof console){var n;if(l.isObject(t)){var i=t.stack;n=e+_(i,t)}else n=e+String(t);\"function\"==typeof c?c(n,r):\"function\"!=typeof console.log&&\"object\"!=typeof console.log||console.log(n)}}function V(t,e,r,n){var i=!1;try{\"function\"==typeof e&&(i=!0,\"rejectionHandled\"===t?e(n):e(r,n))}catch(t){h.throwLater(t)}\"unhandledRejection\"===t?j(t,r,n)||i||K(r,\"Unhandled rejection \"):j(t,n)}function Y(t){var e;if(\"function\"==typeof t)e=\"[function \"+(t.name||\"anonymous\")+\"]\";else{e=t&&\"function\"==typeof t.toString?t.toString():l.toString(t);if(/\\[object [a-zA-Z0-9$_]+\\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e=\"(empty array)\")}return\"(<\"+function(t){if(t.length<41)return t;return t.substr(0,38)+\"...\"}(e)+\">, no stack trace)\"}function G(){return\"function\"==typeof et}var X=function(){return!1},J=/[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;function Z(t){var e=t.match(J);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function tt(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);et(this,tt),e>32&&this.uncycle()}l.inherits(tt,Error),n.CapturedTrace=tt,tt.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;for(n=(t=this._length=n)-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(n=0;n0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var a=n>0?e[n-1]:this;s=0;--u)e[u]._length=c,c++;return}}}},tt.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=W(t),r=e.message,n=[e.stack],i=this;void 0!==i;)n.push(Q(i.stack.split(\"\\n\"))),i=i._parent;!function(t){for(var e=t[0],r=1;r=0;--a)if(n[a]===o){s=a;break}for(a=s;a>=0;--a){var c=n[a];if(e[i]!==c)break;e.pop(),i--}e=n}}(n),function(t){for(var e=0;e=0)return y=/@/,_=e,v=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){n=\"stack\"in t}return\"stack\"in i||!n||\"number\"!=typeof Error.stackTraceLimit?(_=function(t,e){return\"string\"==typeof t?t:\"object\"!=typeof e&&\"function\"!=typeof e||void 0===e.name||void 0===e.message?Y(e):e.toString()},null):(y=t,_=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();\"undefined\"!=typeof console&&void 0!==console.warn&&(c=function(t){console.warn(t)},l.isNode&&e.stderr.isTTY?c=function(t,e){var r=e?\"\u001b[33m\":\"\u001b[31m\";console.warn(r+t+\"\u001b[0m\\n\")}:l.isNode||\"string\"!=typeof(new Error).stack||(c=function(t,e){console.warn(\"%c\"+t,e?\"color: darkorange\":\"color: red\")}));var rt={warnings:E,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return x&&r.longStackTraces(),{asyncHooks:function(){return rt.asyncHooks},longStackTraces:function(){return rt.longStackTraces},warnings:function(){return rt.warnings},cancellation:function(){return rt.cancellation},monitoring:function(){return rt.monitoring},propagateFromFunction:function(){return $},boundValueFunction:function(){return U},checkForgottenReturns:function(t,e,r,n,i){if(void 0===t&&null!==e&&S){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&n._bitField))return;r&&(r+=\" \");var o=\"\",s=\"\";if(e._trace){for(var a=e._trace.stack.split(\"\\n\"),c=Q(a),u=c.length-1;u>=0;--u){var h=c[u];if(!b.test(h)){var f=h.match(g);f&&(o=\"at \"+f[1]+\":\"+f[2]+\":\"+f[3]+\" \");break}}if(c.length>0){var l=c[0];for(u=0;u0&&(s=\"\\n\"+a[u-1]);break}}}var d=\"a promise was created in a \"+r+\"handler \"+o+\"but was not returned from it, see http://goo.gl/rRqMUw\"+s;n._warn(d,!0,e)}},setBounds:function(t,e){if(G()){for(var r,n,i=(t.stack||\"\").split(\"\\n\"),o=(e.stack||\"\").split(\"\\n\"),s=-1,a=-1,c=0;c=a||(X=function(t){if(m.test(t))return!0;var e=Z(t);return!!(e&&e.fileName===r&&s<=e.line&&e.line<=a)})}},warn:H,deprecated:function(t,e){var r=t+\" is deprecated and will be removed in a future version.\";return e&&(r+=\" Use \"+e+\" instead.\"),H(r)},CapturedTrace:tt,fireDomEvent:k,fireGlobalEvent:T}}},{\"./errors\":12,\"./es5\":13,\"./util\":36}],10:[function(t,e,r){\"use strict\";e.exports=function(t){function e(){return this.value}function r(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(r){return r instanceof t&&r.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:r},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(r,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof t&&r.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:r},void 0);var n=arguments[1];n instanceof t&&n.suppressUnhandledRejections();return this.caught(r,function(){return n})}}},{}],11:[function(t,e,r){\"use strict\";e.exports=function(t,e){var r=t.reduce,n=t.all;function i(){return n(this)}t.prototype.each=function(t){return r(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,e,e)},t.each=function(t,n){return r(t,n,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,n){return r(t,n,e,e)}}},{}],12:[function(t,e,r){\"use strict\";var n,i,o=t(\"./es5\"),s=o.freeze,a=t(\"./util\"),c=a.inherits,u=a.notEnumerableProp;function h(t,e){function r(n){if(!(this instanceof r))return new r(n);u(this,\"message\",\"string\"==typeof n?n:e),u(this,\"name\",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return c(r,Error),r}var f=h(\"Warning\",\"warning\"),l=h(\"CancellationError\",\"cancellation error\"),d=h(\"TimeoutError\",\"timeout error\"),p=h(\"AggregateError\",\"aggregate error\");try{n=TypeError,i=RangeError}catch(t){n=h(\"TypeError\",\"type error\"),i=h(\"RangeError\",\"range error\")}for(var m=\"join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse\".split(\" \"),b=0;b1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function f(){return d.call(this,this.promise._target()._settledValue())}function l(t){if(!h(this,t))return s.e=t,s}function d(t){var i=this.promise,a=this.handler;if(!this.called){this.called=!0;var c=this.isFinallyHandler()?a.call(i._boundValue()):a.call(i._boundValue(),t);if(c===n)return c;if(void 0!==c){i._setReturnedNonUndefined();var d=r(c,i);if(d instanceof e){if(null!=this.cancelPromise){if(d._isCancelled()){var p=new o(\"late cancellation observer\");return i._attachExtraTrace(p),s.e=p,s}d.isPending()&&d._attachCancellationCallback(new u(this))}return d._then(f,l,void 0,this,void 0)}}}return i.isRejected()?(h(this),s.e=t,s):(h(this),t)}return c.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){h(this.finallyHandler)},e.prototype._passThrough=function(t,e,r,n){return\"function\"!=typeof t?this.then():this._then(r,n,void 0,new c(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,d,d)},e.prototype.tap=function(t){return this._passThrough(t,1,d)},e.prototype.tapCatch=function(t){var r=arguments.length;if(1===r)return this._passThrough(t,1,void 0,d);var n,o=new Array(r-1),s=0;for(n=0;n0&&\"function\"==typeof arguments[e]&&(t=arguments[e]);var n=[].slice.call(arguments);t&&n.pop();var i=new r(n).promise();return void 0!==t?i.spread(t):i}}},{\"./util\":36}],18:[function(t,e,r){\"use strict\";e.exports=function(e,r,n,i,o,s){var a=t(\"./util\"),c=a.tryCatch,u=a.errorObj,h=e._async;function f(t,r,n,i){this.constructor$(t),this._promise._captureStackTrace();var s=e._getContext();if(this._callback=a.contextBind(s,r),this._preservedValues=i===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],h.invoke(this._asyncInit,this,void 0),a.isArray(t))for(var c=0;c=1?s:0,o).promise()}a.inherits(f,r),f.prototype._asyncInit=function(){this._init$(void 0,-2)},f.prototype._init=function(){},f.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),a=this._preservedValues,h=this._limit;if(r<0){if(n[r=-1*r-1]=t,h>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(h>=1&&this._inFlight>=h)return n[r]=t,this._queue.push(r),!1;null!==a&&(a[r]=t);var f=this._promise,l=this._callback,d=f._boundValue();f._pushContext();var p=c(l).call(d,t,r,o),m=f._popContext();if(s.checkForgottenReturns(p,m,null!==a?\"Promise.filter\":\"Promise.map\",f),p===u)return this._reject(p.e),!0;var b=i(p,this._promise);if(b instanceof e){var g=(b=b._target())._bitField;if(0==(50397184&g))return h>=1&&this._inFlight++,n[r]=b,b._proxy(this,-1*(r+1)),!1;if(0==(33554432&g))return 0!=(16777216&g)?(this._reject(b._reason()),!0):(this._cancel(),!0);p=b._value()}n[r]=p}return++this._totalResolved>=o&&(null!==a?this._filter(n,a):this._resolve(n),!0)},f.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlight1){o.deprecated(\"calling Promise.try with more than 1 argument\");var u=arguments[1],h=arguments[2];n=s.isArray(u)?a(t).apply(h,u):a(t).call(h,u)}else n=a(t)();var f=c._popContext();return o.checkForgottenReturns(n,f,\"Promise.try\",c),c._resolveFromSyncValue(n),c},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{\"./util\":36}],20:[function(t,e,r){\"use strict\";var n=t(\"./util\"),i=n.maybeWrapAsError,o=t(\"./errors\").OperationalError,s=t(\"./es5\");var a=/^(?:name|message|stack|cause)$/;function c(t){var e;if(function(t){return t instanceof Error&&s.getPrototypeOf(t)===Error.prototype}(t)){(e=new o(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var r=s.keys(t),i=0;i1){var r,n=new Array(e-1),i=0;for(r=0;r0&&\"function\"!=typeof t&&\"function\"!=typeof e){var r=\".then() only accepts functions but was passed: \"+c.classString(t);arguments.length>1&&(r+=\", \"+c.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},N.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},N.prototype.spread=function(t){return\"function\"!=typeof t?o(\"expecting a function but got \"+c.classString(t)):this.all()._then(t,void 0,void 0,w,void 0)},N.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},N.prototype.all=function(){return arguments.length>0&&this._warn(\".all() was passed arguments but it does not take any\"),new S(this).promise()},N.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},N.getNewLibraryCopy=r.exports,N.is=function(t){return t instanceof N},N.fromNode=N.fromCallback=function(t){var e=new N(v);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=I(t)(M(e,r));return n===j&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},N.all=function(t){return new S(t).promise()},N.cast=function(t){var e=x(t);return e instanceof N||((e=new N(v))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},N.resolve=N.fulfilled=N.cast,N.reject=N.rejected=function(t){var e=new N(v);return e._captureStackTrace(),e._rejectCallback(t,!0),e},N.setScheduler=function(t){if(\"function\"!=typeof t)throw new y(\"expecting a function but got \"+c.classString(t));return b.setScheduler(t)},N.prototype._then=function(t,e,r,n,i){var o=void 0!==i,s=o?i:new N(v),a=this._target(),u=a._bitField;o||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===n&&0!=(2097152&this._bitField)&&(n=0!=(50397184&u)?this._boundValue():a===this?void 0:this._boundTo),this._fireEvent(\"promiseChained\",this,s));var h=d();if(0!=(50397184&u)){var f,l,p=a._settlePromiseCtx;0!=(33554432&u)?(l=a._rejectionHandler0,f=t):0!=(16777216&u)?(l=a._fulfillmentHandler0,f=e,a._unsetRejectionIsUnhandled()):(p=a._settlePromiseLateCancellationObserver,l=new _(\"late cancellation observer\"),a._attachExtraTrace(l),f=e),b.invoke(p,a,{handler:c.contextBind(h,f),promise:s,receiver:n,value:l})}else a._addCallbacks(t,e,s,n,h);return s},N.prototype._length=function(){return 65535&this._bitField},N.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},N.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},N.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},N.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent(\"promiseFulfilled\",this)},N.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent(\"promiseRejected\",this)},N.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent(\"promiseResolved\",this)},N.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},N.prototype._isFinal=function(){return(4194304&this._bitField)>0},N.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},N.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent(\"promiseCancelled\",this)},N.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},N.prototype._setAsyncGuaranteed=function(){if(!b.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},N.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&(536870912|this._bitField)},N.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==a)return void 0===e&&this._isBound()?this._boundValue():e},N.prototype._promiseAt=function(t){return this[4*t-4+2]},N.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},N.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},N.prototype._boundValue=function(){},N.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=a),this._addCallbacks(e,r,n,i,null)},N.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=a),this._addCallbacks(r,n,i,o,null)},N.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,\"function\"==typeof t&&(this._fulfillmentHandler0=c.contextBind(i,t)),\"function\"==typeof e&&(this._rejectionHandler0=c.contextBind(i,e));else{var s=4*o-4;this[s+2]=r,this[s+3]=n,\"function\"==typeof t&&(this[s+0]=c.contextBind(i,t)),\"function\"==typeof e&&(this[s+1]=c.contextBind(i,e))}return this._setLength(o+1),o},N.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},N.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(n(),!1);var r=x(t,this);if(!(r instanceof N))return this._fulfill(t);e&&this._propagateFrom(r,2);var i=r._target();if(i!==this){var o=i._bitField;if(0==(50397184&o)){var s=this._length();s>0&&i._migrateCallback0(this);for(var a=1;a>>16)){if(t===this){var r=n();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():b.settlePromises(this),this._dereferenceTrace())}},N.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return b.fatalError(t,c.isNode);(65535&e)>0?b.settlePromises(this):this._ensurePossibleRejectionHandled()}},N.prototype._fulfillPromises=function(t,e){for(var r=1;r0){if(0!=(16842752&t)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},N.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&p.defineProperty(N.prototype,Symbol.toStringTag,{get:function(){return\"Object\"}}),N.defer=N.pending=function(){return k.deprecated(\"Promise.defer\",\"new Promise\"),{promise:new N(v),resolve:O,reject:B}},c.notEnumerableProp(N,\"_makeSelfResolutionError\",n),t(\"./method\")(N,v,x,o,k),t(\"./bind\")(N,v,x,k),t(\"./cancel\")(N,S,o,k),t(\"./direct_resolve\")(N),t(\"./synchronous_inspection\")(N),t(\"./join\")(N,S,x,v,b),N.Promise=N,N.version=\"3.7.2\",t(\"./call_get.js\")(N),t(\"./generators.js\")(N,o,v,x,s,k),t(\"./map.js\")(N,S,o,x,v,k),t(\"./nodeify.js\")(N),t(\"./promisify.js\")(N,v),t(\"./props.js\")(N,S,x,o),t(\"./race.js\")(N,v,x,o),t(\"./reduce.js\")(N,S,o,x,v,k),t(\"./settle.js\")(N,S,k),t(\"./some.js\")(N,S,o),t(\"./timers.js\")(N,v,k),t(\"./using.js\")(N,o,x,C,v,k),t(\"./any.js\")(N),t(\"./each.js\")(N,v),t(\"./filter.js\")(N,v),c.toFastProperties(N),c.toFastProperties(N.prototype),q({a:1}),q({b:2}),q({c:3}),q(1),q(function(){}),q(void 0),q(!1),q(new N(v)),k.setBounds(m.firstLineError,c.lastLineError),N}},{\"./any.js\":1,\"./async\":2,\"./bind\":3,\"./call_get.js\":5,\"./cancel\":6,\"./catch_filter\":7,\"./context\":8,\"./debuggability\":9,\"./direct_resolve\":10,\"./each.js\":11,\"./errors\":12,\"./es5\":13,\"./filter.js\":14,\"./finally\":15,\"./generators.js\":16,\"./join\":17,\"./map.js\":18,\"./method\":19,\"./nodeback\":20,\"./nodeify.js\":21,\"./promise_array\":23,\"./promisify.js\":24,\"./props.js\":25,\"./race.js\":27,\"./reduce.js\":28,\"./settle.js\":30,\"./some.js\":31,\"./synchronous_inspection\":32,\"./thenables\":33,\"./timers.js\":34,\"./using.js\":35,\"./util\":36,async_hooks:void 0}],23:[function(t,e,r){\"use strict\";e.exports=function(e,r,n,i,o){var s=t(\"./util\");s.isArray;function a(t){var n=this._promise=new e(r);t instanceof e&&(n._propagateFrom(t,3),t.suppressUnhandledRejections()),n._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return s.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function t(r,o){var a=n(this._values,this._promise);if(a instanceof e){var c=(a=a._target())._bitField;if(this._values=a,0==(50397184&c))return this._promise._setAsyncGuaranteed(),a._then(t,this._reject,void 0,this,o);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(a._reason()):this._cancel();a=a._value()}if(null!==(a=s.asArray(a)))0!==a.length?this._iterate(a):-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(o));else{var u=i(\"expecting an array or an iterable object but got \"+s.classString(a)).reason();this._promise._rejectCallback(u,!1)}},a.prototype._iterate=function(t){var r=this.getActualLength(t.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var i=this._promise,o=!1,s=null,a=0;a=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var r=0;r=this._length){var r;if(this._isMap)r=function(t){for(var e=new o,r=t.length/2|0,n=0;n>1},e.prototype.props=function(){return f(this)},e.props=function(t){return f(t)}}},{\"./es5\":13,\"./util\":36}],26:[function(t,e,r){\"use strict\";function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(t,e){var r=new i;return r._bitField=33554432,r._settledValueField=t,this._promiseResolved(e,r)},o.prototype._promiseRejected=function(t,e){var r=new i;return r._bitField=16777216,r._settledValueField=t,this._promiseResolved(e,r)},e.settle=function(t){return n.deprecated(\".settle()\",\".reflect()\"),new o(t).promise()},e.allSettled=function(t){return new o(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{\"./util\":36}],31:[function(t,e,r){\"use strict\";e.exports=function(e,r,n){var i=t(\"./util\"),o=t(\"./errors\").RangeError,s=t(\"./errors\").AggregateError,a=i.isArray,c={};function u(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function h(t,e){if((0|e)!==e||e<0)return n(\"expecting a positive integer\\n\\n See http://goo.gl/MqrFmX\\n\");var r=new u(t),i=r.promise();return r.setHowMany(e),r.init(),i}i.inherits(u,r),u.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=a(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(t){this._howMany=t},u.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},u.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(c),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new s,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(t){this._values.push(t)},u.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(t){var e=\"Input array must contain at least \"+this._howMany+\" items but contains only \"+t+\" items\";return new o(e)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return h(t,e)},e.prototype.some=function(t){return h(this,t)},e._SomePromiseArray=u}},{\"./errors\":12,\"./util\":36}],32:[function(t,e,r){\"use strict\";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var r=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\n\\n See http://goo.gl/MqrFmX\\n\");return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\n\\n See http://goo.gl/MqrFmX\\n\");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return r.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),n.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,r){\"use strict\";e.exports=function(e,r){var n=t(\"./util\"),i=n.errorObj,o=n.isObject;var s={}.hasOwnProperty;return function(t,a){if(o(t)){if(t instanceof e)return t;var c=function(t){try{return function(t){return t.then}(t)}catch(t){return i.e=t,i}}(t);if(c===i){a&&a._pushContext();var u=e.reject(c.e);return a&&a._popContext(),u}if(\"function\"==typeof c)return function(t){try{return s.call(t,\"_promise0\")}catch(t){return!1}}(t)?(u=new e(r),t._then(u._fulfill,u._reject,void 0,u,null),u):function(t,o,s){var a=new e(r),c=a;s&&s._pushContext(),a._captureStackTrace(),s&&s._popContext();var u=!0,h=n.tryCatch(o).call(t,function(t){a&&(a._resolveCallback(t),a=null)},function(t){a&&(a._rejectCallback(t,u,!0),a=null)});return u=!1,a&&h===i&&(a._rejectCallback(h.e,!0,!0),a=null),c}(t,c,a)}return t}}},{\"./util\":36}],34:[function(t,e,r){\"use strict\";e.exports=function(e,r,n){var i=t(\"./util\"),o=e.TimeoutError;function s(t){this.handle=t}s.prototype._resultCancelled=function(){clearTimeout(this.handle)};var a=function(t){return c(+this).thenReturn(t)},c=e.delay=function(t,i){var o,c;return void 0!==i?(o=e.resolve(i)._then(a,null,null,t,void 0),n.cancellation()&&i instanceof e&&o._setOnCancel(i)):(o=new e(r),c=setTimeout(function(){o._fulfill()},+t),n.cancellation()&&o._setOnCancel(new s(c)),o._captureStackTrace()),o._setAsyncGuaranteed(),o};e.prototype.delay=function(t){return c(t,this)};function u(t){return clearTimeout(this.handle),t}function h(t){throw clearTimeout(this.handle),t}e.prototype.timeout=function(t,e){var r,a;t=+t;var c=new s(setTimeout(function(){r.isPending()&&function(t,e,r){var n;n=\"string\"!=typeof e?e instanceof Error?e:new o(\"operation timed out\"):new o(e),i.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n),null!=r&&r.cancel()}(r,e,a)},t));return n.cancellation()?(a=this.then(),(r=a._then(u,h,void 0,c,void 0))._setOnCancel(c)):r=this._then(u,h,void 0,c,void 0),r}}},{\"./util\":36}],35:[function(t,e,r){\"use strict\";e.exports=function(e,r,n,i,o,s){var a=t(\"./util\"),c=t(\"./errors\").TypeError,u=t(\"./util\").inherits,h=a.errorObj,f=a.tryCatch,l={};function d(t){setTimeout(function(){throw t},0)}function p(t,r){var i=0,s=t.length,a=new e(o);return function o(){if(i>=s)return a._fulfill();var c=function(t){var e=n(t);return e!==t&&\"function\"==typeof t._isDisposable&&\"function\"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(c instanceof e&&c._isDisposable()){try{c=n(c._getDisposer().tryDispose(r),t.promise)}catch(t){return d(t)}if(c instanceof e)return c._then(o,d,null,null,null)}o()}(),a}function m(t,e,r){this._data=t,this._promise=e,this._context=r}function b(t,e,r){this.constructor$(t,e,r)}function g(t){return m.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function y(t){this.length=t,this.promise=null,this[t-1]=null}m.prototype.data=function(){return this._data},m.prototype.promise=function(){return this._promise},m.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():l},m.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=e!==l?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},m.isDisposer=function(t){return null!=t&&\"function\"==typeof t.resource&&\"function\"==typeof t.tryDispose},u(b,m),b.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},y.prototype._resultCancelled=function(){for(var t=this.length,r=0;r0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if(\"function\"==typeof t)return new b(t,this,i());throw new c}}},{\"./errors\":12,\"./util\":36}],36:[function(t,n,i){\"use strict\";var o=t(\"./es5\"),s=\"undefined\"==typeof navigator,a={e:{}},c,u=\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==r?r:void 0!==this?this:null;function h(){try{var t=c;return c=null,t.apply(this,arguments)}catch(t){return a.e=t,a}}function f(t){return c=t,h}var l=function(t,e){var r={}.hasOwnProperty;function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&\"$\"!==n.charAt(n.length-1)&&(this[n+\"$\"]=e.prototype[n])}return n.prototype=e.prototype,t.prototype=new n,t.prototype};function d(t){return null==t||!0===t||!1===t||\"string\"==typeof t||\"number\"==typeof t}function p(t){return\"function\"==typeof t||\"object\"==typeof t&&null!==t}function m(t){return d(t)?new Error(k(t)):t}function b(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r1,n=e.length>0&&!(1===e.length&&\"constructor\"===e[0]),i=w.test(t+\"\")&&o.names(t).length>0;if(r||n||i)return!0}return!1}catch(t){return!1}}function x(t){function e(){}e.prototype=t;var r=new e;function n(){return typeof r.foo}return n(),n(),t}var S=/^[a-z$_][a-z$_0-9]*$/i;function A(t){return S.test(t)}function C(t,e,r){for(var n=new Array(t),i=0;i10||H[0]>0),z.nodeSupportsAsyncResource=z.isNode&&function(){var e=!1;try{e=\"function\"==typeof t(\"async_hooks\").AsyncResource.prototype.runInAsyncScope}catch(t){e=!1}return e}(),z.isNode&&z.toFastProperties(e);try{throw new Error}catch(t){z.lastLineError=t}n.exports=z},{\"./es5\":13,async_hooks:void 0}]},{},[4])(4)},t.exports=i(),\"undefined\"!=typeof window&&null!==window?window.P=window.Promise:\"undefined\"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,r(5),r(8),r(64).setImmediate)},function(t,e){var r;r=function(){return this}();try{r=r||new Function(\"return this\")()}catch(t){\"object\"==typeof window&&(r=window)}t.exports=r},function(t,e){function r(t,e){if(!t)throw new Error(e||\"Assertion failed\")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||\"Assertion failed: \"+t+\" != \"+e)}},function(t,e,r){(function(n){function i(){var t;try{t=e.storage.debug}catch(t){}return!t&&void 0!==n&&\"env\"in n&&(t=n.env.DEBUG),t}(e=t.exports=r(124)).log=function(){return\"object\"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var r=this.useColors;if(t[0]=(r?\"%c\":\"\")+this.namespace+(r?\" %c\":\" \")+t[0]+(r?\"%c \":\" \")+\"+\"+e.humanize(this.diff),!r)return;var n=\"color: \"+this.color;t.splice(1,0,n,\"color: inherit\");var i=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(t){\"%%\"!==t&&(i++,\"%c\"===t&&(o=i))}),t.splice(o,0,n)},e.save=function(t){try{null==t?e.storage.removeItem(\"debug\"):e.storage.debug=t}catch(t){}},e.load=i,e.useColors=function(){if(\"undefined\"!=typeof window&&window.process&&\"renderer\"===window.process.type)return!0;return\"undefined\"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||\"undefined\"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||\"undefined\"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||\"undefined\"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)},e.storage=\"undefined\"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=[\"lightseagreen\",\"forestgreen\",\"goldenrod\",\"dodgerblue\",\"darkorchid\",\"crimson\"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return\"[UnexpectedJSONParseError]: \"+t.message}},e.enable(i())}).call(this,r(5))},function(t,e,r){const{isFunction:n,isUndefined:i,isPlainObject:o,isArray:s,isTypedArray:a}=r(1),{CLIENT_ALIASES:c}=r(42);function u(t){let e=!1;if(a(t))return!1;if(t&&n(t.toSQL))return e;if(s(t))for(let r=0;r{e||(e=u(t[r]))}):e=i(t);return e}t.exports={addQueryContext:function(t){t.prototype.queryContext=function(t){return i(t)?this._queryContext:(this._queryContext=t,this)}},containsUndefined:u,normalizeArr:function(){const t=new Array(arguments.length);for(let e=0;e{u(t)&&e.push(r)}):o(t)?Object.keys(t).forEach(r=>{u(t[r])&&e.push(r)}):e.push(0),e}}},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return\"function\"==typeof t}function i(t){return\"object\"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(\"number\"!=typeof t||t<0||isNaN(t))throw TypeError(\"n must be a positive number\");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,s,a,c,u;if(this._events||(this._events={}),\"error\"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var h=new Error('Uncaught, unspecified \"error\" event. ('+e+\")\");throw h.context=e,h}if(o(r=this._events[t]))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(u=r.slice()).length,c=0;c0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[t].length),\"function\"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!n(e))throw TypeError(\"listener must be a function\");var r=!1;function i(){this.removeListener(t,i),r||(r=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},r.prototype.removeListener=function(t,e){var r,o,s,a;if(!n(e))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[t])return this;if(s=(r=this._events[t]).length,o=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit(\"removeListener\",t,e);else if(i(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(o,1),this._events.removeListener&&this.emit(\"removeListener\",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)\"removeListener\"!==e&&this.removeAllListeners(e);return this.removeAllListeners(\"removeListener\"),this._events={},this}if(n(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){\"use strict\";var n=r(9),i=r(0);function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?\"0\"+t:t}function a(t){return 7===t.length?\"0\"+t:6===t.length?\"00\"+t:5===t.length?\"000\"+t:4===t.length?\"0000\"+t:3===t.length?\"00000\"+t:2===t.length?\"000000\"+t:1===t.length?\"0000000\"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(\"string\"==typeof t)if(e){if(\"hex\"===e)for((t=t.replace(/[^a-z0-9]+/gi,\"\")).length%2!=0&&(t=\"0\"+t),n=0;n>8,s=255&i;o?r.push(o,s):r.push(s)}else for(n=0;n>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var c=0,u=e;return c+=(u=u+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,c,u){var h=0,f=e;return h+=(f=f+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,c,u){return e+n+o+a+u>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){const n=r(0),i=r(11),{EventEmitter:o}=r(12),s=r(10),{assign:a,reduce:c,isPlainObject:u,isObject:h,isUndefined:f,isNumber:l}=r(1),d=r(43),p=r(61),m=s(\"knex:bindings\");function b(t){this.client=t,this.sql=\"\",this.bindings=[],this._wrappedBefore=void 0,this._wrappedAfter=void 0,t&&t.config&&(this._debug=t.config.debug,d(this,4))}n(b,o),a(b.prototype,{set(t,e){return this.sql=t,this.bindings=h(e)&&!e.toSQL||f(e)?e:[e],this},timeout(t,{cancel:e}={}){return l(t)&&t>0&&(this._timeout=t,e&&(this.client.assertCanCancelQuery(),this._cancelOnTimeout=!0)),this},wrap(t,e){return this._wrappedBefore=t,this._wrappedAfter=e,this},toString(){return this.toQuery()},toSQL(t,e){let r;const n=this.client.formatter(this);if(r=Array.isArray(this.bindings)?function(t,e){const r=t.bindings.length,n=t.bindings;let i=0;const o=t.sql.replace(/\\\\?\\?\\??/g,function(t){if(\"\\\\?\"===t)return t;const r=n[i++];return\"??\"===t?e.columnize(r):e.parameter(r)});if(r!==i)throw new Error(`Expected ${r} bindings, saw ${i}`);return{method:\"raw\",sql:o,bindings:e.bindings}}(this,n):this.bindings&&u(this.bindings)?function(t,e){const r=t.bindings;return{method:\"raw\",sql:t.sql.replace(/\\\\?(:(\\w+):(?=::)|:(\\w+):(?!:)|:(\\w+))/g,function(t,n,i,o,s){if(t!==n)return n;const a=i||o||s,c=t.trim(),u=\":\"===c[c.length-1],h=r[a];return void 0===h?(Object.prototype.hasOwnProperty.call(r,a)&&e.bindings.push(h),t):u?t.replace(n,e.columnize(h)):t.replace(n,e.parameter(h))}),bindings:e.bindings}}(this,n):{method:\"raw\",sql:this.sql,bindings:f(this.bindings)?[]:[this.bindings]},this._wrappedBefore&&(r.sql=this._wrappedBefore+r.sql),this._wrappedAfter&&(r.sql=r.sql+this._wrappedAfter),r.options=c(this._options,a,{}),this._timeout&&(r.timeout=this._timeout,this._cancelOnTimeout&&(r.cancelOnTimeout=this._cancelOnTimeout)),r.bindings=r.bindings||[],i.containsUndefined(r.bindings)){const t=i.getUndefinedIndices(this.bindings);throw m(r.bindings),new Error(`Undefined binding(s) detected for keys [${t}] when compiling RAW query: ${r.sql}`)}return r.__knexQueryUid=p.v1(),r}}),r(44)(b),i.addQueryContext(b),t.exports=b},function(t,e,r){(function(t,n){var i=/%[sdj%]/g;e.format=function(t){if(!g(t)){for(var e=[],r=0;r=o)return t;switch(t){case\"%s\":return String(n[r++]);case\"%d\":return Number(n[r++]);case\"%j\":try{return JSON.stringify(n[r++])}catch(t){return\"[Circular]\"}default:return t}}),c=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(r)?n.showHidden=r:r&&e._extend(n,r),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),h(n,t,n.depth)}function c(t,e){var r=a.styles[e];return r?\"\u001b[\"+a.colors[r][0]+\"m\"+t+\"\u001b[\"+a.colors[r][1]+\"m\":t}function u(t,e){return t}function h(t,r,n){if(t.customInspect&&r&&x(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return g(i)||(i=h(t,i,n)),i}var o=function(t,e){if(y(e))return t.stylize(\"undefined\",\"undefined\");if(g(e)){var r=\"'\"+JSON.stringify(e).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return t.stylize(r,\"string\")}if(b(e))return t.stylize(\"\"+e,\"number\");if(p(e))return t.stylize(\"\"+e,\"boolean\");if(m(e))return t.stylize(\"null\",\"null\")}(t,r);if(o)return o;var s=Object.keys(r),a=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),E(r)&&(s.indexOf(\"message\")>=0||s.indexOf(\"description\")>=0))return f(r);if(0===s.length){if(x(r)){var c=r.name?\": \"+r.name:\"\";return t.stylize(\"[Function\"+c+\"]\",\"special\")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),\"regexp\");if(w(r))return t.stylize(Date.prototype.toString.call(r),\"date\");if(E(r))return f(r)}var u,v=\"\",S=!1,A=[\"{\",\"}\"];(d(r)&&(S=!0,A=[\"[\",\"]\"]),x(r))&&(v=\" [Function\"+(r.name?\": \"+r.name:\"\")+\"]\");return _(r)&&(v=\" \"+RegExp.prototype.toString.call(r)),w(r)&&(v=\" \"+Date.prototype.toUTCString.call(r)),E(r)&&(v=\" \"+f(r)),0!==s.length||S&&0!=r.length?n<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),\"regexp\"):t.stylize(\"[Object]\",\"special\"):(t.seen.push(r),u=S?function(t,e,r,n,i){for(var o=[],s=0,a=e.length;s=0&&0,t+e.replace(/\\u001b\\[\\d\\d?m/g,\"\").length+1},0)>60)return r[0]+(\"\"===e?\"\":e+\"\\n \")+\" \"+t.join(\",\\n \")+\" \"+r[1];return r[0]+e+\" \"+t.join(\", \")+\" \"+r[1]}(u,v,A)):A[0]+v+A[1]}function f(t){return\"[\"+Error.prototype.toString.call(t)+\"]\"}function l(t,e,r,n,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=c.set?t.stylize(\"[Getter/Setter]\",\"special\"):t.stylize(\"[Getter]\",\"special\"):c.set&&(a=t.stylize(\"[Setter]\",\"special\")),k(n,i)||(s=\"[\"+i+\"]\"),a||(t.seen.indexOf(c.value)<0?(a=m(r)?h(t,c.value,null):h(t,c.value,r-1)).indexOf(\"\\n\")>-1&&(a=o?a.split(\"\\n\").map(function(t){return\" \"+t}).join(\"\\n\").substr(2):\"\\n\"+a.split(\"\\n\").map(function(t){return\" \"+t}).join(\"\\n\")):a=t.stylize(\"[Circular]\",\"special\")),y(s)){if(o&&i.match(/^\\d+$/))return a;(s=JSON.stringify(\"\"+i)).match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,\"name\")):(s=s.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),s=t.stylize(s,\"string\"))}return s+\": \"+a}function d(t){return Array.isArray(t)}function p(t){return\"boolean\"==typeof t}function m(t){return null===t}function b(t){return\"number\"==typeof t}function g(t){return\"string\"==typeof t}function y(t){return void 0===t}function _(t){return v(t)&&\"[object RegExp]\"===S(t)}function v(t){return\"object\"==typeof t&&null!==t}function w(t){return v(t)&&\"[object Date]\"===S(t)}function E(t){return v(t)&&(\"[object Error]\"===S(t)||t instanceof Error)}function x(t){return\"function\"==typeof t}function S(t){return Object.prototype.toString.call(t)}function A(t){return t<10?\"0\"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(y(o)&&(o=n.env.NODE_DEBUG||\"\"),t=t.toUpperCase(),!s[t])if(new RegExp(\"\\\\b\"+t+\"\\\\b\",\"i\").test(o)){var r=n.pid;s[t]=function(){var n=e.format.apply(e,arguments);console.error(\"%s %d: %s\",t,r,n)}}else s[t]=function(){};return s[t]},e.inspect=a,a.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]},a.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=g,e.isSymbol=function(t){return\"symbol\"==typeof t},e.isUndefined=y,e.isRegExp=_,e.isObject=v,e.isDate=w,e.isError=E,e.isFunction=x,e.isPrimitive=function(t){return null===t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||\"symbol\"==typeof t||void 0===t},e.isBuffer=r(142);var C=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;console.log(\"%s - %s\",(t=new Date,r=[A(t.getHours()),A(t.getMinutes()),A(t.getSeconds())].join(\":\"),[t.getDate(),C[t.getMonth()],r].join(\" \")),e.format.apply(e,arguments))},e.inherits=r(0),e._extend=function(t,e){if(!e||!v(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,r(8),r(5))},function(t,e,r){var n=r(2).Buffer,i=r(27).Transform,o=r(47).StringDecoder;function s(t){i.call(this),this.hashMode=\"string\"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(0)(s,i),s.prototype.update=function(t,e,r){\"string\"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error(\"trying to get auth tag in unsupported state\")},s.prototype.setAuthTag=function(){throw new Error(\"trying to set auth tag in unsupported state\")},s.prototype.setAAD=function(){throw new Error(\"trying to set aad in unsupported state\")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error(\"can't switch encodings\");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},function(t,e,r){\"use strict\";var n=r(35),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var o=Object.create(r(28));o.inherits=r(0);var s=r(65),a=r(46);o.inherits(f,s);for(var c=i(a.prototype),u=0;u{this.initRejectFn=r,e=(e=>{t(e)})})),this.client=t,this.logger=t.logger,this.outerTx=i,this.trxClient=void 0,this._debug=t.config&&t.config.debug,a(\"%s: Starting %s transaction\",o,i?\"nested\":\"top level\"),this._promise=this.acquireConnection(r,r=>{const i=this.trxClient=function(t,e,r){const i=Object.create(e.constructor.prototype);i.version=e.version,i.config=e.config,i.driver=e.driver,i.connectionSettings=e.connectionSettings,i.transacting=!0,i.valueForUndefined=e.valueForUndefined,i.logger=e.logger,i.on(\"query\",function(r){t.emit(\"query\",r),e.emit(\"query\",r)}),i.on(\"query-error\",function(r,n){t.emit(\"query-error\",r,n),e.emit(\"query-error\",r,n)}),i.on(\"query-response\",function(r,n,i){t.emit(\"query-response\",r,n,i),e.emit(\"query-response\",r,n,i)});const o=i.query;i.query=function(e,s){const a=t.isCompleted();return new n(function(n,c){try{if(e!==r)throw new Error(\"Invalid connection for transaction query.\");a&&f(t,s),n(o.call(i,e,s))}catch(t){c(t)}})};const s=i.stream;return i.stream=function(e,o,a,c){const u=t.isCompleted();return new n(function(n,h){try{if(e!==r)throw new Error(\"Invalid connection for transaction query.\");u&&f(t,o),n(s.call(i,e,o,a,c))}catch(t){h(t)}})},i.acquireConnection=function(){return n.resolve(r)},i.releaseConnection=function(){return n.resolve()},i}(this,t,r),o=t.transacting?this.savepoint(r):this.begin(r),a=new n((t,e)=>{this._resolver=t,this._rejecter=e});return o.then(()=>(function(t,e,r){const n=s(r);n.withUserParams=(()=>{throw new Error(\"Cannot set user params on a transaction - it can only inherit params from main knex instance\")}),n.isTransaction=!0,n.userParams=t.userParams||{},n.transaction=function(e,n){return n?u(n.doNotRejectOnRollback)&&(n.doNotRejectOnRollback=!0):n={doNotRejectOnRollback:!0},e?r.transaction(e,n,t):new Promise((e,i)=>{r.transaction(t=>{e(t)},n,t)})},n.savepoint=function(t,e){return n.transaction(t,e)},t.client.transacting?(n.commit=(r=>t.release(e,r)),n.rollback=(r=>t.rollbackTo(e,r))):(n.commit=(r=>t.commit(e,r)),n.rollback=(r=>t.rollback(e,r)));return n.isCompleted=(()=>t.isCompleted()),n})(this,r,i)).then(t=>{let r;this.initPromise?t.executionPromise=a.catch(t=>{throw t}):t.executionPromise=a;try{r=e(t)}catch(t){r=n.reject(t)}return r&&r.then&&\"function\"==typeof r.then&&r.then(e=>t.commit(e)).catch(e=>t.rollback(e)),null}).catch(t=>this._rejecter(t)),a}).catch(t=>{if(!this.initRejectFn)throw t;this.initRejectFn(t)}),this._completed=!1,this._previousSibling=n.resolve(!0),i&&(i._lastChild&&(this._previousSibling=i._lastChild),i._lastChild=this._promise)}isCompleted(){return this._completed||this.outerTx&&this.outerTx.isCompleted()||!1}begin(t){return this.query(t,\"BEGIN;\")}savepoint(t){return this.query(t,`SAVEPOINT ${this.txid};`)}commit(t,e){return this.query(t,\"COMMIT;\",1,e)}release(t,e){return this.query(t,`RELEASE SAVEPOINT ${this.txid};`,1,e)}rollback(t,e){return this.query(t,\"ROLLBACK\",2,e).timeout(5e3).catch(n.TimeoutError,()=>{this._rejecter(e)})}rollbackTo(t,e){return this.query(t,`ROLLBACK TO SAVEPOINT ${this.txid}`,2,e).timeout(5e3).catch(n.TimeoutError,()=>{this._rejecter(e)})}query(t,e,r,n){const i=this.trxClient.query(t,e).catch(t=>{r=2,n=t,this._completed=!0,a(\"%s error running transaction query\",this.txid)}).then(t=>{if(1===r&&this._resolver(n),2===r){if(u(n)){if(this.doNotRejectOnRollback&&/^ROLLBACK\\b/i.test(e))return void this._resolver();n=new Error(`Transaction rejected with non-error: ${n}`)}this._rejecter(n)}return t});return 1!==r&&2!==r||(this._completed=!0),i}debug(t){return this._debug=!arguments.length||t,this}acquireConnection(t,e){const r=t&&t.connection;return new n((t,e)=>{try{t(r||this.client.acquireConnection())}catch(t){e(t)}}).then(t=>(t.__knexTxId=this.txid,(this._previousSibling?this._previousSibling.catch(()=>{}):Promise.resolve()).then(function(){return t}))).then(async t=>{try{return await e(t)}finally{r?a(\"%s: not releasing external connection\",this.txid):(a(\"%s: releasing connection\",this.txid),this.client.releaseConnection(t))}})}}function f(t,e){const r=\"string\"==typeof e?e:e&&e.sql;throw a(\"%s: Transaction completed: %s\",t.txid,r),new Error(\"Transaction query already complete, run with DEBUG=knex:tx for more info\")}[\"then\",\"bind\",\"catch\",\"finally\",\"asCallback\",\"spread\",\"map\",\"reduce\",\"thenReturn\",\"return\",\"yield\",\"ensure\",\"exec\",\"reflect\",\"get\",\"mapSeries\",\"delay\"].forEach(function(t){h.prototype[t]=function(){return this._promise[t].apply(this._promise,arguments)}}),t.exports=h},function(t,e,r){const n=r(11),i=r(14),o=r(36),s=r(71),a=r(10),{assign:c,bind:u,compact:h,groupBy:f,isEmpty:l,isString:d,isUndefined:p,map:m,omitBy:b,reduce:g,has:y}=r(1),_=r(61),v=a(\"knex:bindings\");function w(t,e){this.client=t,this.method=e._method||\"select\",this.options=e._options,this.single=e._single,this.timeout=e._timeout||!1,this.cancelOnTimeout=e._cancelOnTimeout||!1,this.grouped=f(e._statements,\"grouping\"),this.formatter=t.formatter(e)}const E=[\"columns\",\"join\",\"where\",\"union\",\"group\",\"having\",\"order\",\"limit\",\"offset\",\"lock\",\"waitMode\"];c(w.prototype,{_emptyInsertValue:\"default values\",toSQL(t,e){this._undefinedInWhereClause=!1,this.undefinedBindingsInfo=[];const r=this[t=t||this.method]()||\"\",n={method:t,options:g(this.options,c,{}),timeout:this.timeout,cancelOnTimeout:this.cancelOnTimeout,bindings:this.formatter.bindings||[],__knexQueryUid:_.v1()};if(Object.defineProperties(n,{toNative:{value:()=>({sql:this.client.positionBindings(n.sql),bindings:this.client.prepBindings(n.bindings)}),enumerable:!1}}),d(r)?n.sql=r:c(n,r),\"select\"!==t&&\"first\"!==t||this.single.as&&(n.as=this.single.as),this._undefinedInWhereClause)throw v(n.bindings),new Error(\"Undefined binding(s) detected when compiling \"+`${t.toUpperCase()}. Undefined column(s): [${this.undefinedBindingsInfo.join(\", \")}] query: ${n.sql}`);return n},select(){let t=this.with();const e=E.map(t=>this[t](this));return t+=h(e).join(\" \")},pluck(){let t=this.single.pluck;return-1!==t.indexOf(\".\")&&(t=t.split(\".\").slice(-1)[0]),{sql:this.select(),pluck:t}},insert(){const t=this.single.insert||[];let e=this.with()+`insert into ${this.tableName} `;if(Array.isArray(t)){if(0===t.length)return\"\"}else if(\"object\"==typeof t&&l(t))return e+this._emptyInsertValue;const r=this._prepInsert(t);if(\"string\"==typeof r)e+=r;else if(r.columns.length){e+=`(${this.formatter.columnize(r.columns)}`,e+=\") values (\";let t=-1;for(;++t0&&n.push(this.formatter.columnize(i.value))}return 0===n.length&&(n=[\"*\"]),`select ${t}`+n.join(\", \")+(this.tableName?` from ${this.single.only?\"only \":\"\"}${this.tableName}`:\"\")},_aggregate(t,{aliasSeparator:e=\" as \",distinctParentheses:r}={}){const n=t.value,i=t.method,o=t.aggregateDistinct?\"distinct \":\"\",s=t=>this.formatter.wrap(t),a=(t,r)=>r?t+e+s(r):t,c=(t,e)=>{let n=t.map(s).join(\", \");if(o){const t=r?\"(\":\" \",e=r?\")\":\"\";n=o.trim()+t+n+e}return a(`${i}(${n})`,e)},u=(t,e)=>{const r=`${i}(${o+s(t)})`;return a(r,e)};if(Array.isArray(n))return[c(n)];if(\"object\"==typeof n){if(t.alias)throw new Error(\"When using an object explicit alias can not be used\");return Object.entries(n).map(([t,e])=>Array.isArray(e)?c(e,t):u(e,t))}const h=n.toLowerCase().indexOf(\" as \");let f=n,{alias:l}=t;if(-1!==h){if(f=n.slice(0,h),l)throw new Error(`Found multiple aliases for same column: ${f}`);l=n.slice(h+4)}return[u(f,l)]},aggregate(t){return this._aggregate(t)},aggregateRaw(t){const e=t.aggregateDistinct?\"distinct \":\"\";return`${t.method}(${e+this.formatter.unwrapRaw(t.value)})`},join(){let t=\"\",e=-1;const r=this.grouped.join;if(!r)return\"\";for(;++e0&&(t+=\" \"),\"raw\"===n.joinType)t+=this.formatter.unwrapRaw(n.table);else{t+=n.joinType+\" join \"+this.formatter.wrap(i);let e=-1;for(;++e0?` ${r.bool} `:` ${\"onUsing\"===r.type?\"using\":\"on\"} `;const i=this[r.type].call(this,r);i&&(t+=i)}}}return t},onBetween(t){return this.formatter.wrap(t.column)+\" \"+this._not(t,\"between\")+\" \"+m(t.value,u(this.formatter.parameter,this.formatter)).join(\" and \")},onNull(t){return this.formatter.wrap(t.column)+\" is \"+this._not(t,\"null\")},onExists(t){return this._not(t,\"exists\")+\" (\"+this.formatter.rawOrFn(t.value)+\")\"},onIn(t){return Array.isArray(t.column)?this.multiOnIn(t):this.formatter.wrap(t.column)+\" \"+this._not(t,\"in \")+this.wrap(this.formatter.parameterize(t.value))},multiOnIn(t){let e=-1,r=`(${this.formatter.columnize(t.column)}) `;for(r+=this._not(t,\"in \")+\"((\";++e1?e.join(\" \"):\"\"},group(){return this._groupsOrders(\"group\")},order(){return this._groupsOrders(\"order\")},having(){const t=this.grouped.having;if(!t)return\"\";const e=[\"having\"];for(let r=0,n=t.length;r1||1===e.length&&\"having\"!==e[0])&&e.push(n.bool),e.push(i))}return e.length>1?e.join(\" \"):\"\"},havingRaw(t){return this._not(t,\"\")+this.formatter.unwrapRaw(t.value)},havingWrapped(t){const e=this.formatter.rawOrFn(t.value,\"where\");return e&&this._not(t,\"\")+\"(\"+e.slice(6)+\")\"||\"\"},havingBasic(t){return this._not(t,\"\")+this.formatter.wrap(t.column)+\" \"+this.formatter.operator(t.operator)+\" \"+this.formatter.parameter(t.value)},havingNull(t){return this.formatter.wrap(t.column)+\" is \"+this._not(t,\"null\")},havingExists(t){return this._not(t,\"exists\")+\" (\"+this.formatter.rawOrFn(t.value)+\")\"},havingBetween(t){return this.formatter.wrap(t.column)+\" \"+this._not(t,\"between\")+\" \"+m(t.value,u(this.formatter.parameter,this.formatter)).join(\" and \")},havingIn(t){return Array.isArray(t.column)?this.multiHavingIn(t):this.formatter.wrap(t.column)+\" \"+this._not(t,\"in \")+this.wrap(this.formatter.parameterize(t.value))},multiHavingIn(t){let e=-1,r=`(${this.formatter.columnize(t.column)}) `;for(r+=this._not(t,\"in \")+\"((\";++e0&&(r+=\" \"),(n>0||!t)&&(r+=i.clause+\" \");const o=this.formatter.rawOrFn(i.value);o&&(i.wrap&&(r+=\"(\"),r+=o,i.wrap&&(r+=\")\"))}return r},onlyUnions(){return!this.grouped.columns&&this.grouped.union&&!this.tableName},limit(){return!this.single.limit&&0!==this.single.limit?\"\":`limit ${this.formatter.parameter(this.single.limit)}`},offset(){return this.single.offset?`offset ${this.formatter.parameter(this.single.offset)}`:\"\"},del(){const{tableName:t}=this,e=this.with(),r=this.where();return e+`delete from ${this.single.only?\"only \":\"\"}${t}`+(r?` ${r}`:\"\")},truncate(){return`truncate ${this.tableName}`},lock(){if(this.single.lock)return this[this.single.lock]()},waitMode(){if(this.single.waitMode)return this[this.single.waitMode]()},skipLocked(){throw new Error(\".skipLocked() is currently only supported on MySQL 8.0+ and PostgreSQL 9.5+\")},noWait(){throw new Error(\".noWait() is currently only supported on MySQL 8.0+, MariaDB 10.3.0+ and PostgreSQL 9.5+\")},distinctOn(t){throw new Error(\".distinctOn() is currently only supported on PostgreSQL\")},onWrapped(t){const e=this,r=new s;t.value.call(r,r);let n=\"\";return r.clauses.forEach(function(t,r){r>0&&(n+=` ${t.bool} `);const i=e[t.type](t);i&&(n+=i)}),n.length?`(${n})`:\"\"},onBasic(t){return this.formatter.wrap(t.column)+\" \"+this.formatter.operator(t.operator)+\" \"+this.formatter.wrap(t.value)},onVal(t){return this.formatter.wrap(t.column)+\" \"+this.formatter.operator(t.operator)+\" \"+this.formatter.parameter(t.value)},onRaw(t){return this.formatter.unwrapRaw(t.value)},onUsing(t){return\"(\"+this.formatter.columnize(t.column)+\")\"},whereIn(t){let e=null;e=Array.isArray(t.column)?`(${this.formatter.columnize(t.column)})`:this.formatter.wrap(t.column);const r=this.formatter.values(t.value);return`${e} ${this._not(t,\"in \")}${r}`},whereNull(t){return this.formatter.wrap(t.column)+\" is \"+this._not(t,\"null\")},whereBasic(t){return this._not(t,\"\")+this.formatter.wrap(t.column)+\" \"+this.formatter.operator(t.operator)+\" \"+(t.asColumn?this.formatter.wrap(t.value):this.formatter.parameter(t.value))},whereExists(t){return this._not(t,\"exists\")+\" (\"+this.formatter.rawOrFn(t.value)+\")\"},whereWrapped(t){const e=this.formatter.rawOrFn(t.value,\"where\");return e&&this._not(t,\"\")+\"(\"+e.slice(6)+\")\"||\"\"},whereBetween(t){return this.formatter.wrap(t.column)+\" \"+this._not(t,\"between\")+\" \"+m(t.value,u(this.formatter.parameter,this.formatter)).join(\" and \")},whereRaw(t){return this._not(t,\"\")+this.formatter.unwrapRaw(t.value)},wrap:t=>\"(\"!==t.charAt(0)?`(${t})`:t,with(){if(!this.grouped.with||!this.grouped.with.length)return\"\";const t=this.grouped.with;if(!t)return;const e=[];let r=-1,n=!1;for(;++rt.not?`not ${e}`:e,_prepInsert(t){const e=this.formatter.rawOrFn(t);if(e)return e;let r=[];const n=[];Array.isArray(t)||(t=t?[t]:[]);let i=-1;for(;++i{return this._formatGroupsItemValue(e.value)+(\"order\"===t&&\"orderByRaw\"!==e.type?` ${r.direction(e.direction)}`:\"\")});return n.length?t+\" by \"+n.join(\", \"):\"\"}}),w.prototype.first=w.prototype.select,Object.defineProperty(w.prototype,\"tableName\",{get(){if(!this._tableName){let t=this.single.table;const e=this.single.schema;t&&e&&(t=`${e}.${t}`),this._tableName=t?this.formatter.wrap(t,t instanceof o):\"\"}return this._tableName}}),t.exports=w},function(t,e,r){function n(t){this.columnName=t}n.prototype.toString=function(){return`[object ReturningHelper:${this.columnName}]`},t.exports={generateCombinedName:function(t,e,n,i){const o=r(184);Array.isArray(i)||(i=i?[i]:[]);const s=n.replace(/\\.|-/g,\"_\"),a=i.join(\"_\");let c=`${s}_${a.length?a+\"_\":\"\"}${e}`.toLowerCase();return c.length>30&&(t.warn(`Automatically generated name \"${c}\" exceeds 30 character `+\"limit for Oracle. Using base64 encoded sha1 of that name instead.\"),c=o.createHash(\"sha1\").update(c).digest(\"base64\").replace(\"=\",\"\")),c},isConnectionError:function(t){return[\"ORA-03114\",\"ORA-03113\",\"ORA-03135\",\"ORA-12514\",\"ORA-00022\",\"ORA-00028\",\"ORA-00031\",\"ORA-00045\",\"ORA-00378\",\"ORA-00602\",\"ORA-00603\",\"ORA-00609\",\"ORA-01012\",\"ORA-01041\",\"ORA-01043\",\"ORA-01089\",\"ORA-01092\",\"ORA-02396\",\"ORA-03122\",\"ORA-12153\",\"ORA-12537\",\"ORA-12547\",\"ORA-12570\",\"ORA-12583\",\"ORA-27146\",\"ORA-28511\",\"ORA-56600\",\"NJS-040\",\"NJS-024\",\"NJS-003\"].some(function(e){return 0===t.message.indexOf(e)})},wrapSqlWithCatch:function(t,e){return`begin execute immediate '${t.replace(/'/g,\"''\")}'; `+`exception when others then if sqlcode != ${e} then raise; `+\"end if; end;\"},ReturningHelper:n}},function(t,e,r){const n=r(7),i=r(14),o=r(129),s=r(130),a=r(29),c=r(18),u=r(36),h=r(19),f=r(147),l=r(22),d=r(148),p=r(23),m=r(49),b=r(24),{Pool:g,TimeoutError:y}=r(149),_=r(0),{EventEmitter:v}=r(12),{promisify:w}=r(15),{makeEscape:E}=r(37),{uniqueId:x,cloneDeep:S,defaults:A}=r(1),C=r(154),k=r(10)(\"knex:client\"),T=r(10)(\"knex:query\"),R=r(10)(\"knex:bindings\"),M=(t,e)=>T(t.replace(/%/g,\"%%\"),e),{POOL_CONFIG_OPTIONS:j}=r(42);function I(t={}){if(this.config=t,this.logger=new C(t),this.dialect&&!this.config.client&&this.logger.warn(\"Using 'this.dialect' to identify the client is deprecated and support for it will be removed in the future. Please use configuration option 'client' instead.\"),!(this.config.client||this.dialect))throw new Error(\"knex: Required configuration option 'client' is missing.\");t.version&&(this.version=t.version),t.connection&&t.connection instanceof Function?(this.connectionConfigProvider=t.connection,this.connectionConfigExpirationChecker=(()=>!0)):(this.connectionSettings=S(t.connection||{}),this.connectionConfigExpirationChecker=null),this.driverName&&t.connection&&(this.initializeDriver(),(!t.pool||t.pool&&0!==t.pool.max)&&this.initializePool(t)),this.valueForUndefined=this.raw(\"DEFAULT\"),t.useNullAsDefault&&(this.valueForUndefined=null)}_(I,v),Object.assign(I.prototype,{formatter(t){return new a(this,t)},queryBuilder(){return new u(this)},queryCompiler(t){return new h(this,t)},schemaBuilder(){return new f(this)},schemaCompiler(t){return new l(this,t)},tableBuilder(t,e,r){return new d(this,t,e,r)},tableCompiler(t){return new p(this,t)},columnBuilder(t,e,r){return new m(this,t,e,r)},columnCompiler(t,e){return new b(this,t,e)},runner(t){return new s(this,t)},transaction(t,e,r){return new c(this,t,e,r)},raw(){return new i(this).set(...arguments)},ref(){return new o(this,...arguments)},_formatQuery(t,e,r){e=null==e?[]:[].concat(e);let n=0;return t.replace(/\\\\?\\?/g,t=>{if(\"\\\\?\"===t)return\"?\";if(n===e.length)return t;const i=e[n++];return this._escapeBinding(i,{timeZone:r})})},_escapeBinding:E({escapeString:t=>`'${t.replace(/'/g,\"''\")}'`}),query(t,e){\"string\"==typeof e&&(e={sql:e}),e.bindings=this.prepBindings(e.bindings);const{__knexUid:r,__knexTxId:n}=t;return this.emit(\"query\",Object.assign({__knexUid:r,__knexTxId:n},e)),M(e.sql,n),R(e.bindings,n),e.sql=this.positionBindings(e.sql),this._query(t,e).catch(t=>{throw t.message=this._formatQuery(e.sql,e.bindings)+\" - \"+t.message,this.emit(\"query-error\",t,Object.assign({__knexUid:r,__knexTxId:n},e)),t})},stream(t,e,r,n){\"string\"==typeof e&&(e={sql:e}),e.bindings=this.prepBindings(e.bindings);const{__knexUid:i,__knexTxId:o}=t;return this.emit(\"query\",Object.assign({__knexUid:i,__knexTxId:o},e)),M(e.sql,o),R(e.bindings,o),e.sql=this.positionBindings(e.sql),this._stream(t,e,r,n)},prepBindings:t=>t,positionBindings:t=>t,postProcessResponse(t,e){return this.config.postProcessResponse?this.config.postProcessResponse(t,e):t},wrapIdentifier(t,e){return this.customWrapIdentifier(t,this.wrapIdentifierImpl,e)},customWrapIdentifier(t,e,r){return this.config.wrapIdentifier?this.config.wrapIdentifier(t,e,r):e(t)},wrapIdentifierImpl:t=>\"*\"!==t?`\"${t.replace(/\"/g,'\"\"')}\"`:\"*\",initializeDriver(){try{this.driver=this._driver()}catch(t){const e=`Knex: run\\n$ npm install ${this.driverName} --save`;throw this.logger.error(`${e}\\n${t.message}\\n${t.stack}`),new Error(`${e}\\n${t.message}`)}},poolDefaults:()=>({min:2,max:10,propagateCreateError:!0}),getPoolSettings(t){t=A({},t,this.poolDefaults()),j.forEach(e=>{e in t&&this.logger.warn([`Pool config option \"${e}\" is no longer supported.`,\"See https://github.com/Vincit/tarn.js for possible pool config options.\"].join(\" \"))});const e=[this.config.acquireConnectionTimeout||6e4,t.acquireTimeoutMillis].filter(t=>void 0!==t);t.acquireTimeoutMillis=Math.min(...e);const r=async()=>{if(!this.connectionConfigProvider)return;if(!this.connectionConfigExpirationChecker||!this.connectionConfigExpirationChecker())return;const t=await this.connectionConfigProvider();t.expirationChecker?(this.connectionConfigExpirationChecker=t.expirationChecker,delete t.expirationChecker):this.connectionConfigExpirationChecker=null,this.connectionSettings=t};return Object.assign(t,{create:async()=>{await r();const e=await this.acquireRawConnection();return e.__knexUid=x(\"__knexUid\"),t.afterCreate&&await w(t.afterCreate)(e),e},destroy:t=>{if(void 0!==t)return this.destroyRawConnection(t)},validate:t=>t.__knex__disposed?(this.logger.warn(`Connection Error: ${t.__knex__disposed}`),!1):this.validateConnection(t)})},initializePool(t=this.config){if(this.pool)return void this.logger.warn(\"The pool has already been initialized\");const e={...this.getPoolSettings(t.pool)};e.afterCreate&&delete e.afterCreate,this.pool=new g(e)},validateConnection:t=>!0,acquireConnection(){if(!this.pool)return n.reject(new Error(\"Unable to acquire a connection\"));try{return n.try(()=>this.pool.acquire().promise).then(t=>(k(\"acquired connection from pool: %s\",t.__knexUid),t)).catch(y,()=>{throw new n.TimeoutError(\"Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?\")})}catch(t){return n.reject(t)}},releaseConnection(t){return k(\"releasing connection to pool: %s\",t.__knexUid),this.pool.release(t)||k(\"pool refused connection: %s\",t.__knexUid),n.resolve()},destroy(t){const e=this.pool&&this.pool.destroy();return n.resolve(e).then(()=>{this.pool=void 0,\"function\"==typeof t&&t()}).catch(e=>(\"function\"==typeof t&&t(e),n.reject(e)))},database(){return this.connectionSettings.database},toString:()=>\"[object KnexClient]\",canCancelQuery:!1,assertCanCancelQuery(){if(!this.canCancelQuery)throw new Error(\"Query cancelling not supported for this dialect\")},cancelQuery(){throw new Error(\"Query cancelling not supported for this dialect\")}}),t.exports=I},function(t,e,r){const{pushQuery:n,pushAdditional:i,unshiftQuery:o}=r(48),{isUndefined:s}=r(1);function a(t,e){this.builder=e,this._commonBuilder=this.builder,this.client=t,this.schema=e._schema,this.formatter=t.formatter(e),this.sequence=[]}function c(t){throw new Error(`${t} is not supported for this dialect (only PostgreSQL supports it currently).`)}function u(t){return function(e,r){const n=this.client.tableBuilder(t,e,r),i=this.builder.queryContext();!s(i)&&s(n.queryContext())&&n.queryContext(i),n.setSchema(this.schema);const o=n.toSQL();for(let t=0,e=o.length;t{c(\"createSchema\")},createSchemaIfNotExists:()=>{c(\"createSchemaIfNotExists\")},dropSchema:()=>{c(\"dropSchema\")},dropSchemaIfExists:()=>{c(\"dropSchemaIfExists\")},alterTable:u(\"alter\"),dropTablePrefix:\"drop table \",dropTable(t){this.pushQuery(this.dropTablePrefix+this.formatter.wrap(h(this.schema,t)))},dropTableIfExists(t){this.pushQuery(this.dropTablePrefix+\"if exists \"+this.formatter.wrap(h(this.schema,t)))},raw(t,e){this.sequence.push(this.client.raw(t,e).toSQL())},toSQL(){const t=this.builder._sequence;for(let e=0,r=t.length;et.toSQL()),r=this.getColumnTypes(e);this.createAlterTableMethods&&this.alterTableForCreate(r),this.createQuery(r,t),this.columnQueries(e),delete this.single.comment,this.alterTable()},b.prototype.createIfNot=function(){this.create(!0)},b.prototype.alter=function(){const t=this.getColumns().map(t=>t.toSQL()),e=this.getColumns(\"alter\"),r=e.map(t=>t.toSQL()),n=this.getColumnTypes(t),i=this.getColumnTypes(r);this.addColumns(n),this.alterColumns(i,e),this.columnQueries(t),this.columnQueries(r),this.alterTable()},b.prototype.foreign=function(t){if(t.inTable&&t.references){const e=t.keyName?this.formatter.wrap(t.keyName):this._indexCommand(\"foreign\",this.tableNameRaw,t.column),r=this.formatter.columnize(t.column),n=this.formatter.columnize(t.references),i=this.formatter.wrap(t.inTable),o=t.onUpdate?(this.lowerCase?\" on update \":\" ON UPDATE \")+t.onUpdate:\"\",s=t.onDelete?(this.lowerCase?\" on delete \":\" ON DELETE \")+t.onDelete:\"\";this.lowerCase?this.pushQuery((this.forCreate?\"\":`alter table ${this.tableName()} add `)+\"constraint \"+e+\" foreign key (\"+r+\") references \"+i+\" (\"+n+\")\"+o+s):this.pushQuery((this.forCreate?\"\":`ALTER TABLE ${this.tableName()} ADD `)+\"CONSTRAINT \"+e+\" FOREIGN KEY (\"+r+\") REFERENCES \"+i+\" (\"+n+\")\"+o+s)}},b.prototype.getColumnTypes=(t=>c(u(t,h),function(t,e){return t.sql.push(e.sql),t.bindings.concat(e.bindings),t},{sql:[],bindings:[]})),b.prototype.columnQueries=function(t){const e=c(u(t,f),function(t,e){return l(e)?t:t.concat(e)},[]);for(const t of e)this.pushQuery(t)},b.prototype.addColumnsPrefix=\"add column \",b.prototype.addColumns=function(t,e){if(e=e||this.addColumnsPrefix,t.sql.length>0){const r=u(t.sql,t=>e+t);this.pushQuery({sql:(this.lowerCase?\"alter table \":\"ALTER TABLE \")+this.tableName()+\" \"+r.join(\", \"),bindings:t.bindings})}},b.prototype.alterColumnsPrefix=\"alter column \",b.prototype.alterColumns=function(t,e){t.sql.length>0&&this.addColumns(t,this.alterColumnsPrefix,e)},b.prototype.getColumns=function(t){const e=this.grouped.columns||[];t=t||\"add\";const r=this.tableBuilder.queryContext();return e.filter(e=>e.builder._method===t).map(t=>(!m(r)&&m(t.builder.queryContext())&&t.builder.queryContext(r),this.client.columnCompiler(this,t.builder)))},b.prototype.tableName=function(){const t=this.schemaNameRaw?`${this.schemaNameRaw}.${this.tableNameRaw}`:this.tableNameRaw;return this.formatter.wrap(t)},b.prototype.alterTable=function(){const t=this.grouped.alterTable||[];for(let e=0,r=t.length;ethis.dropColumnPrefix+this.formatter.wrap(t));this.pushQuery((this.lowerCase?\"alter table \":\"ALTER TABLE \")+this.tableName()+\" \"+e.join(\", \"))},b.prototype._indexCommand=function(t,e,r){p(r)||(r=r?[r]:[]);const n=(e.replace(/\\.|-/g,\"_\")+\"_\"+r.join(\"_\")+\"_\"+t).toLowerCase();return this.formatter.wrap(n)},t.exports=b},function(t,e,r){const n=r(14),i=r(48),{groupBy:o,first:s,tail:a,has:c,isObject:u}=r(1);function h(t,e,r){this.client=t,this.tableCompiler=e,this.columnBuilder=r,this._commonBuilder=this.columnBuilder,this.args=r._args,this.type=r._type.toLowerCase(),this.grouped=o(r._statements,\"grouping\"),this.modified=r._modifiers,this.isIncrements=-1!==this.type.indexOf(\"increments\"),this.formatter=t.formatter(r),this.sequence=[],this.modifiers=[]}h.prototype.pushQuery=i.pushQuery,h.prototype.pushAdditional=i.pushAdditional,h.prototype.unshiftQuery=i.unshiftQuery,h.prototype._defaultMap={columnName:function(){if(!this.isIncrements)throw new Error(`You did not specify a column name for the ${this.type} column.`);return\"id\"}},h.prototype.defaults=function(t){if(Object.prototype.hasOwnProperty.call(this._defaultMap,t))return this._defaultMap[t].bind(this)();throw new Error(`There is no default for the specified identifier ${t}`)},h.prototype.toSQL=function(){return this.pushQuery(this.compileColumn()),this.sequence.additional&&(this.sequence=this.sequence.concat(this.sequence.additional)),this.sequence},h.prototype.compileColumn=function(){return this.formatter.wrap(this.getColumnName())+\" \"+this.getColumnType()+this.getModifiers()},h.prototype.getColumnName=function(){return s(this.args)||this.defaults(\"columnName\")},h.prototype.getColumnType=function(){const t=this[this.type];return\"function\"==typeof t?t.apply(this,a(this.args)):t},h.prototype.getModifiers=function(){const t=[];for(let e=0,r=this.modifiers.length;e0?` ${t.join(\" \")}`:\"\"},h.prototype.increments=\"integer not null primary key autoincrement\",h.prototype.bigincrements=\"integer not null primary key autoincrement\",h.prototype.integer=h.prototype.smallint=h.prototype.mediumint=\"integer\",h.prototype.biginteger=\"bigint\",h.prototype.varchar=function(t){return`varchar(${this._num(t,255)})`},h.prototype.text=\"text\",h.prototype.tinyint=\"tinyint\",h.prototype.floating=function(t,e){return`float(${this._num(t,8)}, ${this._num(e,2)})`},h.prototype.decimal=function(t,e){if(null===t)throw new Error(\"Specifying no precision on decimal columns is not supported for that SQL dialect.\");return`decimal(${this._num(t,8)}, ${this._num(e,2)})`},h.prototype.binary=\"blob\",h.prototype.bool=\"boolean\",h.prototype.date=\"date\",h.prototype.datetime=\"datetime\",h.prototype.time=\"time\",h.prototype.timestamp=\"timestamp\",h.prototype.enu=\"varchar\",h.prototype.bit=h.prototype.json=\"text\",h.prototype.uuid=\"char(36)\",h.prototype.specifictype=(t=>t),h.prototype.nullable=(t=>!1===t?\"not null\":\"null\"),h.prototype.notNullable=function(){return this.nullable(!1)},h.prototype.defaultTo=function(t){return void 0===t?\"\":(null===t?t=\"null\":t instanceof n?t=t.toQuery():\"bool\"===this.type?(\"false\"===t&&(t=0),t=`'${t?1:0}'`):t=\"json\"!==this.type&&\"jsonb\"!==this.type||!u(t)?`'${t}'`:`'${JSON.stringify(t)}'`,`default ${t}`)},h.prototype._num=function(t,e){if(null==t)return e;const r=parseInt(t,10);return isNaN(r)?e:r},t.exports=h},function(t,e,r){\"use strict\";(function(e,n){var i=r(2).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,r){if(t>65536)throw new Error(\"requested too many random bytes\");var s=new e.Uint8Array(t);t>0&&o.getRandomValues(s);var a=i.from(s.buffer);if(\"function\"==typeof r)return n.nextTick(function(){r(null,a)});return a}:t.exports=function(){throw new Error(\"Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11\")}}).call(this,r(8),r(5))},function(t,e,r){var n=r(2).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){\"string\"==typeof t&&(e=e||\"utf8\",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error(\"_update must be implemented by subclass\")},t.exports=i},function(t,e,r){t.exports=i;var n=r(12).EventEmitter;function i(){n.call(this)}r(0)(i,n),i.Readable=r(45),i.Writable=r(138),i.Duplex=r(139),i.Transform=r(140),i.PassThrough=r(141),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on(\"data\",i),t.on(\"drain\",o),t._isStdio||e&&!1===e.end||(r.on(\"end\",a),r.on(\"close\",c));var s=!1;function a(){s||(s=!0,t.end())}function c(){s||(s=!0,\"function\"==typeof t.destroy&&t.destroy())}function u(t){if(h(),0===n.listenerCount(this,\"error\"))throw t}function h(){r.removeListener(\"data\",i),t.removeListener(\"drain\",o),r.removeListener(\"end\",a),r.removeListener(\"close\",c),r.removeListener(\"error\",u),t.removeListener(\"error\",u),r.removeListener(\"end\",h),r.removeListener(\"close\",h),t.removeListener(\"close\",h)}return r.on(\"error\",u),t.on(\"error\",u),r.on(\"end\",h),r.on(\"close\",h),t.on(\"close\",h),t.emit(\"pipe\",r),t}},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):\"[object Array]\"===r(t)},e.isBoolean=function(t){return\"boolean\"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return\"number\"==typeof t},e.isString=function(t){return\"string\"==typeof t},e.isSymbol=function(t){return\"symbol\"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return\"[object RegExp]\"===r(t)},e.isObject=function(t){return\"object\"==typeof t&&null!==t},e.isDate=function(t){return\"[object Date]\"===r(t)},e.isError=function(t){return\"[object Error]\"===r(t)||t instanceof Error},e.isFunction=function(t){return\"function\"==typeof t},e.isPrimitive=function(t){return null===t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||\"symbol\"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){const n=r(36),i=r(14),{transform:o}=r(1),s=[\"asc\",\"desc\"],a=o([\"=\",\"<\",\">\",\"<=\",\">=\",\"<>\",\"!=\",\"like\",\"not like\",\"between\",\"not between\",\"ilike\",\"not ilike\",\"exists\",\"not exist\",\"rlike\",\"not rlike\",\"regexp\",\"not regexp\",\"&\",\"|\",\"^\",\"<<\",\">>\",\"~\",\"~*\",\"!~\",\"!~*\",\"#\",\"&&\",\"@>\",\"<@\",\"||\",\"&<\",\"&>\",\"-|-\",\"@@\",\"!!\",[\"?\",\"\\\\?\"],[\"?|\",\"\\\\?|\"],[\"?&\",\"\\\\?&\"]],(t,e)=>{Array.isArray(e)?t[e[0]]=e[1]:t[e]=e},{});t.exports=class{constructor(t,e){this.client=t,this.builder=e,this.bindings=[]}columnize(t){const e=Array.isArray(t)?t:[t];let r=\"\",n=-1;for(;++n0&&(r+=\", \"),r+=this.wrap(e[n]);return r}parameterize(t,e){if(\"function\"==typeof t)return this.parameter(t);t=Array.isArray(t)?t:[t];let r=\"\",n=-1;for(;++n0&&(r+=\", \"),r+=this.parameter(void 0===t[n]?e:t[n]);return r}values(t){return Array.isArray(t)?Array.isArray(t[0])?`(${t.map(t=>`(${this.parameterize(t)})`).join(\", \")})`:`(${this.parameterize(t)})`:t instanceof i?`(${this.parameter(t)})`:this.parameter(t)}parameter(t){return\"function\"==typeof t?this.outputQuery(this.compileCallback(t),!0):this.unwrapRaw(t,!0)||\"?\"}unwrapRaw(t,e){let r;return t instanceof n?((r=this.client.queryCompiler(t).toSQL()).bindings&&(this.bindings=this.bindings.concat(r.bindings)),this.outputQuery(r,e)):t instanceof i?(t.client=this.client,this.builder._queryContext&&(t.queryContext=(()=>this.builder._queryContext)),(r=t.toSQL()).bindings&&(this.bindings=this.bindings.concat(r.bindings)),r.sql):void(e&&this.bindings.push(t))}rawOrFn(t,e){return\"function\"==typeof t?this.outputQuery(this.compileCallback(t,e)):this.unwrapRaw(t)||\"\"}wrap(t,e){const r=this.unwrapRaw(t,e);if(r)return r;switch(typeof t){case\"function\":return this.outputQuery(this.compileCallback(t),!0);case\"object\":return this.parseObject(t);case\"number\":return t;default:return this.wrapString(t+\"\")}}wrapAsIdentifier(t){const e=this.builder.queryContext();return this.client.wrapIdentifier((t||\"\").trim(),e)}alias(t,e){return t+\" as \"+e}operator(t){const e=this.unwrapRaw(t);if(e)return e;const r=a[(t||\"\").toLowerCase()];if(!r)throw new TypeError(`The operator \"${t}\" is not permitted`);return r}direction(t){const e=this.unwrapRaw(t);return e||(-1!==s.indexOf((t||\"\").toLowerCase())?t:\"asc\")}compileCallback(t,e){const{client:r}=this,n=r.queryBuilder();t.call(n,n);const i=r.queryCompiler(n);return i.formatter=this,i.toSQL(e||n._method||\"select\")}outputQuery(t,e){let r=t.sql||\"\";return r&&(\"select\"===t.method||\"first\"===t.method)&&(e||t.as)&&(r=`(${r})`,t.as)?this.alias(r,this.wrap(t.as)):r}parseObject(t){const e=[];for(const r in t){const i=t[r];if(\"function\"==typeof i){const t=this.compileCallback(i);t.as=r,e.push(this.outputQuery(t,!0))}else i instanceof n?e.push(this.alias(`(${this.wrap(i)})`,this.wrapAsIdentifier(r))):e.push(this.alias(this.wrap(i),this.wrapAsIdentifier(r)))}return e.join(\", \")}wrapString(t){const e=t.toLowerCase().indexOf(\" as \");if(-1!==e){const r=t.slice(0,e),n=t.slice(e+4);return this.alias(this.wrap(r),this.wrapAsIdentifier(n))}const r=[];let n=-1;const i=t.split(\".\");for(;++n1?r.push(this.wrap((t||\"\").trim())):r.push(this.wrapAsIdentifier(t));return r.join(\".\")}}},function(t,e,r){\"use strict\";var n=r(0),i=r(51),o=r(52),s=r(53),a=r(16);function c(t){a.call(this,\"digest\"),this._hash=t}n(c,a),c.prototype._update=function(t){this._hash.update(t)},c.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return\"md5\"===(t=t.toLowerCase())?new i:\"rmd160\"===t||\"ripemd160\"===t?new o:new c(s(t))}},function(t,e,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),o=0;o=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o0&&(this._timeout=t,e&&(this.client.assertCanCancelQuery(),this._cancelOnTimeout=!0)),this},with(t,e){return M(t,e,\"with\"),this.withWrapped(t,e)},withWrapped(t,e){return this._statements.push({grouping:\"with\",type:\"withWrapped\",alias:t,value:e}),this},withRecursive(t,e){return M(t,e,\"withRecursive\"),this.withRecursiveWrapped(t,e)},withRecursiveWrapped(t,e){return this.withWrapped(t,e),this._statements[this._statements.length-1].recursive=!0,this},columns(t){return t||0===t?(this._statements.push({grouping:\"columns\",value:a.normalizeArr.apply(null,arguments)}),this):this},as(t){return this._single.as=t,this},withSchema(t){return this._single.schema=t,this},table(t,e={}){return this._single.table=t,this._single.only=!0===e.only,this},distinct(){return this._statements.push({grouping:\"columns\",value:a.normalizeArr.apply(null,arguments),distinct:!0}),this},distinctOn(){const t=a.normalizeArr.apply(null,arguments);if(d(t))throw new Error(\"distinctOn requires atleast on argument\");return this._statements.push({grouping:\"columns\",value:t,distinctOn:!0}),this},join(t,e){let r;const{schema:n}=this._single,i=this._joinType();return\"function\"==typeof e?(r=new c(t,i,n),e.call(r,r)):\"raw\"===i?r=new c(this.client.raw(t,e),\"raw\"):(r=new c(t,i,t instanceof R?void 0:n),arguments.length>1&&r.on.apply(r,w(arguments).slice(1))),this._statements.push(r),this},innerJoin(){return this._joinType(\"inner\").join.apply(this,arguments)},leftJoin(){return this._joinType(\"left\").join.apply(this,arguments)},leftOuterJoin(){return this._joinType(\"left outer\").join.apply(this,arguments)},rightJoin(){return this._joinType(\"right\").join.apply(this,arguments)},rightOuterJoin(){return this._joinType(\"right outer\").join.apply(this,arguments)},outerJoin(){return this._joinType(\"outer\").join.apply(this,arguments)},fullOuterJoin(){return this._joinType(\"full outer\").join.apply(this,arguments)},crossJoin(){return this._joinType(\"cross\").join.apply(this,arguments)},joinRaw(){return this._joinType(\"raw\").join.apply(this,arguments)},where(t,e,r){if(!1===t||!0===t)return this.where(1,\"=\",t?1:0);if(\"function\"==typeof t)return this.whereWrapped(t);if(t instanceof s&&1===arguments.length)return this.whereRaw(t);if(g(t)&&!(t instanceof s))return this._objectWhere(t);if(2===arguments.length&&(r=e,e=\"=\",null===r))return this.whereNull(t);const n=`${e}`.toLowerCase().trim();if(3===arguments.length){if(\"in\"===n||\"not in\"===n)return this._not(\"not in\"===n).whereIn(arguments[0],arguments[2]);if(\"between\"===n||\"not between\"===n)return this._not(\"not between\"===n).whereBetween(arguments[0],arguments[2])}return null!==r||\"is\"!==n&&\"is not\"!==n?(this._statements.push({grouping:\"where\",type:\"whereBasic\",column:t,operator:e,value:r,not:this._not(),bool:this._bool(),asColumn:this._asColumnFlag}),this):this._not(\"is not\"===n).whereNull(t)},whereColumn(t,e,r){return this._asColumnFlag=!0,this.where.apply(this,arguments),this._asColumnFlag=!1,this},orWhere(){this._bool(\"or\");const t=arguments[0];return!g(t)||p(t)||t instanceof s?this.where.apply(this,arguments):this.whereWrapped(function(){for(const e in t)this.andWhere(e,t[e])})},orWhereColumn(){this._bool(\"or\");const t=arguments[0];return!g(t)||p(t)||t instanceof s?this.whereColumn.apply(this,arguments):this.whereWrapped(function(){for(const e in t)this.andWhereColumn(e,\"=\",t[e])})},whereNot(){return this._not(!0).where.apply(this,arguments)},whereNotColumn(){return this._not(!0).whereColumn.apply(this,arguments)},orWhereNot(){return this._bool(\"or\").whereNot.apply(this,arguments)},orWhereNotColumn(){return this._bool(\"or\").whereNotColumn.apply(this,arguments)},_objectWhere(t){const e=this._bool(),r=this._not()?\"Not\":\"\";for(const n in t)this[e+\"Where\"+r](n,t[n]);return this},whereRaw(t,e){const r=t instanceof s?t:this.client.raw(t,e);return this._statements.push({grouping:\"where\",type:\"whereRaw\",value:r,not:this._not(),bool:this._bool()}),this},orWhereRaw(t,e){return this._bool(\"or\").whereRaw(t,e)},whereWrapped(t){return this._statements.push({grouping:\"where\",type:\"whereWrapped\",value:t,not:this._not(),bool:this._bool()}),this},whereExists(t){return this._statements.push({grouping:\"where\",type:\"whereExists\",value:t,not:this._not(),bool:this._bool()}),this},orWhereExists(t){return this._bool(\"or\").whereExists(t)},whereNotExists(t){return this._not(!0).whereExists(t)},orWhereNotExists(t){return this._bool(\"or\").whereNotExists(t)},whereIn(t,e){return Array.isArray(e)&&d(e)?this.where(this._not()):(this._statements.push({grouping:\"where\",type:\"whereIn\",column:t,value:e,not:this._not(),bool:this._bool()}),this)},orWhereIn(t,e){return this._bool(\"or\").whereIn(t,e)},whereNotIn(t,e){return this._not(!0).whereIn(t,e)},orWhereNotIn(t,e){return this._bool(\"or\")._not(!0).whereIn(t,e)},whereNull(t){return this._statements.push({grouping:\"where\",type:\"whereNull\",column:t,not:this._not(),bool:this._bool()}),this},orWhereNull(t){return this._bool(\"or\").whereNull(t)},whereNotNull(t){return this._not(!0).whereNull(t)},orWhereNotNull(t){return this._bool(\"or\").whereNotNull(t)},whereBetween(t,e){return n(Array.isArray(e),\"The second argument to whereBetween must be an array.\"),n(2===e.length,\"You must specify 2 values for the whereBetween clause\"),this._statements.push({grouping:\"where\",type:\"whereBetween\",column:t,value:e,not:this._not(),bool:this._bool()}),this},whereNotBetween(t,e){return this._not(!0).whereBetween(t,e)},orWhereBetween(t,e){return this._bool(\"or\").whereBetween(t,e)},orWhereNotBetween(t,e){return this._bool(\"or\").whereNotBetween(t,e)},groupBy(t){return t instanceof s?this.groupByRaw.apply(this,arguments):(this._statements.push({grouping:\"group\",type:\"groupByBasic\",value:a.normalizeArr.apply(null,arguments)}),this)},groupByRaw(t,e){const r=t instanceof s?t:this.client.raw(t,e);return this._statements.push({grouping:\"group\",type:\"groupByRaw\",value:r}),this},orderBy(t,e){return Array.isArray(t)?this._orderByArray(t):(this._statements.push({grouping:\"order\",type:\"orderByBasic\",value:t,direction:e}),this)},_orderByArray(t){for(let e=0;e1&&A(S(e))&&([t]=e.splice(e.length-1,1)),e.length?1===e.length&&(e=e[0]):e=\"*\",this._aggregate(\"count\",e,{...t,distinct:!0})},sumDistinct(t,e){return this._aggregate(\"sum\",t,{...e,distinct:!0})},avgDistinct(t,e){return this._aggregate(\"avg\",t,{...e,distinct:!0})},increment(t,e=1){if(g(t)){for(const e in t)this._counter(e,t[e]);return this}return this._counter(t,e)},decrement(t,e=1){if(g(t)){for(const e in t)this._counter(e,-t[e]);return this}return this._counter(t,-e)},clearCounters(){return this._single.counter={},this},first(){if(!this._isSelectQuery())throw new Error(`Cannot chain .first() on \"${this._method}\" query!`);const t=new Array(arguments.length);for(let e=0;e2&&(r=arguments[2]);else{const e=Object.keys(t);this._single.update&&this.client.logger.warn(\"Update called multiple times with objects.\");let i=-1;for(;++i{\"function\"!=typeof this[e]&&this.client.logger.warn(`Knex Error: unknown key ${e}`),Array.isArray(t)?this[e].apply(this,t):this[e](t)}),this},modify(t){return t.apply(this,[this].concat(v(arguments))),this},_counter(t,e){return e=parseFloat(e),this._method=\"update\",this._single.counter=this._single.counter||{},this._single.counter[t]=e,this},_bool(t){if(1===arguments.length)return this._boolFlag=t,this;const e=this._boolFlag;return this._boolFlag=\"and\",e},_not(t){if(1===arguments.length)return this._notFlag=t,this;const e=this._notFlag;return this._notFlag=!1,e},_joinType(t){if(1===arguments.length)return this._joinFlag=t,this;const e=this._joinFlag||\"inner\";return this._joinFlag=\"inner\",e},_aggregate(t,e,r={}){return this._statements.push({grouping:\"columns\",type:e instanceof s?\"aggregateRaw\":\"aggregate\",method:t,value:e,aggregateDistinct:r.distinct||!1,alias:r.as}),this},_clearGrouping(t){this._statements=E(this._statements,{grouping:t})},_isSelectQuery(){return x([\"pluck\",\"first\",\"select\"],this._method)},_hasLockMode(){return x([k.forShare,k.forUpdate],this._single.lock)}}),Object.defineProperty(R.prototype,\"or\",{get(){return this._bool(\"or\")}}),Object.defineProperty(R.prototype,\"not\",{get(){return this._not(!0)}}),R.prototype.select=R.prototype.columns,R.prototype.column=R.prototype.columns,R.prototype.andWhereNot=R.prototype.whereNot,R.prototype.andWhereNotColumn=R.prototype.whereNotColumn,R.prototype.andWhere=R.prototype.where,R.prototype.andWhereColumn=R.prototype.whereColumn,R.prototype.andWhereRaw=R.prototype.whereRaw,R.prototype.andWhereBetween=R.prototype.whereBetween,R.prototype.andWhereNotBetween=R.prototype.whereNotBetween,R.prototype.andHaving=R.prototype.having,R.prototype.andHavingIn=R.prototype.havingIn,R.prototype.andHavingNotIn=R.prototype.havingNotIn,R.prototype.andHavingNull=R.prototype.havingNull,R.prototype.andHavingNotNull=R.prototype.havingNotNull,R.prototype.andHavingExists=R.prototype.havingExists,R.prototype.andHavingNotExists=R.prototype.havingNotExists,R.prototype.andHavingBetween=R.prototype.havingBetween,R.prototype.andHavingNotBetween=R.prototype.havingNotBetween,R.prototype.from=R.prototype.table,R.prototype.into=R.prototype.table,R.prototype.del=R.prototype.delete,r(44)(R),a.addQueryContext(R),R.extend=((t,e)=>{if(Object.prototype.hasOwnProperty.call(R.prototype,t))throw new Error(`Can't extend QueryBuilder with existing method ('${t}').`);u(R.prototype,{[t]:e})}),t.exports=R},function(t,e,r){(function(e){const r=/[\\0\\b\\t\\n\\r\\x1a\"'\\\\]/g,n={\"\\0\":\"\\\\0\",\"\\b\":\"\\\\b\",\"\\t\":\"\\\\t\",\"\\n\":\"\\\\n\",\"\\r\":\"\\\\r\",\"\u001a\":\"\\\\Z\",'\"':'\\\\\"',\"'\":\"\\\\'\",\"\\\\\":\"\\\\\\\\\"};function i(t){return function e(r,n={}){return t(r,e,n)}}function o(t,e,r){return t&&\"function\"==typeof t.toSQL?t.toSQL(r):JSON.stringify(t)}function s(t,e,r){let n=\"\";for(let i=0;i>>24]^h[p>>>16&255]^f[m>>>8&255]^l[255&b]^e[g++],s=u[p>>>24]^h[m>>>16&255]^f[b>>>8&255]^l[255&d]^e[g++],a=u[m>>>24]^h[b>>>16&255]^f[d>>>8&255]^l[255&p]^e[g++],c=u[b>>>24]^h[d>>>16&255]^f[p>>>8&255]^l[255&m]^e[g++],d=o,p=s,m=a,b=c;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&b])^e[g++],s=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[b>>>8&255]<<8|n[255&d])^e[g++],a=(n[m>>>24]<<24|n[b>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^e[g++],c=(n[b>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[g++],[o>>>=0,s>>>=0,a>>>=0,c>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,c=0;c<256;++c){var u=a^a<<1^a<<2^a<<3^a<<4;u=u>>>8^255&u^99,r[s]=u,n[u]=s;var h=t[s],f=t[h],l=t[f],d=257*t[u]^16843008*u;i[0][s]=d<<24|d>>>8,i[1][s]=d<<16|d>>>16,i[2][s]=d<<8|d>>>24,i[3][s]=d,d=16843009*l^65537*f^257*h^16843008*s,o[0][u]=d<<24|d>>>8,o[1][u]=d<<16|d>>>16,o[2][u]=d<<8|d>>>24,o[3][u]=d,0===s?s=a=1:(s=h^t[t[t[l^h]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function u(t){this._key=i(t),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e==4&&(s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s]),i[o]=i[o-e]^s}for(var u=[],h=0;h>>24]]^c.INV_SUB_MIX[1][c.SBOX[l>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[l>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&l]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(t){return s(t=i(t),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},u.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},u.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=u},function(t,e,r){var n=r(2).Buffer,i=r(51);t.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,\"binary\")),e&&(n.isBuffer(e)||(e=n.from(e,\"binary\")),8!==e.length))throw new RangeError(\"salt should be Buffer with 8 byte length\");for(var s=r/8,a=n.alloc(s),c=n.alloc(o||0),u=n.alloc(0);s>0||o>0;){var h=new i;h.update(u),h.update(t),e&&h.update(e),u=h.digest();var f=0;if(s>0){var l=a.length-s;f=Math.min(s,u.length),u.copy(a,l,0,f),s-=f}if(f0){var d=c.length-o,p=Math.min(o,u.length-f);u.copy(c,d,f,f+p),o-=p}}return u.fill(0),{key:a,iv:c}}},function(t,e,r){\"use strict\";var n=e;n.base=r(218),n.short=r(219),n.mont=r(220),n.edwards=r(221)},function(t,e,r){(function(e){var n=r(237),i=r(249),o=r(250),s=r(55),a=r(87);function c(t){var r;\"object\"!=typeof t||e.isBuffer(t)||(r=t.passphrase,t=t.key),\"string\"==typeof t&&(t=new e(t));var c,u,h=o(t,r),f=h.tag,l=h.data;switch(f){case\"CERTIFICATE\":u=n.certificate.decode(l,\"der\").tbsCertificate.subjectPublicKeyInfo;case\"PUBLIC KEY\":switch(u||(u=n.PublicKey.decode(l,\"der\")),c=u.algorithm.algorithm.join(\".\")){case\"1.2.840.113549.1.1.1\":return n.RSAPublicKey.decode(u.subjectPublicKey.data,\"der\");case\"1.2.840.10045.2.1\":return u.subjectPrivateKey=u.subjectPublicKey,{type:\"ec\",data:u};case\"1.2.840.10040.4.1\":return u.algorithm.params.pub_key=n.DSAparam.decode(u.subjectPublicKey.data,\"der\"),{type:\"dsa\",data:u.algorithm.params};default:throw new Error(\"unknown key id \"+c)}throw new Error(\"unknown key type \"+f);case\"ENCRYPTED PRIVATE KEY\":l=function(t,r){var n=t.algorithm.decrypt.kde.kdeparams.salt,o=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=i[t.algorithm.decrypt.cipher.algo.join(\".\")],u=t.algorithm.decrypt.cipher.iv,h=t.subjectPrivateKey,f=parseInt(c.split(\"-\")[1],10)/8,l=a.pbkdf2Sync(r,n,o,f),d=s.createDecipheriv(c,l,u),p=[];return p.push(d.update(h)),p.push(d.final()),e.concat(p)}(l=n.EncryptedPrivateKey.decode(l,\"der\"),r);case\"PRIVATE KEY\":switch(c=(u=n.PrivateKey.decode(l,\"der\")).algorithm.algorithm.join(\".\")){case\"1.2.840.113549.1.1.1\":return n.RSAPrivateKey.decode(u.subjectPrivateKey,\"der\");case\"1.2.840.10045.2.1\":return{curve:u.algorithm.curve,privateKey:n.ECPrivateKey.decode(u.subjectPrivateKey,\"der\").privateKey};case\"1.2.840.10040.4.1\":return u.algorithm.params.priv_key=n.DSAparam.decode(u.subjectPrivateKey,\"der\"),{type:\"dsa\",params:u.algorithm.params};default:throw new Error(\"unknown key id \"+c)}throw new Error(\"unknown key type \"+f);case\"RSA PUBLIC KEY\":return n.RSAPublicKey.decode(l,\"der\");case\"RSA PRIVATE KEY\":return n.RSAPrivateKey.decode(l,\"der\");case\"DSA PRIVATE KEY\":return{type:\"dsa\",params:n.DSAPrivateKey.decode(l,\"der\")};case\"EC PRIVATE KEY\":return{curve:(l=n.ECPrivateKey.decode(l,\"der\")).parameters.value,privateKey:l.privateKey};default:throw new Error(\"unknown key type \"+f)}}t.exports=c,c.signature=n.signature}).call(this,r(3).Buffer)},function(t,e,r){const{keys:n}=r(1),i=Object.freeze({pg:\"postgres\",postgresql:\"postgres\",sqlite:\"sqlite3\"}),o=Object.freeze([\"mssql\",\"mysql\",\"mysql2\",\"oracledb\",\"postgres\",\"redshift\",\"sqlite3\"].concat(n(i))),s=Object.freeze([\"maxWaitingClients\",\"testOnBorrow\",\"fifo\",\"priorityRange\",\"autostart\",\"evictionRunIntervalMillis\",\"numTestsPerRun\",\"softIdleTimeoutMillis\",\"Promise\"]);t.exports={CLIENT_ALIASES:i,SUPPORTED_CLIENTS:o,POOL_CONFIG_OPTIONS:s}},function(t,e){t.exports=function(t,e){if(t.client.config.asyncStackTraces){const r=(new Error).stack.split(\"\\n\");r.splice(0,e),t._asyncStack=r}}},function(t,e,r){const{isEmpty:n,map:i,clone:o,each:s}=r(1),a=r(7);t.exports=function(t){t.prototype.toQuery=function(t){let e=this.toSQL(this._method,t);return Array.isArray(e)||(e=[e]),i(e,e=>this.client._formatQuery(e.sql,e.bindings,t)).join(\";\\n\")},t.prototype.then=function(){let t=this.client.runner(this).run();return this.client.config.asyncStackTraces&&(t=t.catch(t=>{t.originalStack=t.stack;const e=t.stack.split(\"\\n\")[0];throw this._asyncStack.unshift(e),t.stack=this._asyncStack.join(\"\\n\"),t})),a.resolve(t.then.apply(t,arguments))},t.prototype.options=function(t){return this._options=this._options||[],this._options.push(o(t)||{}),this},t.prototype.connection=function(t){return this._connection=t,this},t.prototype.debug=function(t){return this._debug=!arguments.length||t,this},t.prototype.transacting=function(t){if(t&&t.client&&(t.client.transacting?this.client=t.client:t.client.logger.warn(`Invalid transaction value: ${t.client}`)),n(t))throw this.client.logger.error(\"Invalid value on transacting call, potential bug\"),Error(\"Invalid transacting value (null, undefined or empty object)\");return this},t.prototype.stream=function(t){return this.client.runner(this).stream(t)},t.prototype.pipe=function(t,e){return this.client.runner(this).pipe(t,e)},s([\"bind\",\"catch\",\"finally\",\"asCallback\",\"spread\",\"map\",\"reduce\",\"thenReturn\",\"return\",\"yield\",\"ensure\",\"reflect\",\"get\",\"mapSeries\",\"delay\"],function(e){t.prototype[e]=function(){const t=this.then();return t[e].apply(t,arguments)}})}},function(t,e,r){(e=t.exports=r(65)).Stream=e,e.Readable=e,e.Writable=r(46),e.Duplex=r(17),e.Transform=r(69),e.PassThrough=r(137)},function(t,e,r){\"use strict\";(function(e,n,i){var o=r(35);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var a,c=!e.browser&&[\"v0.10\",\"v0.9.\"].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;y.WritableState=g;var u=Object.create(r(28));u.inherits=r(0);var h={deprecate:r(136)},f=r(67),l=r(2).Buffer,d=i.Uint8Array||function(){};var p,m=r(68);function b(){}function g(t,e){a=a||r(17),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,u=t.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(u||0===u)?u:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||\"utf8\",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit(\"error\",n)):(i(n),t._writableState.errorEmitted=!0,t.emit(\"error\",n),S(t,e))}(t,r,n,e,i);else{var s=E(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?c(v,t,r,s,i):v(t,r,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(t){if(a=a||r(17),!(p.call(y,this)||this instanceof a))return new y(t);this._writableState=new g(t,this),this.writable=!0,t&&(\"function\"==typeof t.write&&(this._write=t.write),\"function\"==typeof t.writev&&(this._writev=t.writev),\"function\"==typeof t.destroy&&(this._destroy=t.destroy),\"function\"==typeof t.final&&(this._final=t.final)),f.call(this)}function _(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit(\"drain\"))}(t,e),e.pendingcb--,n(),S(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,_(t,e,!0,e.length,i,\"\",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,h=r.encoding,f=r.callback;if(_(t,e,!1,e.objectMode?1:u.length,u,h,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&t.emit(\"error\",r),e.prefinished=!0,t.emit(\"prefinish\"),S(t,e)})}function S(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||(\"function\"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(x,t,e)):(e.prefinished=!0,t.emit(\"prefinish\")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit(\"finish\"))),r}u.inherits(y,f),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,\"buffer\",{get:h.deprecate(function(){return this.getBuffer()},\"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.\",\"DEP0003\")})}catch(t){}}(),\"function\"==typeof Symbol&&Symbol.hasInstance&&\"function\"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit(\"error\",new Error(\"Cannot pipe, not readable\"))},y.prototype.write=function(t,e,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=t,l.isBuffer(n)||n instanceof d);return a&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),\"function\"==typeof e&&(r=e,e=null),a?e=\"buffer\":e||(e=i.defaultEncoding),\"function\"!=typeof r&&(r=b),i.ended?function(t,e){var r=new Error(\"write after end\");t.emit(\"error\",r),o.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError(\"May not write null values to stream\"):\"string\"==typeof r||void 0===r||e.objectMode||(s=new TypeError(\"Invalid non-string/buffer chunk\")),s&&(t.emit(\"error\",s),o.nextTick(n,s),i=!1),i}(this,i,t,r))&&(i.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||\"string\"!=typeof e||(e=l.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i=\"buffer\",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var c=e.length-1))throw new TypeError(\"Unknown encoding: \"+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,\"writableHighWaterMark\",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error(\"_write() is not implemented\"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var n=this._writableState;\"function\"==typeof t?(r=t,t=null,e=null):\"function\"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,S(t,e),r&&(e.finished?o.nextTick(r):t.once(\"finish\",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,\"destroyed\",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(5),r(64).setImmediate,r(8))},function(t,e,r){\"use strict\";var n=r(2).Buffer,i=n.isEncoding||function(t){switch((t=\"\"+t)&&t.toLowerCase()){case\"hex\":case\"utf8\":case\"utf-8\":case\"ascii\":case\"binary\":case\"base64\":case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":case\"raw\":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return\"utf8\";for(var e;;)switch(t){case\"utf8\":case\"utf-8\":return\"utf8\";case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return\"utf16le\";case\"latin1\":case\"binary\":return\"latin1\";case\"base64\":case\"ascii\":case\"hex\":return t;default:if(e)return;t=(\"\"+t).toLowerCase(),e=!0}}(t);if(\"string\"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error(\"Unknown encoding: \"+t);return e||t}(t),this.encoding){case\"utf16le\":this.text=c,this.end=u,e=4;break;case\"utf8\":this.fillLast=a,e=4;break;case\"base64\":this.text=h,this.end=f,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,\"�\";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,\"�\";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,\"�\"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var r=t.toString(\"utf16le\",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString(\"utf16le\",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):\"\";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString(\"utf16le\",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString(\"base64\",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString(\"base64\",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):\"\";return this.lastNeed?e+this.lastChar.toString(\"base64\",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):\"\"}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return\"\";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return\"\";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString(\"utf8\",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString(\"utf8\",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){const{isString:n,tail:i}=r(1);t.exports={pushAdditional:function(t){const e=new this.constructor(this.client,this.tableCompiler,this.columnBuilder);t.call(e,i(arguments)),this.sequence.additional=(this.sequence.additional||[]).concat(e.sequence)},pushQuery:function(t){t&&(n(t)&&(t={sql:t}),t.bindings||(t.bindings=this.formatter.bindings),this.sequence.push(t),this.formatter=this.client.formatter(this._commonBuilder))},unshiftQuery:function(t){t&&(n(t)&&(t={sql:t}),t.bindings||(t.bindings=this.formatter.bindings),this.sequence.unshift(t),this.formatter=this.client.formatter(this._commonBuilder))}}},function(t,e,r){const{extend:n,each:i,toArray:o}=r(1),{addQueryContext:s}=r(11);function a(t,e,r,i){this.client=t,this._method=\"add\",this._single={},this._modifiers={},this._statements=[],this._type=h[r]||r,this._args=i,this._tableBuilder=e,\"alter\"===e._method&&n(this,u)}const c={default:\"defaultTo\",defaultsTo:\"defaultTo\"};i([\"default\",\"defaultsTo\",\"defaultTo\",\"unsigned\",\"nullable\",\"first\",\"after\",\"comment\",\"collate\"],function(t){const e=c[t]||t;a.prototype[t]=function(){return this._modifiers[e]=o(arguments),this}}),s(a),a.prototype.notNull=a.prototype.notNullable=function(){return this.nullable(!1)},i([\"index\",\"primary\",\"unique\"],function(t){a.prototype[t]=function(){return-1===this._type.toLowerCase().indexOf(\"increments\")&&this._tableBuilder[t].apply(this._tableBuilder,[this._args[0]].concat(o(arguments))),this}}),a.prototype.references=function(t){return this._tableBuilder.foreign.call(this._tableBuilder,this._args[0],void 0,this)._columnBuilder(this).references(t)};const u={drop:function(){return this._single.drop=!0,this},alterType:function(t){return this._statements.push({grouping:\"alterType\",value:t}),this},alter:function(){return this._method=\"alter\",this}},h={float:\"floating\",enum:\"enu\",boolean:\"bool\",string:\"varchar\",bigint:\"bigInteger\"};t.exports=a},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});const n=r(152);function i(t){return\"number\"==typeof t&&t===Math.round(t)&&t>0}e.defer=function(){let t=null,e=null;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}},e.now=function(){return Date.now()},e.duration=function(t,e){return Math.abs(e-t)},e.checkOptionalTime=function(t){return void 0===t||i(t)},e.checkRequiredTime=i,e.delay=function(t){return new Promise(e=>setTimeout(e,t))},e.reflect=function(t){return t.then(t=>new n.PromiseInspection({value:t})).catch(t=>new n.PromiseInspection({error:t}))},e.tryPromise=function(t){try{const e=t();return Promise.resolve(e)}catch(t){return Promise.reject(t)}}},function(t,e,r){\"use strict\";var n=r(0),i=r(81),o=r(2).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(t,e){return t<>>32-e}function u(t,e,r,n,i,o,s){return c(t+(e&r|~e&n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return c(t+(e&n|r&~n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return c(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return c(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=u(r,n,i,o,t[0],3614090360,7),o=u(o,r,n,i,t[1],3905402710,12),i=u(i,o,r,n,t[2],606105819,17),n=u(n,i,o,r,t[3],3250441966,22),r=u(r,n,i,o,t[4],4118548399,7),o=u(o,r,n,i,t[5],1200080426,12),i=u(i,o,r,n,t[6],2821735955,17),n=u(n,i,o,r,t[7],4249261313,22),r=u(r,n,i,o,t[8],1770035416,7),o=u(o,r,n,i,t[9],2336552879,12),i=u(i,o,r,n,t[10],4294925233,17),n=u(n,i,o,r,t[11],2304563134,22),r=u(r,n,i,o,t[12],1804603682,7),o=u(o,r,n,i,t[13],4254626195,12),i=u(i,o,r,n,t[14],2792965006,17),r=h(r,n=u(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),r=f(r,n=h(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=f(o,r,n,i,t[8],2272392833,11),i=f(i,o,r,n,t[11],1839030562,16),n=f(n,i,o,r,t[14],4259657740,23),r=f(r,n,i,o,t[1],2763975236,4),o=f(o,r,n,i,t[4],1272893353,11),i=f(i,o,r,n,t[7],4139469664,16),n=f(n,i,o,r,t[10],3200236656,23),r=f(r,n,i,o,t[13],681279174,4),o=f(o,r,n,i,t[0],3936430074,11),i=f(i,o,r,n,t[3],3572445317,16),n=f(n,i,o,r,t[6],76029189,23),r=f(r,n,i,o,t[9],3654602809,4),o=f(o,r,n,i,t[12],3873151461,11),i=f(i,o,r,n,t[15],530742520,16),r=l(r,n=f(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){\"use strict\";var n=r(3).Buffer,i=r(0),o=r(81),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function y(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function _(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,v=0|this._a,w=0|this._b,E=0|this._c,x=0|this._d,S=0|this._e,A=0;A<80;A+=1){var C,k;A<16?(C=m(r,n,i,o,d,t[a[A]],f[0],u[A]),k=_(v,w,E,x,S,t[c[A]],l[0],h[A])):A<32?(C=b(r,n,i,o,d,t[a[A]],f[1],u[A]),k=y(v,w,E,x,S,t[c[A]],l[1],h[A])):A<48?(C=g(r,n,i,o,d,t[a[A]],f[2],u[A]),k=g(v,w,E,x,S,t[c[A]],l[2],h[A])):A<64?(C=y(r,n,i,o,d,t[a[A]],f[3],u[A]),k=b(v,w,E,x,S,t[c[A]],l[3],h[A])):(C=_(r,n,i,o,d,t[a[A]],f[4],u[A]),k=m(v,w,E,x,S,t[c[A]],l[4],h[A])),r=d,d=o,o=p(i,10),i=n,n=C,v=S,S=x,x=p(E,10),E=w,w=k}var T=this._b+i+x|0;this._b=this._c+o+S|0,this._c=this._d+d+v|0,this._d=this._e+r+w|0,this._e=this._a+n+E|0,this._a=T},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+\" is not supported (we accept pull requests)\");return new r}).sha=r(185),e.sha1=r(186),e.sha224=r(187),e.sha256=r(82),e.sha384=r(188),e.sha512=r(83)},function(t,e,r){\"use strict\";e.utils=r(194),e.Cipher=r(195),e.DES=r(196),e.CBC=r(197),e.EDE=r(198)},function(t,e,r){var n=r(199),i=r(207),o=r(93);e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,r){var n={ECB:r(200),CBC:r(201),CFB:r(202),CFB8:r(203),CFB1:r(204),OFB:r(205),CTR:r(91),GCM:r(91)},i=r(93);for(var o in i)i[o].module=n[i[o].mode];t.exports=i},function(t,e,r){(function(e){var n=r(4),i=r(25);function o(t,r){var i=function(t){var e=s(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(r),o=r.modulus.byteLength(),a=(n.mont(r.modulus),new n(t).mul(i.blinder).umod(r.modulus)),c=a.toRed(n.mont(r.prime1)),u=a.toRed(n.mont(r.prime2)),h=r.coefficient,f=r.prime1,l=r.prime2,d=c.redPow(r.exponent1),p=u.redPow(r.exponent2);d=d.fromRed(),p=p.fromRed();var m=d.isub(p).imul(h).umod(f);return m.imul(l),p.iadd(m),new e(p.imul(i.unblinder).umod(r.modulus).toArray(!1,o))}function s(t){for(var e=t.modulus.byteLength(),r=new n(i(e));r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new n(i(e));return r}t.exports=o,o.getr=s}).call(this,r(3).Buffer)},function(t,e,r){var n=e;n.utils=r(13),n.common=r(32),n.sha=r(223),n.ripemd=r(227),n.hmac=r(228),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(t,e,r){const n=r(20),i={renameColumnTrigger:function(t,e,r,i){const o=n.generateCombinedName(t,\"autoinc_trg\",e);return\"DECLARE PK_NAME VARCHAR(200); IS_AUTOINC NUMBER := 0; BEGIN\"+` EXECUTE IMMEDIATE ('ALTER TABLE \"${e}\" RENAME COLUMN \"${r}\" TO \"${i}\"');`+` SELECT COUNT(*) INTO IS_AUTOINC from \"USER_TRIGGERS\" where trigger_name = '${o}';`+\" IF (IS_AUTOINC > 0) THEN SELECT cols.column_name INTO PK_NAME FROM all_constraints cons, all_cons_columns cols WHERE cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner\"+` AND cols.table_name = '${e}';`+` IF ('${i}' = PK_NAME) THEN`+` EXECUTE IMMEDIATE ('DROP TRIGGER \"${o}\"');`+` EXECUTE IMMEDIATE ('create or replace trigger \"${o}\"`+` BEFORE INSERT on \"${e}\" for each row`+\" declare checking number := 1; begin\"+` if (:new.\"${i}\" is null) then`+\" while checking >= 1 loop\"+` select \"${n.generateCombinedName(t,\"seq\",e)}\".nextval into :new.\"${i}\" from dual;`+` select count(\"${i}\") into checking from \"${e}\"`+` where \"${i}\" = :new.\"${i}\";`+\" end loop; end if; end;'); end if; end if;END;\"},createAutoIncrementTrigger:function(t,e){const r=n.generateCombinedName(t,\"autoinc_trg\",e),i=n.generateCombinedName(t,\"seq\",e);return\"DECLARE PK_NAME VARCHAR(200); BEGIN\"+` EXECUTE IMMEDIATE ('CREATE SEQUENCE \"${i}\"');`+\" SELECT cols.column_name INTO PK_NAME FROM all_constraints cons, all_cons_columns cols WHERE cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner\"+` AND cols.table_name = '${e}';`+` execute immediate ('create or replace trigger \"${r}\"`+` BEFORE INSERT on \"${e}\"`+\" for each row declare checking number := 1; begin if (:new.\\\"' || PK_NAME || '\\\" is null) then while checking >= 1 loop\"+` select \"${i}\".nextval into :new.\"' || PK_NAME || '\" from dual;`+` select count(\"' || PK_NAME || '\") into checking from \"${e}\"`+\" where \\\"' || PK_NAME || '\\\" = :new.\\\"' || PK_NAME || '\\\"; end loop; end if; end;'); END;\"},renameTableAndAutoIncrementTrigger:function(t,e,r){const i=n.generateCombinedName(t,\"autoinc_trg\",e),o=n.generateCombinedName(t,\"seq\",e),s=n.generateCombinedName(t,\"autoinc_trg\",r),a=n.generateCombinedName(t,\"seq\",r);return\"DECLARE PK_NAME VARCHAR(200); IS_AUTOINC NUMBER := 0; BEGIN\"+` EXECUTE IMMEDIATE ('RENAME \"${e}\" TO \"${r}\"');`+` SELECT COUNT(*) INTO IS_AUTOINC from \"USER_TRIGGERS\" where trigger_name = '${i}';`+\" IF (IS_AUTOINC > 0) THEN\"+` EXECUTE IMMEDIATE ('DROP TRIGGER \"${i}\"');`+` EXECUTE IMMEDIATE ('RENAME \"${o}\" TO \"${a}\"');`+\" SELECT cols.column_name INTO PK_NAME FROM all_constraints cons, all_cons_columns cols WHERE cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner\"+` AND cols.table_name = '${r}';`+` EXECUTE IMMEDIATE ('create or replace trigger \"${s}\"`+` BEFORE INSERT on \"${r}\" for each row`+\" declare checking number := 1; begin if (:new.\\\"' || PK_NAME || '\\\" is null) then while checking >= 1 loop\"+` select \"${a}\".nextval into :new.\"' || PK_NAME || '\" from dual;`+` select count(\"' || PK_NAME || '\") into checking from \"${r}\"`+\" where \\\"' || PK_NAME || '\\\" = :new.\\\"' || PK_NAME || '\\\"; end loop; end if; end;'); end if;END;\"}};t.exports=i},function(t,e,r){const n=r(20);function i(t,e){this.columnName=t,this.value=e,this.returning=!1}i.prototype.toString=function(){return\"[object BlobHelper:\"+this.columnName+\"]\"},n.BlobHelper=i,t.exports=n},function(t,e,r){var n=r(126),i=r(127),o=i;o.v1=n,o.v4=i,t.exports=o},function(t,e){var r=\"undefined\"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||\"undefined\"!=typeof msCrypto&&\"function\"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);t.exports=function(t,e){var n=e||0,i=r;return[i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],\"-\",i[t[n++]],i[t[n++]],\"-\",i[t[n++]],i[t[n++]],\"-\",i[t[n++]],i[t[n++]],\"-\",i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]]].join(\"\")}},function(t,e,r){(function(t){var n=void 0!==t&&t||\"undefined\"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r(128),e.setImmediate=\"undefined\"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate=\"undefined\"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(8))},function(t,e,r){\"use strict\";(function(e,n){var i=r(35);t.exports=_;var o,s=r(66);_.ReadableState=y;r(12).EventEmitter;var a=function(t,e){return t.listeners(e).length},c=r(67),u=r(2).Buffer,h=e.Uint8Array||function(){};var f=Object.create(r(28));f.inherits=r(0);var l=r(133),d=void 0;d=l&&l.debuglog?l.debuglog(\"stream\"):function(){};var p,m=r(134),b=r(68);f.inherits(_,c);var g=[\"error\",\"close\",\"destroy\",\"pause\",\"resume\"];function y(t,e){t=t||{};var n=e instanceof(o=o||r(17));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||\"utf8\",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(47).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function _(t){if(o=o||r(17),!(this instanceof _))return new _(t);this._readableState=new y(t,this),this.readable=!0,t&&(\"function\"==typeof t.read&&(this._read=t.read),\"function\"==typeof t.destroy&&(this._destroy=t.destroy)),c.call(this)}function v(t,e,r,n,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,s)):(i||(o=function(t,e){var r;n=e,u.isBuffer(n)||n instanceof h||\"string\"==typeof e||void 0===e||t.objectMode||(r=new TypeError(\"Invalid non-string/buffer chunk\"));var n;return r}(s,e)),o?t.emit(\"error\",o):s.objectMode||e&&e.length>0?(\"string\"==typeof e||s.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n?s.endEmitted?t.emit(\"error\",new Error(\"stream.unshift() after end event\")):w(t,s,e,!0):s.ended?t.emit(\"error\",new Error(\"stream.push() after EOF\")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?w(t,s,e,!1):C(t,s)):w(t,s,e,!1))):n||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d(\"emitReadable\",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){d(\"emit readable\"),t.emit(\"readable\"),M(t)}function C(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(k,t,e))}function k(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(\"\"):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=u.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function I(t){var e=t._readableState;if(e.length>0)throw new Error('\"endReadable()\" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit(\"end\"))}function O(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return d(\"read: emitReadable\",e.length,e.ended),0===e.length&&e.ended?I(this):S(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&I(this),null;var n,i=e.needReadable;return d(\"need readable\",i),(0===e.length||e.length-t0?j(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I(this)),null!==n&&this.emit(\"data\",n),n},_.prototype._read=function(t){this.emit(\"error\",new Error(\"_read() is not implemented\"))},_.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d(\"pipe count=%d opts=%j\",o.pipesCount,e);var c=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?h:_;function u(e,n){d(\"onunpipe\"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d(\"cleanup\"),t.removeListener(\"close\",g),t.removeListener(\"finish\",y),t.removeListener(\"drain\",f),t.removeListener(\"error\",b),t.removeListener(\"unpipe\",u),r.removeListener(\"end\",h),r.removeListener(\"end\",_),r.removeListener(\"data\",m),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){d(\"onend\"),t.end()}o.endEmitted?i.nextTick(c):r.once(\"end\",c),t.on(\"unpipe\",u);var f=function(t){return function(){var e=t._readableState;d(\"pipeOnDrain\",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,\"data\")&&(e.flowing=!0,M(t))}}(r);t.on(\"drain\",f);var l=!1;var p=!1;function m(e){d(\"ondata\"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==O(o.pipes,t))&&!l&&(d(\"false write response, pause\",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function b(e){d(\"onerror\",e),_(),t.removeListener(\"error\",b),0===a(t,\"error\")&&t.emit(\"error\",e)}function g(){t.removeListener(\"finish\",y),_()}function y(){d(\"onfinish\"),t.removeListener(\"close\",g),_()}function _(){d(\"unpipe\"),r.unpipe(t)}return r.on(\"data\",m),function(t,e,r){if(\"function\"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,\"error\",b),t.once(\"close\",g),t.once(\"finish\",y),t.emit(\"pipe\",r),o.flowing||(d(\"pipe resume\"),r.resume()),t},_.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit(\"unpipe\",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o \n * @license MIT\n */\nfunction n(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0;u--)if(h[u]!==f[u])return!1;for(u=h.length-1;u>=0;u--)if(c=h[u],!y(t[c],e[c],r,n))return!1;return!0}(t,e,r,s))}return r?t===e:t==e}function _(t){return\"[object Arguments]\"==Object.prototype.toString.call(t)}function v(t,e){if(!t||!e)return!1;if(\"[object RegExp]\"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if(\"function\"!=typeof e)throw new TypeError('\"block\" argument must be a function');\"string\"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?\" (\"+r.name+\").\":\".\")+(n?\" \"+n:\".\"),t&&!i&&b(i,r,\"Missing expected exception\"+n);var s=\"string\"==typeof n,a=!t&&i&&!r;if((!t&&o.isError(i)&&s&&v(i,r)||a)&&b(i,r,\"Got unwanted exception\"+n),t&&i&&r&&!v(i,r)||!t&&i)throw i}f.AssertionError=function(t){var e;this.name=\"AssertionError\",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=p(m((e=this).actual),128)+\" \"+e.operator+\" \"+p(m(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=d(r),s=i.indexOf(\"\\n\"+o);if(s>=0){var a=i.indexOf(\"\\n\",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(f.AssertionError,Error),f.fail=b,f.ok=g,f.equal=function(t,e,r){t!=e&&b(t,e,r,\"==\",f.equal)},f.notEqual=function(t,e,r){t==e&&b(t,e,r,\"!=\",f.notEqual)},f.deepEqual=function(t,e,r){y(t,e,!1)||b(t,e,r,\"deepEqual\",f.deepEqual)},f.deepStrictEqual=function(t,e,r){y(t,e,!0)||b(t,e,r,\"deepStrictEqual\",f.deepStrictEqual)},f.notDeepEqual=function(t,e,r){y(t,e,!1)&&b(t,e,r,\"notDeepEqual\",f.notDeepEqual)},f.notDeepStrictEqual=function t(e,r,n){y(e,r,!0)&&b(e,r,n,\"notDeepStrictEqual\",t)},f.strictEqual=function(t,e,r){t!==e&&b(t,e,r,\"===\",f.strictEqual)},f.notStrictEqual=function(t,e,r){t===e&&b(t,e,r,\"!==\",f.notStrictEqual)},f.throws=function(t,e,r){w(!0,t,e,r)},f.doesNotThrow=function(t,e,r){w(!1,t,e,r)},f.ifError=function(t){if(t)throw t};var E=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,r(8))},function(t,e,r){const n=r(70);function i(t,e,r){this.schema=r,this.table=t,this.joinType=e,this.and=this,this.clauses=[]}function o(t,e,r,n,i){let o=null;if(\"function\"==typeof r)o={type:\"onWrapped\",value:r,bool:e};else switch(arguments.length){case 3:o={type:\"onRaw\",value:r,bool:e};break;case 4:o={type:t,column:r,operator:\"=\",value:n,bool:e};break;default:o={type:t,column:r,operator:n,value:i,bool:e}}return o}Object.assign(i.prototype,{grouping:\"join\",on(t){if(\"object\"==typeof t&&\"function\"!=typeof t.toSQL){const e=Object.keys(t);let r=-1;const n=\"or\"===this._bool()?\"orOn\":\"on\";for(;++r(e||(e=this.transaction(void 0,t)),e)},initialize(t){return this.client.initializePool(t)},destroy(t){return this.client.destroy(t)},ref(t){return this.client.ref(t)},disableProcessing(){this.userParams.isProcessingDisabled||(this.userParams.wrapIdentifier=this.client.config.wrapIdentifier,this.userParams.postProcessResponse=this.client.config.postProcessResponse,this.client.config.wrapIdentifier=null,this.client.config.postProcessResponse=null,this.userParams.isProcessingDisabled=!0)},enableProcessing(){this.userParams.isProcessingDisabled&&(this.client.config.wrapIdentifier=this.userParams.wrapIdentifier,this.client.config.postProcessResponse=this.userParams.postProcessResponse,this.userParams.isProcessingDisabled=!1)},withUserParams(e){const r=function(t){const e=Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t)),r={},n=((t,e)=>m(r,t,e)).bind(e);return Object.assign(n,t),n._context=r,n}(t);return this.client&&(r.client=Object.create(this.client.constructor.prototype),c(r.client,this.client),r.client.config=Object.assign({},this.client.config)),d(r,r.client),l(\"query\",t,r),l(\"query-error\",t,r),l(\"query-response\",t,r),l(\"start\",t,r),r.userParams=e,r}}),t.context||(t.context=e)}function l(t,e,r){e.listeners(t).forEach(e=>{r.on(t,e)})}function d(t,e){a.forEach(function(e){t[e]=function(){const r=t.queryBuilder();return r[e].apply(r,arguments)}}),Object.defineProperties(t,{context:{get:()=>t._context,set(e){t._context=e,t.raw=e.raw,t.batchInsert=e.batchInsert,t.transaction=e.transaction,t.transactionProvider=e.transactionProvider,t.initialize=e.initialize,t.destroy=e.destroy,t.ref=e.ref,t.withUserParams=e.withUserParams,t.queryBuilder=e.queryBuilder,t.disableProcessing=e.disableProcessing,t.enableProcessing=e.enableProcessing},configurable:!0},client:{get:()=>t.context.client,set(e){t.context.client=e},configurable:!0},userParams:{get:()=>t.context.userParams,set(e){t.context.userParams=e},configurable:!0},schema:{get:()=>t.client.schemaBuilder(),configurable:!0},migrate:{get:()=>new i(t),configurable:!0},seed:{get:()=>new o(t),configurable:!0},fn:{get:()=>new s(t.client),configurable:!0}}),f(t),t.client=e,t.client.makeKnex=h,t.userParams={};const r=new n;for(const e in r)t[e]=r[e];t._internalListeners&&t._internalListeners.forEach(({eventName:e,listener:r})=>{t.client.removeListener(e,r)}),t._internalListeners=[],p(t,\"start\",e=>{t.emit(\"start\",e)}),p(t,\"query\",e=>{t.emit(\"query\",e)}),p(t,\"query-error\",(e,r)=>{t.emit(\"query-error\",e,r)}),p(t,\"query-response\",(e,r,n)=>{t.emit(\"query-response\",e,r,n)})}function p(t,e,r){t.client.on(e,r),t._internalListeners.push({eventName:e,listener:r})}function m(t,e,r){const n=t.queryBuilder();return e||t.client.logger.warn(\"calling knex without a tableName is deprecated. Use knex.queryBuilder() instead.\"),e?n.table(e,r):n}t.exports=h},function(t,e){t.exports=function(){}},function(t,e){t.exports=[\"with\",\"withRecursive\",\"select\",\"as\",\"columns\",\"column\",\"from\",\"fromJS\",\"into\",\"withSchema\",\"table\",\"distinct\",\"join\",\"joinRaw\",\"innerJoin\",\"leftJoin\",\"leftOuterJoin\",\"rightJoin\",\"rightOuterJoin\",\"outerJoin\",\"fullOuterJoin\",\"crossJoin\",\"where\",\"andWhere\",\"orWhere\",\"whereNot\",\"orWhereNot\",\"whereRaw\",\"whereWrapped\",\"havingWrapped\",\"orWhereRaw\",\"whereExists\",\"orWhereExists\",\"whereNotExists\",\"orWhereNotExists\",\"whereIn\",\"orWhereIn\",\"whereNotIn\",\"orWhereNotIn\",\"whereNull\",\"orWhereNull\",\"whereNotNull\",\"orWhereNotNull\",\"whereBetween\",\"whereNotBetween\",\"andWhereBetween\",\"andWhereNotBetween\",\"orWhereBetween\",\"orWhereNotBetween\",\"groupBy\",\"groupByRaw\",\"orderBy\",\"orderByRaw\",\"union\",\"unionAll\",\"intersect\",\"having\",\"havingRaw\",\"orHaving\",\"orHavingRaw\",\"offset\",\"limit\",\"count\",\"countDistinct\",\"min\",\"max\",\"sum\",\"sumDistinct\",\"avg\",\"avgDistinct\",\"increment\",\"decrement\",\"first\",\"debug\",\"pluck\",\"clearSelect\",\"clearWhere\",\"clearOrder\",\"clearHaving\",\"insert\",\"update\",\"returning\",\"del\",\"delete\",\"truncate\",\"transacting\",\"connection\"]},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});e.TimeoutError=class extends Error{}},function(t,e,r){\"use strict\";var n=r(157),i=r(158);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=_(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,u=[\"{\",\"}\",\"|\",\"\\\\\",\"^\",\"`\"].concat([\"<\",\">\",'\"',\"`\",\" \",\"\\r\",\"\\n\",\"\\t\"]),h=[\"'\"].concat(u),f=[\"%\",\"/\",\"?\",\";\",\"#\"].concat(h),l=[\"/\",\"?\",\"#\"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,\"javascript:\":!0},b={javascript:!0,\"javascript:\":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,\"http:\":!0,\"https:\":!0,\"ftp:\":!0,\"gopher:\":!0,\"file:\":!0},y=r(159);function _(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError(\"Parameter 'url' must be a string, not \"+typeof t);var o=t.indexOf(\"?\"),a=-1!==o&&o127?N+=\"x\":N+=I[O];if(!N.match(d)){var q=M.slice(0,k),P=M.slice(k+1),L=I.match(p);L&&(q.push(L[1]),P.unshift(L[2])),P.length&&(_=\"/\"+P.join(\".\")+_),this.hostname=q.join(\".\");break}}}this.hostname.length>255?this.hostname=\"\":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=n.toASCII(this.hostname));var $=this.port?\":\"+this.port:\"\",U=this.hostname||\"\";this.host=U+$,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),\"/\"!==_[0]&&(_=\"/\"+_))}if(!m[E])for(k=0,j=h.length;k0)&&r.host.split(\"@\"))&&(r.auth=R.shift(),r.host=r.hostname=R.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:\"\")+(r.search?r.search:\"\")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path=\"/\"+r.search:r.path=null,r.href=r.format(),r;for(var A=x.slice(-1)[0],C=(r.host||t.host||x.length>1)&&(\".\"===A||\"..\"===A)||\"\"===A,k=0,T=x.length;T>=0;T--)\".\"===(A=x[T])?x.splice(T,1):\"..\"===A?(x.splice(T,1),k++):k&&(x.splice(T,1),k--);if(!w&&!E)for(;k--;k)x.unshift(\"..\");!w||\"\"===x[0]||x[0]&&\"/\"===x[0].charAt(0)||x.unshift(\"\"),C&&\"/\"!==x.join(\"/\").substr(-1)&&x.push(\"\");var R,M=\"\"===x[0]||x[0]&&\"/\"===x[0].charAt(0);S&&(r.hostname=r.host=M?\"\":x.length?x.shift():\"\",(R=!!(r.host&&r.host.indexOf(\"@\")>0)&&r.host.split(\"@\"))&&(r.auth=R.shift(),r.host=r.hostname=R.shift()));return(w=w||r.host&&x.length)&&!M&&x.unshift(\"\"),x.length?r.pathname=x.join(\"/\"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:\"\")+(r.search?r.search:\"\")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(\":\"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,\"loaded\",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,\"id\",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){const n=r(0),{map:i,defer:o}=r(1),{promisify:s}=r(15),a=r(21),c=r(7),u=r(175),h=r(176),f=r(177),l=r(178),d=r(179),{makeEscape:p}=r(37);function m(t){a.call(this,t)}n(m,a),Object.assign(m.prototype,{dialect:\"mysql\",driverName:\"mysql\",_driver:()=>r(180),queryCompiler(){return new h(this,...arguments)},schemaCompiler(){return new f(this,...arguments)},tableCompiler(){return new l(this,...arguments)},columnCompiler(){return new d(this,...arguments)},transaction(){return new u(this,...arguments)},_escapeBinding:p(),wrapIdentifierImpl:t=>\"*\"!==t?`\\`${t.replace(/`/g,\"``\")}\\``:\"*\",acquireRawConnection(){return new c((t,e)=>{const r=this.driver.createConnection(this.connectionSettings);r.on(\"error\",t=>{r.__knex__disposed=t}),r.connect(n=>{if(n)return r.removeAllListeners(),e(n);t(r)})})},async destroyRawConnection(t){try{const e=s(e=>t.end(e));return await e()}catch(e){t.__knex__disposed=e}finally{o(()=>t.removeAllListeners())}},validateConnection:t=>\"connected\"===t.state||\"authenticated\"===t.state,_stream(t,e,r,n){n=n||{};const i=Object.assign({sql:e.sql},e.options);return new c((o,s)=>{r.on(\"error\",s),r.on(\"end\",o);const a=t.query(i,e.bindings).stream(n);a.on(\"error\",t=>{s(t),r.emit(\"error\",t)}),a.pipe(r)})},_query:(t,e)=>(e&&\"string\"!=typeof e||(e={sql:e}),new c(function(r,n){if(!e.sql)return void r();const i=Object.assign({sql:e.sql},e.options);t.query(i,e.bindings,function(t,i,o){if(t)return n(t);e.response=[i,o],r(e)})})),processResponse(t,e){if(null==t)return;const{response:r}=t,{method:n}=t,o=r[0],s=r[1];if(t.output)return t.output.call(e,o,s);switch(n){case\"select\":case\"pluck\":case\"first\":return\"pluck\"===n?i(o,t.pluck):\"first\"===n?o[0]:o;case\"insert\":return[o.insertId];case\"del\":case\"update\":case\"counter\":return o.affectedRows;default:return r}},canCancelQuery:!0,cancelQuery(t){const e=this.acquireConnection();return e.timeout(100).then(e=>this.query(e,{method:\"raw\",sql:\"KILL QUERY ?\",bindings:[t.threadId],options:{}})).finally(()=>{e.then(t=>this.releaseConnection(t))})}}),t.exports=m},function(t,e,r){(function(e){const{map:n,flatten:i,values:o}=r(1),{promisify:s}=r(15),a=r(0),c=r(21),u=r(7),{bufferToString:h}=r(37),f=r(80),l=r(257),d=r(111),p=r(258),m=r(259),b=r(112),g=r(260),{ReturningHelper:y,isConnectionError:_}=r(20);function v(t){c.call(this,t)}a(v,c),Object.assign(v.prototype,{dialect:\"oracle\",driverName:\"oracle\",_driver:()=>r(261),transaction(){return new l(this,...arguments)},formatter(){return new f(this,...arguments)},queryCompiler(){return new d(this,...arguments)},schemaCompiler(){return new p(this,...arguments)},columnBuilder(){return new m(this,...arguments)},columnCompiler(){return new b(this,...arguments)},tableCompiler(){return new g(this,...arguments)},prepBindings(t){return n(t,t=>t instanceof y&&this.driver?new this.driver.OutParam(this.driver.OCCISTRING):\"boolean\"==typeof t?t?1:0:e.isBuffer(t)?h(t):t)},acquireRawConnection(){return new u((t,e)=>{this.driver.connect(this.connectionSettings,(r,n)=>{if(r)return e(r);u.promisifyAll(n),this.connectionSettings.prefetchRowCount&&n.setPrefetchRowCount(this.connectionSettings.prefetchRowCount),t(n)})})},destroyRawConnection:async t=>s(e=>t.close(e))(),database(){return this.connectionSettings.database},positionBindings(t){let e=0;return t.replace(/\\?/g,function(){return`:${e+=1}`})},_stream:(t,e,r,n)=>new u(function(i,o){r.on(\"error\",e=>{_(e)&&(t.__knex__disposed=e),o(e)}),r.on(\"end\",i);const s=t.queryStream(e.sql,e.bindings,n);s.pipe(r),s.on(\"error\",function(t){o(t),r.emit(\"error\",t)})}),_query(t,e){if(!e.sql)throw new Error(\"The query is empty\");return t.executeAsync(e.sql,e.bindings).then(function(r){if(!e.returning)return r;const n=e.outParams.map((t,e)=>r[`returnParam${e||\"\"}`]);return t.executeAsync(e.returningSql,n)}).then(function(t){return e.response=t,e.rowsAffected=t.updateCount,e}).catch(e=>{throw _(e)&&(t.__knex__disposed=e),e})},processResponse(t,e){let{response:r}=t;const{method:s}=t;if(t.output)return t.output.call(e,r);switch(s){case\"select\":case\"pluck\":case\"first\":return\"pluck\"===t.method&&(r=n(r,t.pluck)),\"first\"===t.method?r[0]:r;case\"insert\":case\"del\":case\"update\":case\"counter\":return t.returning?t.returning.length>1||\"*\"===t.returning[0]?r:i(n(r,o)):t.rowsAffected;default:return r}}}),t.exports=v}).call(this,r(3).Buffer)},function(t,e,r){const n=r(29),{ReturningHelper:i}=r(20);t.exports=class extends n{alias(t,e){return t+\" \"+e}parameter(t,e){return t instanceof i&&this.client.driver?t=new this.client.driver.OutParam(this.client.driver.OCCISTRING):\"boolean\"==typeof t&&(t=t?1:0),super.parameter(t,e)}}},function(t,e,r){\"use strict\";var n=r(2).Buffer,i=r(27).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(0)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&\"string\"!=typeof t)throw new TypeError(e+\" must be a string or a buffer\")}(t,\"Data\"),this._finalized)throw new Error(\"Digest already called\");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error(\"_update is not implemented\")},o.prototype.digest=function(t){if(this._finalized)throw new Error(\"Digest already called\");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error(\"_digest is not implemented\")},t.exports=o},function(t,e,r){var n=r(0),i=r(26),o=r(2).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function f(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(c,i),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,c=0|this._e,p=0|this._f,m=0|this._g,b=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+d(r[g-15])+r[g-16];for(var y=0;y<64;++y){var _=b+l(c)+u(c,p,m)+s[y]+r[y]|0,v=f(n)+h(n,i,o)|0;b=m,m=p,p=c,c=a+_|0,a=o,o=i,i=n,n=_+v|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=b+this._h|0},c.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=c},function(t,e,r){var n=r(0),i=r(26),o=r(2).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function c(){this.init(),this._w=a,i.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function f(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0>>0?1:0}n(c,i),c.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},c.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,c=0|this._fh,y=0|this._gh,_=0|this._hh,v=0|this._al,w=0|this._bl,E=0|this._cl,x=0|this._dl,S=0|this._el,A=0|this._fl,C=0|this._gl,k=0|this._hl,T=0;T<32;T+=2)e[T]=t.readInt32BE(4*T),e[T+1]=t.readInt32BE(4*T+4);for(;T<160;T+=2){var R=e[T-30],M=e[T-30+1],j=d(R,M),I=p(M,R),N=m(R=e[T-4],M=e[T-4+1]),O=b(M,R),B=e[T-14],q=e[T-14+1],P=e[T-32],L=e[T-32+1],$=I+q|0,U=j+B+g($,I)|0;U=(U=U+N+g($=$+O|0,O)|0)+P+g($=$+L|0,L)|0,e[T]=U,e[T+1]=$}for(var D=0;D<160;D+=2){U=e[D],$=e[D+1];var F=h(r,n,i),z=h(v,w,E),H=f(r,v),Q=f(v,r),W=l(a,S),K=l(S,a),V=s[D],Y=s[D+1],G=u(a,c,y),X=u(S,A,C),J=k+K|0,Z=_+W+g(J,k)|0;Z=(Z=(Z=Z+G+g(J=J+X|0,X)|0)+V+g(J=J+Y|0,Y)|0)+U+g(J=J+$|0,$)|0;var tt=Q+z|0,et=H+F+g(tt,Q)|0;_=y,k=C,y=c,C=A,c=a,A=S,a=o+Z+g(S=x+J|0,x)|0,o=i,x=E,i=n,E=w,n=r,w=v,r=Z+et+g(v=J+tt|0,J)|0}this._al=this._al+v|0,this._bl=this._bl+w|0,this._cl=this._cl+E|0,this._dl=this._dl+x|0,this._el=this._el+S|0,this._fl=this._fl+A|0,this._gl=this._gl+C|0,this._hl=this._hl+k|0,this._ah=this._ah+r+g(this._al,v)|0,this._bh=this._bh+n+g(this._bl,w)|0,this._ch=this._ch+i+g(this._cl,E)|0,this._dh=this._dh+o+g(this._dl,x)|0,this._eh=this._eh+a+g(this._el,S)|0,this._fh=this._fh+c+g(this._fl,A)|0,this._gh=this._gh+y+g(this._gl,C)|0,this._hh=this._hh+_+g(this._hl,k)|0},c.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=c},function(t,e,r){\"use strict\";var n=r(0),i=r(189),o=r(16),s=r(2).Buffer,a=r(85),c=r(52),u=r(53),h=s.alloc(128);function f(t,e){o.call(this,\"digest\"),\"string\"==typeof e&&(e=s.from(e));var r=\"sha512\"===t||\"sha384\"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=(\"rmd160\"===t?new c:u(t)).update(e).digest():e.lengthr||o!=o)throw new TypeError(\"Bad key length\")}}).call(this,r(3).Buffer)},function(t,e,r){(function(e){var r;e.browser?r=\"utf-8\":r=parseInt(e.version.split(\".\")[0].slice(1),10)>=6?\"utf-8\":\"binary\";t.exports=r}).call(this,r(5))},function(t,e,r){var n=r(85),i=r(52),o=r(53),s=r(88),a=r(89),c=r(2).Buffer,u=c.alloc(128),h={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function f(t,e,r){var s=function(t){return\"rmd160\"===t||\"ripemd160\"===t?function(t){return(new i).update(t).digest()}:\"md5\"===t?n:function(e){return o(t).update(e).digest()}}(t),a=\"sha512\"===t||\"sha384\"===t?128:64;e.length>a?e=s(e):e.lengtht;)r.ishrn(1);if(r.isEven()&&r.iadd(a),r.testn(1)||r.iadd(c),e.cmp(c)){if(!e.cmp(u))for(;r.mod(h).cmp(f);)r.iadd(d)}else for(;r.mod(o).cmp(l);)r.iadd(d);if(b(p=r.shrn(1))&&b(r)&&g(p)&&g(r)&&s.test(p)&&s.test(r))return r}}},function(t,e,r){var n=r(4),i=r(98);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var i=t.bitLength(),o=n.mont(t),s=new n(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),c=0;!a.testn(c);c++);for(var u=t.shrn(c),h=a.toRed(o);e>0;e--){var f=this._randrange(new n(2),a);r&&r(f);var l=f.toRed(o).redPow(u);if(0!==l.cmp(s)&&0!==l.cmp(h)){for(var d=1;d0;e--){var h=this._randrange(new n(2),s),f=t.gcd(h);if(0!==f.cmpn(1))return f;var l=h.toRed(i).redPow(c);if(0!==l.cmp(o)&&0!==l.cmp(u)){for(var d=1;d>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return\"hex\"===e?o(t):t}},function(t,e,r){\"use strict\";var n=r(13).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},function(t,e,r){\"use strict\";var n=r(13),i=r(32),o=r(100),s=r(9),a=n.sum32,c=n.sum32_4,u=n.sum32_5,h=o.ch32,f=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,b=i.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;b.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(y,b),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:a.tag[r]}}function f(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(i>4)return t.error(\"length octect is too long\");n=0;for(var o=0;o=31)return n.error(\"Multi-octet tag encoding unsupported\");e||(i|=32);return i|=a.tagClassByName[r||\"universal\"]<<6}(t,e,r,this.reporter);if(n.length<128)return(o=new i(2))[0]=s,o[1]=n.length,this._createEncoderBuffer([o,n]);for(var c=1,u=n.length;u>=256;u>>=8)c++;(o=new i(2+c))[0]=s,o[1]=128|c;u=1+c;for(var h=n.length;h>0;u--,h>>=8)o[u]=255&h;return this._createEncoderBuffer([o,n])},u.prototype._encodeStr=function(t,e){if(\"bitstr\"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if(\"bmpstr\"===e){for(var r=new i(2*t.length),n=0;n=40)return this.reporter.error(\"Second objid identifier OOB\");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;s>>=7)o++}var a=new i(o),c=a.length-1;for(n=t.length-1;n>=0;n--){s=t[n];for(a[c--]=127&s;(s>>=7)>0;)a[c--]=128|127&s}return this._createEncoderBuffer(a)},u.prototype._encodeTime=function(t,e){var r,n=new Date(t);return\"gentime\"===e?r=[h(n.getFullYear()),h(n.getUTCMonth()+1),h(n.getUTCDate()),h(n.getUTCHours()),h(n.getUTCMinutes()),h(n.getUTCSeconds()),\"Z\"].join(\"\"):\"utctime\"===e?r=[h(n.getFullYear()%100),h(n.getUTCMonth()+1),h(n.getUTCDate()),h(n.getUTCHours()),h(n.getUTCMinutes()),h(n.getUTCSeconds()),\"Z\"].join(\"\"):this.reporter.error(\"Encoding \"+e+\" time is not supported yet\"),this._encodeStr(r,\"octstr\")},u.prototype._encodeNull=function(){return this._createEncoderBuffer(\"\")},u.prototype._encodeInt=function(t,e){if(\"string\"==typeof t){if(!e)return this.reporter.error(\"String int or enum given, but no values map\");if(!e.hasOwnProperty(t))return this.reporter.error(\"Values map doesn't contain: \"+JSON.stringify(t));t=e[t]}if(\"number\"!=typeof t&&!i.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new i(r)}if(i.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new i(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var s=t;s>=256;s>>=8)n++;for(s=(o=new Array(n)).length-1;s>=0;s--)o[s]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return\"function\"==typeof t&&(t=t(e)),t._getEncoder(\"der\").tree},u.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n{let i;const o=c?\"\":this.formatter.parameterize(t,this.client.valueForUndefined),s=Array.isArray(e)?e:[e];let a=`insert into ${this.tableName} `;e&&(i=new d(s.join(\":\")),n.outParams=(n.outParams||[]).concat(i)),a+=c?`(${this.formatter.wrap(this.single.returning)}) values (default)`:`(${this.formatter.columnize(r.columns)}) values (${o})`,a+=e?` returning ROWID into ${this.formatter.parameter(i)}`:\"\",a=this.formatter.client.positionBindings(a);const u=o.replace(\"DEFAULT, \",\"\").replace(\", DEFAULT\",\"\");return`execute immediate '${a.replace(/'/g,\"''\")}`+(u||e?\"' using \":\"\")+u+(u&&e?\", \":\"\")+(e?\"out ?\":\"\")+\";\"}).join(\" \")+\"end;\",e&&(n.returning=e,n.returningSql=`select ${this.formatter.columnize(e)}`+\" from \"+this.tableName+\" where ROWID in (\"+n.outParams.map((t,e)=>`:${e+1}`).join(\", \")+\") order by case ROWID \"+n.outParams.map((t,e)=>`when CHARTOROWID(:${e+1}) then ${e}`).join(\" \")+\" end\"),n},update(){const t=this._prepUpdate(this.single.update),e=this.where();let{returning:r}=this.single;const n=`update ${this.tableName}`+\" set \"+t.join(\", \")+(e?` ${e}`:\"\");return r?(Array.isArray(r)||(r=[r]),this._addReturningToSqlAndConvert(n,r,this.tableName)):n},truncate(){return`truncate table ${this.tableName}`},forUpdate:()=>\"for update\",forShare(){return this.client.logger.warn(\"lock for share is not supported by oracle dialect\"),\"\"},columnInfo(){const t=this.single.columnInfo;return{sql:`select * from xmltable( '/ROWSET/ROW'\\n passing dbms_xmlgen.getXMLType('\\n select char_col_decl_length, column_name, data_type, data_default, nullable\\n from user_tab_columns where table_name = ''${this.client.customWrapIdentifier(this.single.table,h)}'' ')\\n columns\\n CHAR_COL_DECL_LENGTH number, COLUMN_NAME varchar2(200), DATA_TYPE varchar2(106),\\n DATA_DEFAULT clob, NULLABLE varchar2(1))`,output(e){const r=c(e,function(t,e){return t[e.COLUMN_NAME]={type:e.DATA_TYPE,defaultValue:e.DATA_DEFAULT,maxLength:e.CHAR_COL_DECL_LENGTH,nullable:\"Y\"===e.NULLABLE},t},{});return t&&r[t]||r}}},select(){let t=this.with();const e=a(p,t=>this[t]());return t+=u(e).join(\" \"),this._surroundQueryWithLimitAndOffset(t)},aggregate(t){return this._aggregate(t,{aliasSeparator:\" \"})},_addReturningToSqlAndConvert(t,e,r){const n={sql:t};if(!e)return n;const i=Array.isArray(e)?e:[e],o=new d(i.join(\":\"));return n.sql=t+\" returning ROWID into \"+this.formatter.parameter(o),n.returningSql=`select ${this.formatter.columnize(e)} from ${r} where ROWID = :1`,n.outParams=[o],n.returning=e,n},_surroundQueryWithLimitAndOffset(t){let{limit:e}=this.single;const{offset:r}=this.single,n=e||0===e||\"0\"===e;if(e=+e,!n&&!r)return t;if(t=t||\"\",n&&!r)return`select * from (${t}) where rownum <= ${this.formatter.parameter(e)}`;const i=+r+(n?e:1e13);return\"select * from (select row_.*, ROWNUM rownum_ from (\"+t+\") row_ where rownum <= \"+this.formatter.parameter(i)+\") where rownum_ > \"+this.formatter.parameter(r)}}),m.prototype.first=m.prototype.select,t.exports=m},function(t,e,r){const{uniq:n,map:i}=r(1),o=r(0),s=r(14),a=r(24),c=r(59);function u(){a.apply(this,arguments),this.modifiers=[\"defaultTo\",\"checkIn\",\"nullable\",\"comment\"]}o(u,a),Object.assign(u.prototype,{_createAutoIncrementTriggerAndSequence(){this.pushAdditional(function(){const t=this.tableCompiler.tableNameRaw,e=c.createAutoIncrementTrigger(this.client.logger,t);this.pushQuery(e)})},increments(){return this._createAutoIncrementTriggerAndSequence(),\"integer not null primary key\"},bigincrements(){return this._createAutoIncrementTriggerAndSequence(),\"number(20, 0) not null primary key\"},floating(t){const e=this._num(t,0);return`float${e?`(${e})`:\"\"}`},double(t,e){return`number(${this._num(t,8)}, ${this._num(e,2)})`},decimal(t,e){return null===t?\"decimal\":`decimal(${this._num(t,8)}, ${this._num(e,2)})`},integer(t){return t?`number(${this._num(t,11)})`:\"integer\"},tinyint:\"smallint\",smallint:\"smallint\",mediumint:\"integer\",biginteger:\"number(20, 0)\",text:\"clob\",enu(t){const e=((t=n(t))||[]).reduce((t,e)=>Math.max(t,String(e).length),1);return this.columnBuilder._modifiers.checkIn=[t],`varchar2(${e})`},time:\"timestamp with time zone\",datetime:t=>t?\"timestamp\":\"timestamp with time zone\",timestamp:t=>t?\"timestamp\":\"timestamp with time zone\",bit:\"clob\",json:\"clob\",bool(){return this.columnBuilder._modifiers.checkIn=[[0,1]],\"number(1, 0)\"},varchar(t){return`varchar2(${this._num(t,255)})`},comment(t){const e=this.args[0]||this.defaults(\"columnName\");this.pushAdditional(function(){this.pushQuery(`comment on column ${this.tableCompiler.tableName()}.`+this.formatter.wrap(e)+\" is '\"+(t||\"\")+\"'\")},t)},checkIn(t){return void 0===t?\"\":(t=t instanceof s?t.toQuery():Array.isArray(t)?i(t,t=>`'${t}'`).join(\", \"):`'${t}'`,`check (${this.formatter.wrap(this.args[0])} in (${t}))`)}}),t.exports=u},function(t,e){},function(t,e,r){(function(e){const{map:n,extend:i,isString:o}=r(1),{promisify:s}=r(15),a=r(0),c=r(21),u=r(7),h=r(115),f=r(116),l=r(117),d=r(118),{makeEscape:p}=r(37);function m(t){c.apply(this,arguments),t.returning&&(this.defaultReturning=t.returning),t.searchPath&&(this.searchPath=t.searchPath)}a(m,c),Object.assign(m.prototype,{queryCompiler(){return new h(this,...arguments)},columnCompiler(){return new f(this,...arguments)},schemaCompiler(){return new d(this,...arguments)},tableCompiler(){return new l(this,...arguments)},dialect:\"postgresql\",driverName:\"pg\",_driver:()=>r(119),_escapeBinding:p({escapeArray:(t,e)=>e(function t(e,r){let n=\"{\";for(let i=0;i0&&(n+=\",\");const o=e[i];null==o?n+=\"NULL\":Array.isArray(o)?n+=t(o,r):n+=\"number\"==typeof o?o:JSON.stringify(\"string\"==typeof o?o:r(o))}return n+\"}\"}(t,e)),escapeString(t){let e=!1,r=\"'\";for(let n=0;n{i.__knex__disposed=t}),i.on(\"end\",t=>{i.__knex__disposed=t||\"Connection ended unexpectedly\"}),t.version?void e(i):t.checkVersion(i).then(function(r){t.version=r,e(i)}))})}).then(function(e){return t.setSchemaSearchPath(e),e})},destroyRawConnection:async t=>s(e=>t.end(e))(),checkVersion:t=>new u(function(e,r){t.query(\"select version();\",function(t,n){if(t)return r(t);e(/^PostgreSQL (.*?)( |$)/.exec(n.rows[0].version)[1])})}),positionBindings(t){let e=0;return t.replace(/(\\\\*)(\\?)/g,function(t,r){return r.length%2?\"?\":`$${++e}`})},setSchemaSearchPath(t,e){let r=e||this.searchPath;if(!r)return u.resolve(!0);if(!Array.isArray(r)&&!o(r))throw new TypeError(`knex: Expected searchPath to be Array/String, got: ${typeof r}`);if(o(r)){if(r.includes(\",\")){const t=`[${r.split(\",\").map(t=>`'${t}'`).join(\", \")}]`;this.logger.warn(`Detected comma in searchPath \"${r}\".`+`If you are trying to specify multiple schemas, use Array syntax: ${t}`)}r=[r]}return r=r.map(t=>`\"${t}\"`).join(\",\"),new u(function(e,n){t.query(`set search_path to ${r}`,function(t){if(t)return n(t);e(!0)})})},_stream(t,n,i,o){const s=e.browser?void 0:r(266),a=n.sql;return new u(function(e,r){const c=t.query(new s(a,n.bindings,o));c.on(\"error\",function(t){r(t),i.emit(\"error\",t)}),i.on(\"end\",e),c.pipe(i)})},_query(t,e){let r={text:e.sql,values:e.bindings||[]};return e.options&&(r=i(r,e.options)),new u(function(n,i){t.query(r,function(t,r){if(t)return i(t);e.response=r,n(e)})})},processResponse(t,e){const r=t.response;if(t.output)return t.output.call(e,r);if(\"raw\"===t.method)return r;const{returning:i}=t;if(\"SELECT\"===r.command)return\"first\"===t.method?r.rows[0]:\"pluck\"===t.method?n(r.rows,t.pluck):r.rows;if(i){const t=[];for(let e=0,n=r.rows.length;ethis._wrappedCancelQueryCall(e,t).finally(()=>{this.releaseConnection(e)}))},_wrappedCancelQueryCall(t,e){return this.query(t,{method:\"raw\",sql:\"SELECT pg_cancel_backend(?);\",bindings:[e.processID],options:{}})}}),t.exports=m}).call(this,r(5))},function(t,e,r){const n=r(0),i=r(19),{reduce:o,identity:s}=r(1);function a(t,e){i.call(this,t,e)}n(a,i),Object.assign(a.prototype,{truncate(){return`truncate ${this.tableName} restart identity`},_defaultInsertValue:\"default\",insert(){const t=i.prototype.insert.call(this);if(\"\"===t)return t;const{returning:e}=this.single;return{sql:t+this._returning(e),returning:e}},update(){const t=this.with(),e=this._prepUpdate(this.single.update),r=this.where(),{returning:n}=this.single;return{sql:t+`update ${this.single.only?\"only \":\"\"}${this.tableName} `+`set ${e.join(\", \")}`+(r?` ${r}`:\"\")+this._returning(n),returning:n}},del(){const t=i.prototype.del.apply(this,arguments),{returning:e}=this.single;return{sql:t+this._returning(e),returning:e}},aggregate(t){return this._aggregate(t,{distinctParentheses:!0})},_returning(t){return t?` returning ${this.formatter.columnize(t)}`:\"\"},_tableNames(t){const e=this.single.schema,r=[];for(let n=0;n\"skip locked\",noWait:()=>\"nowait\",columnInfo(){const t=this.single.columnInfo;let e=this.single.schema;const r=this.client.customWrapIdentifier(this.single.table,s);e&&(e=this.client.customWrapIdentifier(e,s));let n=\"select * from information_schema.columns where table_name = ? and table_catalog = ?\";const i=[r,this.client.database()];return e?(n+=\" and table_schema = ?\",i.push(e)):n+=\" and table_schema = current_schema()\",{sql:n,bindings:i,output(e){const r=o(e.rows,function(t,e){return t[e.column_name]={type:e.data_type,maxLength:e.character_maximum_length,nullable:\"YES\"===e.is_nullable,defaultValue:e.column_default},t},{});return t&&r[t]||r}}},distinctOn(t){return\"distinct on (\"+this.formatter.columnize(t)+\") \"}}),t.exports=a},function(t,e,r){const n=r(0),i=r(24),{isObject:o}=r(1);function s(){i.apply(this,arguments),this.modifiers=[\"nullable\",\"defaultTo\",\"comment\"]}function a(t,e){return!t.version||parseFloat(t.version)>=9.2?e?\"jsonb\":\"json\":\"text\"}n(s,i),Object.assign(s.prototype,{bigincrements:\"bigserial primary key\",bigint:\"bigint\",binary:\"bytea\",bit:t=>!1!==t.length?`bit(${t.length})`:\"bit\",bool:\"boolean\",enu(t,e){const r=(e=e||{}).useNative&&e.existingType?void 0:t.join(\"', '\");if(e.useNative){let t=\"\";const n=e.schemaName||this.tableCompiler.schemaNameRaw;return n&&(t+=`\"${n}\".`),t+=`\"${e.enumName}\"`,e.existingType||this.tableCompiler.unshiftQuery(`create type ${t} as enum ('${r}')`),t}return`text check (${this.formatter.wrap(this.args[0])} in ('${r}'))`},double:\"double precision\",decimal(t,e){return null===t?\"decimal\":`decimal(${this._num(t,8)}, ${this._num(e,2)})`},floating:\"real\",increments:\"serial primary key\",json(t){return t&&this.client.logger.deprecate(\"json(true)\",\"jsonb()\"),a(this.client,t)},jsonb(){return a(this.client,!0)},smallint:\"smallint\",tinyint:\"smallint\",datetime(t=!1,e){let r;return o(t)?({useTz:r,precision:e}=t):r=!t,`${r?\"timestamptz\":\"timestamp\"}${e?\"(\"+e+\")\":\"\"}`},timestamp(t=!1,e){let r;return o(t)?({useTz:r,precision:e}=t):r=!t,`${r?\"timestamptz\":\"timestamp\"}${e?\"(\"+e+\")\":\"\"}`},uuid:\"uuid\",comment(t){const e=this.args[0]||this.defaults(\"columnName\");this.pushAdditional(function(){this.pushQuery(`comment on column ${this.tableCompiler.tableName()}.`+this.formatter.wrap(e)+\" is \"+(t?`'${t}'`:\"NULL\"))},t)}}),t.exports=s},function(t,e,r){const n=r(0),i=r(23),{has:o}=r(1);function s(){i.apply(this,arguments)}n(s,i),s.prototype.renameColumn=function(t,e){return this.pushQuery({sql:`alter table ${this.tableName()} rename ${this.formatter.wrap(t)} to ${this.formatter.wrap(e)}`})},s.prototype.compileAdd=function(t){const e=this.formatter.wrap(t),r=this.prefixArray(\"add column\",this.getColumns(t));return this.pushQuery({sql:`alter table ${e} ${r.join(\", \")}`})},s.prototype.createQuery=function(t,e){let r=(e?\"create table if not exists \":\"create table \")+this.tableName()+\" (\"+t.sql.join(\", \")+\")\";this.single.inherits&&(r+=` inherits (${this.formatter.wrap(this.single.inherits)})`),this.pushQuery({sql:r,bindings:t.bindings}),o(this.single,\"comment\")&&this.comment(this.single.comment)},s.prototype.addColumns=function(t,e,r){if(e===this.alterColumnsPrefix)for(const t of r){const e=this.tableName(),r=t.getColumnType(),n=this.client.wrapIdentifier(t.getColumnName(),t.columnBuilder.queryContext());this.pushQuery({sql:`alter table ${e} alter column ${n} drop default`,bindings:[]}),this.pushQuery({sql:`alter table ${e} alter column ${n} drop not null`,bindings:[]}),this.pushQuery({sql:`alter table ${e} alter column ${n} type ${r} using (${n}::${r})`,bindings:[]});const i=t.modified.defaultTo;if(i){const r=t.defaultTo.apply(t,i);this.pushQuery({sql:`alter table ${e} alter column ${n} set ${r}`,bindings:[]})}const o=t.modified.nullable;o&&!1===o[0]&&this.pushQuery({sql:`alter table ${e} alter column ${n} set not null`,bindings:[]})}else i.prototype.addColumns.call(this,t,e)},s.prototype.comment=function(t){this.pushQuery(`comment on table ${this.tableName()} is '${this.single.comment}'`)},s.prototype.primary=function(t,e){e=e?this.formatter.wrap(e):this.formatter.wrap(`${this.tableNameRaw}_pkey`),this.pushQuery(`alter table ${this.tableName()} add constraint ${e} primary key (${this.formatter.columnize(t)})`)},s.prototype.unique=function(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} add constraint ${e}`+\" unique (\"+this.formatter.columnize(t)+\")\")},s.prototype.index=function(t,e,r){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`create index ${e} on ${this.tableName()}${r&&` using ${r}`||\"\"}`+\" (\"+this.formatter.columnize(t)+\")\")},s.prototype.dropPrimary=function(t){t=t?this.formatter.wrap(t):this.formatter.wrap(this.tableNameRaw+\"_pkey\"),this.pushQuery(`alter table ${this.tableName()} drop constraint ${t}`)},s.prototype.dropIndex=function(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),e=this.schemaNameRaw?`${this.formatter.wrap(this.schemaNameRaw)}.${e}`:e,this.pushQuery(`drop index ${e}`)},s.prototype.dropUnique=function(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop constraint ${e}`)},s.prototype.dropForeign=function(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"foreign\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop constraint ${e}`)},t.exports=s},function(t,e,r){const n=r(0),i=r(22);function o(){i.apply(this,arguments)}n(o,i),o.prototype.hasTable=function(t){let e=\"select * from information_schema.tables where table_name = ?\";const r=[t];this.schema?(e+=\" and table_schema = ?\",r.push(this.schema)):e+=\" and table_schema = current_schema()\",this.pushQuery({sql:e,bindings:r,output:t=>t.rows.length>0})},o.prototype.hasColumn=function(t,e){let r=\"select * from information_schema.columns where table_name = ? and column_name = ?\";const n=[t,e];this.schema?(r+=\" and table_schema = ?\",n.push(this.schema)):r+=\" and table_schema = current_schema()\",this.pushQuery({sql:r,bindings:n,output:t=>t.rows.length>0})},o.prototype.qualifiedTableName=function(t){const e=this.schema?`${this.schema}.${t}`:t;return this.formatter.wrap(e)},o.prototype.renameTable=function(t,e){this.pushQuery(`alter table ${this.qualifiedTableName(t)} rename to ${this.formatter.wrap(e)}`)},o.prototype.createSchema=function(t){this.pushQuery(`create schema ${this.formatter.wrap(t)}`)},o.prototype.createSchemaIfNotExists=function(t){this.pushQuery(`create schema if not exists ${this.formatter.wrap(t)}`)},o.prototype.dropSchema=function(t){this.pushQuery(`drop schema ${this.formatter.wrap(t)}`)},o.prototype.dropSchemaIfExists=function(t){this.pushQuery(`drop schema if exists ${this.formatter.wrap(t)}`)},o.prototype.dropExtension=function(t){this.pushQuery(`drop extension ${this.formatter.wrap(t)}`)},o.prototype.dropExtensionIfExists=function(t){this.pushQuery(`drop extension if exists ${this.formatter.wrap(t)}`)},o.prototype.createExtension=function(t){this.pushQuery(`create extension ${this.formatter.wrap(t)}`)},o.prototype.createExtensionIfNotExists=function(t){this.pushQuery(`create extension if not exists ${this.formatter.wrap(t)}`)},t.exports=o},function(t,e){t.exports=pg},function(t,e,r){r(121)},function(t,e,r){t.exports=r(122)},function(t,e,r){const n=r(123);t.exports=n},function(t,e,r){const n=r(14),i=r(21),o=r(36),s=r(74),a=r(72),c=r(156),u=r(164),{SUPPORTED_CLIENTS:h}=r(42),{resolveClientNameWithAliases:f}=r(11);function l(t){if(\"string\"==typeof t){return new l(Object.assign(c(t),arguments[2]))}let e;if(0===arguments.length||!t.client&&!t.dialect)e=i;else if(\"function\"==typeof t.client&&t.client.prototype instanceof i)e=t.client;else{const n=t.client||t.dialect;if(!h.includes(n))throw new Error(`knex: Unknown configuration option 'client' value ${n}. Note that it is case-sensitive, check documentation for supported values.`);const i=f(n);e=r(165)(`./${i}/index.js`)}\"string\"==typeof t.connection&&(t=Object.assign({},t,{connection:c(t.connection).connection}));const n=a(new e(t));return t.userParams&&(n.userParams=t.userParams),n}l.Client=i,l.QueryBuilder={extend:function(t,e){o.extend(t,e),s.push(t)}},l.raw=((t,e)=>(console.warn(\"global Knex.raw is deprecated, use knex.raw (chain off an initialized knex object)\"),new n(u).set(t,e))),t.exports=l},function(t,e,r){var n;function i(t){function r(){if(r.enabled){var t=r,i=+new Date,o=i-(n||i);t.diff=o,t.prev=n,t.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a0)return function(t){if((t=String(t)).length>100)return;var e=/^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||\"ms\").toLowerCase()){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return a*s;case\"days\":case\"day\":case\"d\":return a*o;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return a*i;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return a*n;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return a*r;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return a;default:return}}(t);if(\"number\"===u&&!1===isNaN(t))return e.long?a(c=t,o,\"day\")||a(c,i,\"hour\")||a(c,n,\"minute\")||a(c,r,\"second\")||c+\" ms\":function(t){if(t>=o)return Math.round(t/o)+\"d\";if(t>=i)return Math.round(t/i)+\"h\";if(t>=n)return Math.round(t/n)+\"m\";if(t>=r)return Math.round(t/r)+\"s\";return t+\"ms\"}(t);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(t))}},function(t,e,r){var n,i,o=r(62),s=r(63),a=0,c=0;t.exports=function(t,e,r){var u=e&&r||0,h=e||[],f=(t=t||{}).node||n,l=void 0!==t.clockseq?t.clockseq:i;if(null==f||null==l){var d=o();null==f&&(f=n=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=i=16383&(d[6]<<8|d[7]))}var p=void 0!==t.msecs?t.msecs:(new Date).getTime(),m=void 0!==t.nsecs?t.nsecs:c+1,b=p-a+(m-c)/1e4;if(b<0&&void 0===t.clockseq&&(l=l+1&16383),(b<0||p>a)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");a=p,c=m,i=l;var g=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;h[u++]=g>>>24&255,h[u++]=g>>>16&255,h[u++]=g>>>8&255,h[u++]=255&g;var y=p/4294967296*1e4&268435455;h[u++]=y>>>8&255,h[u++]=255&y,h[u++]=y>>>24&15|16,h[u++]=y>>>16&255,h[u++]=l>>>8|128,h[u++]=255&l;for(var _=0;_<6;++_)h[u+_]=f[_];return e||s(h)}},function(t,e,r){var n=r(62),i=r(63);t.exports=function(t,e,r){var o=e&&r||0;\"string\"==typeof t&&(e=\"binary\"===t?new Array(16):null,t=null);var s=(t=t||{}).random||(t.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[o+a]=s[a];return e||i(s)}},function(t,e,r){(function(t,e){!function(t,r){\"use strict\";if(!t.setImmediate){var n,i,o,s,a,c=1,u={},h=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,\"[object process]\"==={}.toString.call(t.process)?n=function(t){e.nextTick(function(){p(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage(\"\",\"*\"),t.onmessage=r,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){o.port2.postMessage(t)}):f&&\"onreadystatechange\"in f.createElement(\"script\")?(i=f.documentElement,n=function(t){var e=f.createElement(\"script\");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(p,0,t)}:(s=\"setImmediate$\"+Math.random()+\"$\",a=function(e){e.source===t&&\"string\"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener(\"message\",a,!1):t.attachEvent(\"onmessage\",a),n=function(e){t.postMessage(s+e,\"*\")}),l.setImmediate=function(t){\"function\"!=typeof t&&(t=new Function(\"\"+t));for(var e=new Array(arguments.length-1),r=0;rthis.client.processResponse(t,i)).then(e=>{const r=this.builder.queryContext(),n=this.client.postProcessResponse(e,r);return this.builder.emit(\"query-response\",n,Object.assign({__knexUid:this.connection.__knexUid},t),this.builder),this.client.emit(\"query-response\",n,Object.assign({__knexUid:this.connection.__knexUid},t),this.builder),n}).catch(n.TimeoutError,e=>{const{timeout:r,sql:i,bindings:o}=t;let s;return t.cancelOnTimeout?s=this.client.cancelQuery(this.connection):(this.connection.__knex__disposed=e,s=n.resolve()),s.catch(t=>{throw this.connection.__knex__disposed=e,Object.assign(t,{message:`After query timeout of ${r}ms exceeded, cancelling of query failed.`,sql:i,bindings:o,timeout:r})}).then(()=>{throw Object.assign(e,{message:`Defined query timeout of ${r}ms exceeded when running query.`,sql:i,bindings:o,timeout:r})})}).catch(e=>{throw this.builder.emit(\"query-error\",e,Object.assign({__knexUid:this.connection.__knexUid},t)),e})},async queryArray(t){if(1===t.length)return this.query(t[0]);const e=[];for(const r of t)e.push(await this.query(r));return e},async ensureConnection(t){return this.builder._connection?t(this.builder._connection):this.connection?t(this.connection):this.client.acquireConnection().catch(n.TimeoutError,t=>{throw this.builder&&(t.sql=this.builder.sql,t.bindings=this.builder.bindings),t}).then(async e=>{try{return await t(e)}finally{await this.client.releaseConnection(this.connection)}})}}),t.exports=o},function(t,e,r){\"use strict\";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=u(t),n=r[0],s=r[1],a=new o(function(t,e,r){return 3*(e+r)/4-r}(0,n,s)),c=0,h=s>0?n-4:n,f=0;f>16&255,a[c++]=e>>8&255,a[c++]=255&e;2===s&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[c++]=255&e);1===s&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[c++]=e>>8&255,a[c++]=255&e);return a},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+\"==\")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+\"=\"));return o.join(\"\")};for(var n=[],i=[],o=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,s=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",a=0,c=s.length;a0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join(\"\")}i[\"-\".charCodeAt(0)]=62,i[\"_\".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,h=-7,f=r?i-1:0,l=r?-1:1,d=t[e+f];for(f+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,h=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+f>=1?l/c:l*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*c-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}},function(t,e){},function(t,e,r){\"use strict\";var n=r(2).Buffer,i=r(135);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return\"\";for(var e=this.head,r=\"\"+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,i=a,e.copy(r,i),a+=s.data.length,s=s.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+\" \"+t})},function(t,e){},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&\"true\"===String(r).toLowerCase()}t.exports=function(t,e){if(r(\"noDeprecation\"))return t;var n=!1;return function(){if(!n){if(r(\"throwDeprecation\"))throw new Error(e);r(\"traceDeprecation\")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(8))},function(t,e,r){\"use strict\";t.exports=o;var n=r(69),i=Object.create(r(28));function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(0),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(46)},function(t,e,r){t.exports=r(17)},function(t,e,r){t.exports=r(45).Transform},function(t,e,r){t.exports=r(45).PassThrough},function(t,e){t.exports=function(t){return t&&\"object\"==typeof t&&\"function\"==typeof t.copy&&\"function\"==typeof t.fill&&\"function\"==typeof t.readUInt8}},function(t,e){t.exports={lockMode:{forShare:\"forShare\",forUpdate:\"forUpdate\"},waitMode:{skipLocked:\"skipLocked\",noWait:\"noWait\"}}},function(t,e){function r(t){this.client=t}r.prototype.now=function(t){return\"number\"==typeof t?this.client.raw(`CURRENT_TIMESTAMP(${t})`):this.client.raw(\"CURRENT_TIMESTAMP\")},t.exports=r},function(t,e,r){const{isNumber:n,chunk:i,flatten:o}=r(1),s=r(146);t.exports=function(t,e,r,a=1e3){let c=void 0,u=null;return Object.assign(Promise.resolve().then(async()=>{if(!n(a)||a<1)throw new TypeError(`Invalid chunkSize: ${a}`);if(!Array.isArray(r))throw new TypeError(`Invalid batch: Expected array, got ${typeof r}`);const h=i(r,a);return await s(1),(e=>u?e(u):t.transaction(e))(async t=>{const r=[];for(const n of h)r.push(await t(e).insert(n,c));return o(r)})}),{returning(t){return c=t,this},transacting(t){return u=t,this}})}},function(t,e,r){const{promisify:n}=r(15);t.exports=n(setTimeout)},function(t,e,r){const n=r(0),{EventEmitter:i}=r(12),{each:o,toArray:s}=r(1),{addQueryContext:a}=r(11),c=r(43);function u(t){this.client=t,this._sequence=[],t.config&&(this._debug=t.config.debug,c(this,4))}n(u,i),o([\"createTable\",\"createTableIfNotExists\",\"createSchema\",\"createSchemaIfNotExists\",\"dropSchema\",\"dropSchemaIfExists\",\"createExtension\",\"createExtensionIfNotExists\",\"dropExtension\",\"dropExtensionIfExists\",\"table\",\"alterTable\",\"hasTable\",\"hasColumn\",\"dropTable\",\"renameTable\",\"dropTableIfExists\",\"raw\"],function(t){u.prototype[t]=function(){return\"createTableIfNotExists\"===t&&this.client.logger.warn([\"Use async .hasTable to check if table exists and then use plain .createTable. Since \",'.createTableIfNotExists actually just generates plain \"CREATE TABLE IF NOT EXIST...\" ',\"query it will not work correctly if there are any alter table queries generated for \",\"columns afterwards. To not break old migrations this function is left untouched for now\",\", but it should not be used when writing new code and it is removed from documentation.\"].join(\"\")),\"table\"===t&&(t=\"alterTable\"),this._sequence.push({method:t,args:s(arguments)}),this}}),r(44)(u),a(u),u.prototype.withSchema=function(t){return this._schema=t,this},u.prototype.toString=function(){return this.toQuery()},u.prototype.toSQL=function(){return this.client.schemaCompiler(this).toSQL()},t.exports=u},function(t,e,r){const{extend:n,each:i,toArray:o,isString:s,isFunction:a}=r(1),c=r(11);function u(t,e,r,n){if(this.client=t,this._fn=n,this._method=e,this._schemaName=void 0,this._tableName=r,this._statements=[],this._single={},!a(this._fn))throw new TypeError(\"A callback function must be supplied to calls against `.createTable` and `.table`\")}u.prototype.setSchema=function(t){this._schemaName=t},u.prototype.toSQL=function(){return\"alter\"===this._method&&n(this,h),this._fn.call(this,this),this.client.tableCompiler(this).toSQL()},i([\"index\",\"primary\",\"unique\",\"dropPrimary\",\"dropUnique\",\"dropIndex\",\"dropForeign\"],function(t){u.prototype[t]=function(){return this._statements.push({grouping:\"alterTable\",method:t,args:o(arguments)}),this}});i({mysql:[\"engine\",\"charset\",\"collate\"],postgresql:[\"inherits\"]},function(t,e){i(t,function(t){u.prototype[t]=function(r){if(this.client.dialect!==e)throw new Error(`Knex only supports ${t} statement with ${e}.`);if(\"alter\"===this._method)throw new Error(`Knex does not support altering the ${t} outside of create `+\"table, please use knex.raw statement.\");this._single[t]=r}})}),c.addQueryContext(u);i([\"tinyint\",\"smallint\",\"mediumint\",\"int\",\"bigint\",\"decimal\",\"float\",\"double\",\"real\",\"bit\",\"boolean\",\"serial\",\"date\",\"datetime\",\"timestamp\",\"time\",\"year\",\"char\",\"varchar\",\"tinytext\",\"tinyText\",\"text\",\"mediumtext\",\"mediumText\",\"longtext\",\"longText\",\"binary\",\"varbinary\",\"tinyblob\",\"tinyBlob\",\"mediumblob\",\"mediumBlob\",\"blob\",\"longblob\",\"longBlob\",\"enum\",\"set\",\"bool\",\"dateTime\",\"increments\",\"bigincrements\",\"bigIncrements\",\"integer\",\"biginteger\",\"bigInteger\",\"string\",\"json\",\"jsonb\",\"uuid\",\"enu\",\"specificType\"],function(t){u.prototype[t]=function(){const e=o(arguments),r=this.client.columnBuilder(this,t,e);return this._statements.push({grouping:\"columns\",builder:r}),r}}),u.prototype.timestamps=function(){const t=!0===arguments[0]?\"timestamp\":\"datetime\",e=this[t](\"created_at\"),r=this[t](\"updated_at\");if(!0===arguments[1]){const t=this.client.raw(\"CURRENT_TIMESTAMP\");e.notNullable().defaultTo(t),r.notNullable().defaultTo(t)}},u.prototype.comment=function(t){if(\"string\"!=typeof t)throw new TypeError(\"Table comment must be string\");this._single.comment=t},u.prototype.foreign=function(t,e){const r={column:t,keyName:e};this._statements.push({grouping:\"alterTable\",method:\"foreign\",args:[r]});let i={references(t){let e;return s(t)&&(e=t.split(\".\")),e&&1!==e.length?(r.inTable=e[0],r.references=e[1],i):(r.references=e?e[0]:t,{on(t){if(\"string\"!=typeof t)throw new TypeError(`Expected tableName to be a string, got: ${typeof t}`);return r.inTable=t,i},inTable(){return this.on.apply(this,arguments)}})},withKeyName:t=>(r.keyName=t,i),onUpdate:t=>(r.onUpdate=t,i),onDelete:t=>(r.onDelete=t,i),_columnBuilder:t=>(n(t,i),i=t,t)};return i};const h={renameColumn(t,e){return this._statements.push({grouping:\"alterTable\",method:\"renameColumn\",args:[t,e]}),this},dropTimestamps(){return this.dropColumns([\"created_at\",\"updated_at\"])}};h.dropColumn=h.dropColumns=function(){return this._statements.push({grouping:\"alterTable\",method:\"dropColumn\",args:o(arguments)}),this},t.exports=u},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});const n=r(150);e.Pool=n.Pool;const i=r(75);e.TimeoutError=i.TimeoutError,t.exports={Pool:n.Pool,TimeoutError:i.TimeoutError}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});const n=r(151),i=r(153),o=r(50),s=r(12);function a(t,e){var r=t.indexOf(e);return-1!==r&&(t.splice(r,1),!0)}e.Pool=class{constructor(t){if(this.destroyed=!1,this.emitter=new s.EventEmitter,!(t=t||{}).create)throw new Error(\"Tarn: opt.create function most be provided\");if(!t.destroy)throw new Error(\"Tarn: opt.destroy function most be provided\");if(\"number\"!=typeof t.min||t.min<0||t.min!==Math.round(t.min))throw new Error(\"Tarn: opt.min must be an integer >= 0\");if(\"number\"!=typeof t.max||t.max<=0||t.max!==Math.round(t.max))throw new Error(\"Tarn: opt.max must be an integer > 0\");if(t.min>t.max)throw new Error(\"Tarn: opt.max is smaller than opt.min\");if(!o.checkOptionalTime(t.acquireTimeoutMillis))throw new Error(\"Tarn: invalid opt.acquireTimeoutMillis \"+JSON.stringify(t.acquireTimeoutMillis));if(!o.checkOptionalTime(t.createTimeoutMillis))throw new Error(\"Tarn: invalid opt.createTimeoutMillis \"+JSON.stringify(t.createTimeoutMillis));if(!o.checkOptionalTime(t.destroyTimeoutMillis))throw new Error(\"Tarn: invalid opt.destroyTimeoutMillis \"+JSON.stringify(t.destroyTimeoutMillis));if(!o.checkOptionalTime(t.idleTimeoutMillis))throw new Error(\"Tarn: invalid opt.idleTimeoutMillis \"+JSON.stringify(t.idleTimeoutMillis));if(!o.checkOptionalTime(t.reapIntervalMillis))throw new Error(\"Tarn: invalid opt.reapIntervalMillis \"+JSON.stringify(t.reapIntervalMillis));if(!o.checkOptionalTime(t.createRetryIntervalMillis))throw new Error(\"Tarn: invalid opt.createRetryIntervalMillis \"+JSON.stringify(t.createRetryIntervalMillis));const e={create:!0,validate:!0,destroy:!0,log:!0,min:!0,max:!0,acquireTimeoutMillis:!0,createTimeoutMillis:!0,destroyTimeoutMillis:!0,idleTimeoutMillis:!0,reapIntervalMillis:!0,createRetryIntervalMillis:!0,propagateCreateError:!0};for(let r of Object.keys(t))if(!e[r])throw new Error(`Tarn: unsupported option opt.${r}`);this.creator=t.create,this.destroyer=t.destroy,this.validate=\"function\"==typeof t.validate?t.validate:()=>!0,this.log=t.log||(()=>{}),this.acquireTimeoutMillis=t.acquireTimeoutMillis||3e4,this.createTimeoutMillis=t.createTimeoutMillis||3e4,this.destroyTimeoutMillis=t.destroyTimeoutMillis||5e3,this.idleTimeoutMillis=t.idleTimeoutMillis||3e4,this.reapIntervalMillis=t.reapIntervalMillis||1e3,this.createRetryIntervalMillis=t.createRetryIntervalMillis||200,this.propagateCreateError=!!t.propagateCreateError,this.min=t.min,this.max=t.max,this.used=[],this.free=[],this.pendingCreates=[],this.pendingAcquires=[],this.pendingDestroys=[],this.destroyed=!1,this.interval=null,this.eventId=1}numUsed(){return this.used.length}numFree(){return this.free.length}numPendingAcquires(){return this.pendingAcquires.length}numPendingCreates(){return this.pendingCreates.length}acquire(){const t=this.eventId++;this._executeEventHandlers(\"acquireRequest\",t);const e=new n.PendingOperation(this.acquireTimeoutMillis);return this.pendingAcquires.push(e),e.promise=e.promise.then(e=>(this._executeEventHandlers(\"acquireSuccess\",t,e),e)).catch(r=>(this._executeEventHandlers(\"acquireFail\",t,r),a(this.pendingAcquires,e),Promise.reject(r))),this._tryAcquireOrCreate(),e}release(t){this._executeEventHandlers(\"release\",t);for(let e=0,r=this.used.length;et+e)}check(){const t=o.now(),e=[],r=this.min-this.used.length,n=this.free.length-r;let i=0;this.free.forEach(r=>{o.duration(t,r.timestamp)>=this.idleTimeoutMillis&&io.reflect(t.promise))).then(()=>Promise.all(this.used.map(t=>o.reflect(t.promise)))).then(()=>Promise.all(this.pendingAcquires.map(t=>(t.abort(),o.reflect(t.promise))))).then(()=>Promise.all(this.free.map(t=>o.reflect(this._destroy(t.resource))))).then(()=>Promise.all(this.pendingDestroys.map(t=>t.promise))).then(()=>{this.free=[],this.pendingAcquires=[]})).then(e=>(this._executeEventHandlers(\"poolDestroySuccess\",t),this.emitter.removeAllListeners(),e))}on(t,e){this.emitter.on(t,e)}removeListener(t,e){this.emitter.removeListener(t,e)}removeAllListeners(t){this.emitter.removeAllListeners(t)}_tryAcquireOrCreate(){this.destroyed||(this._hasFreeResources()?this._doAcquire():this._shouldCreateMoreResources()&&this._doCreate())}_hasFreeResources(){return this.free.length>0}_doAcquire(){let t=!1;for(;this._canAcquire();){const e=this.pendingAcquires[0],r=this.free[this.free.length-1];this._validateResource(r.resource)?(this.pendingAcquires.shift(),this.free.pop(),this.used.push(r.resolve()),this._startReaping(),e.resolve(r.resource)):(this.free.pop(),this._destroy(r.resource),t=!0)}t&&this._tryAcquireOrCreate()}_canAcquire(){return this.free.length>0&&this.pendingAcquires.length>0}_validateResource(t){try{return!!this.validate(t)}catch(t){return this.log(\"Tarn: resource validator threw an exception \"+t.stack,\"warn\"),!1}}_shouldCreateMoreResources(){return this.used.length+this.pendingCreates.length(this._tryAcquireOrCreate(),null)).catch(e=>{this.propagateCreateError&&0!==this.pendingAcquires.length&&this.pendingAcquires[0].reject(e),t.forEach(t=>{t.possibleTimeoutCause=e}),o.delay(this.createRetryIntervalMillis).then(()=>this._tryAcquireOrCreate())})}_create(){const t=this.eventId++;this._executeEventHandlers(\"createRequest\",t);const e=new n.PendingOperation(this.createTimeoutMillis);var r;return this.pendingCreates.push(e),(r=this.creator,new Promise((t,e)=>{const n=(r,n)=>{r?e(r):t(n)};o.tryPromise(()=>r(n)).then(e=>{e&&t(e)}).catch(t=>{e(t)})})).then(r=>(a(this.pendingCreates,e),this.free.push(new i.Resource(r)),e.resolve(r),this._executeEventHandlers(\"createSuccess\",t,r),null)).catch(r=>(a(this.pendingCreates,e),e.reject(r),this._executeEventHandlers(\"createFail\",t,r),null)),e}_destroy(t){const e=this.eventId++;this._executeEventHandlers(\"destroyRequest\",e,t);const r=new n.PendingOperation(this.destroyTimeoutMillis);return Promise.resolve().then(()=>this.destroyer(t)).then(()=>{r.resolve(t)}).catch(t=>{r.reject(t)}),this.pendingDestroys.push(r),r.promise.then(r=>(this._executeEventHandlers(\"destroySuccess\",e,t),r)).catch(r=>this._logDestroyerError(e,t,r)).then(t=>{const e=this.pendingDestroys.findIndex(t=>t===r);return this.pendingDestroys.splice(e,1),t})}_logDestroyerError(t,e,r){this._executeEventHandlers(\"destroyFail\",t,e,r),this.log(\"Tarn: resource destroyer threw an exception \"+r.stack,\"warn\")}_startReaping(){this.interval||(this._executeEventHandlers(\"startReaping\"),this.interval=setInterval(()=>this.check(),this.reapIntervalMillis))}_stopReaping(){null!==this.interval&&(this._executeEventHandlers(\"stopReaping\"),clearInterval(this.interval)),this.interval=null}_executeEventHandlers(t,...e){this.emitter.listeners(t).forEach(r=>{try{r(...e)}catch(e){this.log(`Tarn: event handler \"${t}\" threw an exception ${e.stack}`,\"warn\")}})}}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});const n=r(75),i=r(50);e.PendingOperation=class{constructor(t){var e,r;this.timeoutMillis=t,this.deferred=i.defer(),this.possibleTimeoutCause=null,this.promise=(e=this.deferred.promise,r=t,new Promise((t,i)=>{const o=setTimeout(()=>i(new n.TimeoutError),r);e.then(e=>{clearTimeout(o),t(e)}).catch(t=>{clearTimeout(o),i(t)})})).catch(t=>(t instanceof n.TimeoutError&&(t=this.possibleTimeoutCause?new n.TimeoutError(this.possibleTimeoutCause.message):new n.TimeoutError(\"operation timed out for an unknown reason\")),Promise.reject(t)))}abort(){this.reject(new Error(\"aborted\"))}reject(t){this.deferred.reject(t)}resolve(t){this.deferred.resolve(t)}}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});e.PromiseInspection=class{constructor(t){this._value=t.value,this._error=t.error}value(){return this._value}reason(){return this._error}isRejected(){return!!this._error}isFulfilled(){return!!this._value}}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});const n=r(50);class i{constructor(t){this.resource=t,this.resource=t,this.timestamp=n.now(),this.deferred=n.defer()}get promise(){return this.deferred.promise}resolve(){return this.deferred.resolve(void 0),new i(this.resource)}}e.Resource=i},function(t,e,r){(function(e){const n=r(155),{inspect:i}=r(15),{isFunction:o,isNil:s,isString:a}=r(1);t.exports=class{constructor(t){const{log:{debug:r,warn:n,error:i,deprecate:o,inspectionDepth:a,enableColors:c}={}}=t;var u;this._inspectionDepth=a||5,this._enableColors=s(u=c)?!(!e||!e.stdout)&&e.stdout.isTTY:u,this._debug=r,this._warn=n,this._error=i,this._deprecate=o}_log(t,e,r){if(!s(e)&&!o(e))throw new TypeError(\"Extensions to knex logger must be functions!\");o(e)?e(t):(a(t)||(t=i(t,{depth:this._inspectionDepth,colors:this._enableColors})),console.log(r?r(t):t))}debug(t){this._log(t,this._debug)}warn(t){this._log(t,this._warn,n.yellow)}error(t){this._log(t,this._error,n.red)}deprecate(t,e){const r=`${t} is deprecated, please use ${e}`;this._log(r,this._deprecate,n.yellow)}}}).call(this,r(5))},function(t,e,r){\"use strict\";(function(e){let r=!(\"NO_COLOR\"in e.env)&&\"0\"!==e.env.FORCE_COLOR&&(\"win32\"===e.platform||null!=e.stdout&&e.stdout.isTTY&&e.env.TERM&&\"dumb\"!==e.env.TERM);const n=(t,e,n,i)=>o=>r?t+(~(o+=\"\").indexOf(e,4)?o.replace(n,i):o)+e:o,i=(t,e)=>n(`\u001b[${t}m`,`\u001b[${e}m`,new RegExp(`\\\\x1b\\\\[${e}m`,\"g\"),`\u001b[${t}m`);t.exports={options:Object.defineProperty({},\"enabled\",{get:()=>r,set:t=>r=t}),reset:i(0,0),bold:n(\"\u001b[1m\",\"\u001b[22m\",/\\x1b\\[22m/g,\"\u001b[22m\u001b[1m\"),dim:n(\"\u001b[2m\",\"\u001b[22m\",/\\x1b\\[22m/g,\"\u001b[22m\u001b[2m\"),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49),blackBright:i(90,39),redBright:i(91,39),greenBright:i(92,39),yellowBright:i(93,39),blueBright:i(94,39),magentaBright:i(95,39),cyanBright:i(96,39),whiteBright:i(97,39),bgBlackBright:i(100,49),bgRedBright:i(101,49),bgGreenBright:i(102,49),bgYellowBright:i(103,49),bgBlueBright:i(104,49),bgMagentaBright:i(105,49),bgCyanBright:i(106,49),bgWhiteBright:i(107,49)}}).call(this,r(5))},function(t,e,r){const n=r(76),{parse:i}=r(162),o=i;t.exports=function(t){const e=n.parse(t,!0);let{protocol:r}=e;if(null===r)return{client:\"sqlite3\",connection:{filename:t}};return\":\"===r.slice(-1)&&(r=r.slice(0,-1)),{client:r,connection:[\"postgresql\",\"postgres\"].includes(r)?o(t):function(t){const e={};let r=t.pathname;\"/\"===r[0]&&(r=r.slice(1));e.database=r,t.hostname&&(0===t.protocol.indexOf(\"mssql\")?e.server=t.hostname:e.host=t.hostname);t.port&&(e.port=t.port);if(t.auth){const r=t.auth.indexOf(\":\");-1!==r?(e.user=t.auth.slice(0,r),r= 0x80 (not a basic code point)\",\"invalid-input\":\"Invalid input\"},w=u-h,E=Math.floor,x=String.fromCharCode;function S(t){throw new RangeError(v[t])}function A(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function C(t,e){var r=t.split(\"@\"),n=\"\";return r.length>1&&(n=r[0]+\"@\",t=r[1]),n+A((t=t.replace(_,\".\")).split(\".\"),e).join(\".\")}function k(t){for(var e,r,n=[],i=0,o=t.length;i=55296&&e<=56319&&i65535&&(e+=x((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=x(t)}).join(\"\")}function R(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function M(t,e,r){var n=0;for(t=r?E(t/d):t>>1,t+=E(t/e);t>w*f>>1;n+=u)t=E(t/w);return E(n+(w+1)*t/(t+l))}function j(t){var e,r,n,i,o,s,a,l,d,g,y,_=[],v=t.length,w=0,x=m,A=p;for((r=t.lastIndexOf(b))<0&&(r=0),n=0;n=128&&S(\"not-basic\"),_.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=v&&S(\"invalid-input\"),((l=(y=t.charCodeAt(i++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:u)>=u||l>E((c-w)/s))&&S(\"overflow\"),w+=l*s,!(l<(d=a<=A?h:a>=A+f?f:a-A));a+=u)s>E(c/(g=u-d))&&S(\"overflow\"),s*=g;A=M(w-o,e=_.length+1,0==o),E(w/e)>c-x&&S(\"overflow\"),x+=E(w/e),w%=e,_.splice(w++,0,x)}return T(_)}function I(t){var e,r,n,i,o,s,a,l,d,g,y,_,v,w,A,C=[];for(_=(t=k(t)).length,e=m,r=0,o=p,s=0;s<_;++s)(y=t[s])<128&&C.push(x(y));for(n=i=C.length,i&&C.push(b);n<_;){for(a=c,s=0;s<_;++s)(y=t[s])>=e&&yE((c-r)/(v=n+1))&&S(\"overflow\"),r+=(a-e)*v,e=a,s=0;s<_;++s)if((y=t[s])c&&S(\"overflow\"),y==e){for(l=r,d=u;!(l<(g=d<=o?h:d>=o+f?f:d-o));d+=u)A=l-g,w=u-g,C.push(x(R(g+A%w,0))),l=E(A/w);C.push(x(R(l,0))),o=M(r,v,n==i),r=0,++n}++r,++e}return C.join(\"\")}a={version:\"1.4.1\",ucs2:{decode:k,encode:T},decode:j,encode:I,toASCII:function(t){return C(t,function(t){return y.test(t)?\"xn--\"+I(t):t})},toUnicode:function(t){return C(t,function(t){return g.test(t)?j(t.slice(4).toLowerCase()):t})}},void 0===(i=function(){return a}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(77)(t),r(8))},function(t,e,r){\"use strict\";t.exports={isString:function(t){return\"string\"==typeof t},isObject:function(t){return\"object\"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){\"use strict\";e.decode=e.parse=r(160),e.encode=e.stringify=r(161)},function(t,e,r){\"use strict\";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||\"&\",r=r||\"=\";var s={};if(\"string\"!=typeof t||0===t.length)return s;var a=/\\+/g;t=t.split(e);var c=1e3;o&&\"number\"==typeof o.maxKeys&&(c=o.maxKeys);var u=t.length;c>0&&u>c&&(u=c);for(var h=0;h=0?(f=m.substr(0,b),l=m.substr(b+1)):(f=m,l=\"\"),d=decodeURIComponent(f),p=decodeURIComponent(l),n(s,d)?i(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var i=Array.isArray||function(t){return\"[object Array]\"===Object.prototype.toString.call(t)}},function(t,e,r){\"use strict\";var n=function(t){switch(typeof t){case\"string\":return t;case\"boolean\":return t?\"true\":\"false\";case\"number\":return isFinite(t)?t:\"\";default:return\"\"}};t.exports=function(t,e,r,a){return e=e||\"&\",r=r||\"=\",null===t&&(t=void 0),\"object\"==typeof t?o(s(t),function(s){var a=encodeURIComponent(n(s))+r;return i(t[s])?o(t[s],function(t){return a+encodeURIComponent(n(t))}).join(e):a+encodeURIComponent(n(t[s]))}).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):\"\"};var i=Array.isArray||function(t){return\"[object Array]\"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;nnew n(i,t)};t.exports=i},function(t,e,r){var n={\"./mssql/index.js\":166,\"./mysql/index.js\":78,\"./mysql2/index.js\":181,\"./oracle/index.js\":79,\"./oracledb/index.js\":262,\"./postgres/index.js\":114,\"./redshift/index.js\":267,\"./sqlite3/index.js\":274};function i(t){var e=o(t);return r(e)}function o(t){var e=n[t];if(!(e+1)){var r=new Error(\"Cannot find module '\"+t+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r}return e}i.keys=function(){return Object.keys(n)},i.resolve=o,t.exports=i,i.id=165},function(t,e,r){const{map:n,flatten:i,values:o}=r(1),s=r(0),a=r(21),c=r(7),u=r(29),h=r(167),f=r(168),l=r(169),d=r(170),p=r(171),m=-2147483648,b=2147483647,g=-9007199254740991,y=9007199254740991;function _(t={}){t&&t.connection&&t.connection.host&&(t.connection.server=t.connection.host),this.mssqlPoolSettings={min:1,max:1,idleTimeoutMillis:Number.MAX_SAFE_INTEGER,evictionRunIntervalMillis:0},a.call(this,t)}s(_,a),Object.assign(_.prototype,{dialect:\"mssql\",driverName:\"mssql\",_driver(){const t=r(172),e=r(173),n=r(174),i=r(!function(){var t=new Error(\"Cannot find module 'mssql/package.json'\");throw t.code=\"MODULE_NOT_FOUND\",t}()).version;if(\"4.1.0\"===i)e.ConnectionPool.prototype.release=function(t){this.pool&&this.pool.release(t)},e.ConnectionPool.prototype._poolCreate=function(){return new n.Promise((e,r)=>{const i={userName:this.config.user,password:this.config.password,server:this.config.server,options:Object.assign({},this.config.options),domain:this.config.domain};i.options.database=this.config.database,i.options.port=this.config.port,i.options.connectTimeout=this.config.connectionTimeout||this.config.timeout||15e3,i.options.requestTimeout=null!=this.config.requestTimeout?this.config.requestTimeout:15e3,i.options.tdsVersion=i.options.tdsVersion||\"7_4\",i.options.rowCollectionOnDone=!1,i.options.rowCollectionOnRequestCompletion=!1,i.options.useColumnNames=!1,i.options.appName=i.options.appName||\"node-mssql\",i.options.instanceName&&delete i.options.port,isNaN(i.options.requestTimeout)&&(i.options.requestTimeout=15e3),i.options.requestTimeout===1/0&&(i.options.requestTimeout=0),i.options.requestTimeout<0&&(i.options.requestTimeout=0),this.config.debug&&(i.options.debug={packet:!0,token:!0,data:!0,payload:!0});const o=new t.Connection(i);let s=!1;function a(t){s||(s=!0,r(t))}o.once(\"end\",t=>{a(new n.ConnectionError(\"Connection ended unexpectedly during connecting\"))}),o.once(\"connect\",t=>{if(t)return a(t=new n.ConnectionError(t));!function(t){s||(s=!0,e(t))}(o)}),o.on(\"error\",t=>{\"ESOCKET\"!==t.code?this.emit(\"error\",t):o.hasError=!0}),this.config.debug&&o.on(\"debug\",this.emit.bind(this,\"debug\",o))})};else{const[t]=i.split(\".\");if(t<5)throw new Error(\"This knex version only supports mssql driver versions 4.1.0 and 5.0.0+\")}return e},formatter(){return new v(this,...arguments)},transaction(){return new h(this,...arguments)},queryCompiler(){return new f(this,...arguments)},schemaCompiler(){return new l(this,...arguments)},tableCompiler(){return new d(this,...arguments)},columnCompiler(){return new p(this,...arguments)},wrapIdentifierImpl:t=>\"*\"===t?\"*\":`[${t.replace(/[[\\]']+/g,\"\")}]`,acquireRawConnection(){return new c((t,e)=>{const r=Object.assign({},this.connectionSettings);r.pool=this.mssqlPoolSettings;const n=new this.driver.ConnectionPool(r);n.connect(r=>{if(r)return e(r);n.on(\"error\",t=>{n.__knex__disposed=t}),t(n)})})},validateConnection:t=>!0===t.connected,destroyRawConnection:t=>t.close().catch(t=>{}),positionBindings(t){let e=-1;return t.replace(/\\?/g,function(){return`@p${e+=1}`})},_stream(t,e,r){return e&&\"string\"!=typeof e||(e={sql:e}),new c((n,i)=>{r.on(\"error\",t=>{i(t)}),r.on(\"end\",n);const{sql:o}=e;if(!o)return n();const s=(t.tx_||t).request();if(s.multiple=!0,s.stream=!0,e.bindings)for(let t=0;t{const{sql:o}=e;if(!o)return n();const s=(t.tx_||t).request();if(s.multiple=!0,e.bindings)for(let t=0;t{if(t)return i(t);e.response=r.recordsets[0],n(e)})})},_setReqInput(t,e,r){if(\"number\"==typeof r)if(r%1!=0)t.input(`p${e}`,this.driver.Decimal(38,10),r);else if(rb){if(ry)throw new Error(`Bigint must be safe integer or must be passed as string, saw ${r}`);t.input(`p${e}`,this.driver.BigInt,r)}else t.input(`p${e}`,this.driver.Int,r);else t.input(`p${e}`,r)},processResponse(t,e){if(null==t)return;const{response:r,method:s}=t;if(t.output)return t.output.call(e,r);switch(s){case\"select\":case\"pluck\":case\"first\":return\"pluck\"===s?n(r,t.pluck):\"first\"===s?r[0]:r;case\"insert\":case\"del\":case\"update\":case\"counter\":return t.returning?\"@@rowcount\"===t.returning?r[0][\"\"]:Array.isArray(t.returning)&&t.returning.length>1||\"*\"===t.returning[0]?r:i(n(r,o)):r;default:return r}}});class v extends u{columnizeWithPrefix(t,e){const r=\"string\"==typeof e?[e]:e;let n=\"\",i=-1;for(;++i0&&(n+=\", \"),n+=t+this.wrap(r[i]);return n}}t.exports=_},function(t,e,r){const n=r(7),i=r(18),{isUndefined:o}=r(1),s=r(10)(\"knex:tx\");t.exports=class extends i{begin(t){return s(\"%s: begin\",this.txid),t.tx_.begin().then(this._resolver,this._rejecter)}savepoint(t){return s(\"%s: savepoint at\",this.txid),n.resolve().then(()=>this.query(t,`SAVE TRANSACTION ${this.txid}`))}commit(t,e){return this._completed=!0,s(\"%s: commit\",this.txid),t.tx_.commit().then(()=>this._resolver(e),this._rejecter)}release(t,e){return this._resolver(e)}rollback(t,e){return this._completed=!0,s(\"%s: rolling back\",this.txid),t.tx_.rollback().then(()=>{let t=e;if(o(e)){if(this.doNotRejectOnRollback)return void this._resolver();t=new Error(`Transaction rejected with non-error: ${e}`)}this._rejecter(t)},t=>(e&&(t.originalError=e),this._rejecter(t)))}rollbackTo(t,e){return s(\"%s: rolling backTo\",this.txid),n.resolve().then(()=>this.query(t,`ROLLBACK TRANSACTION ${this.txid}`,2,e)).then(()=>this._rejecter(e))}acquireConnection(t,e){const r=t&&t.connection;return new n((t,e)=>{try{t((this.outerTx?this.outerTx.conn:null)||r||this.client.acquireConnection())}catch(t){e(t)}}).then(t=>(t.__knexTxId=this.txid,this.outerTx||(this.conn=t,t.tx_=t.transaction()),t)).then(async t=>{try{return await e(t)}finally{this.outerTx||(t.tx_&&(this._completed||(s(\"%s: unreleased transaction\",this.txid),t.tx_.rollback()),t.tx_=null),this.conn=null,r?s(\"%s: not releasing external connection\",this.txid):(s(\"%s: releasing connection\",this.txid),this.client.releaseConnection(t)))}})}}},function(t,e,r){const n=r(0),i=r(19),{isEmpty:o,compact:s,identity:a}=r(1);function c(t,e){i.call(this,t,e)}n(c,i);const u=[\"columns\",\"join\",\"lock\",\"where\",\"union\",\"group\",\"having\",\"order\",\"limit\",\"offset\"];Object.assign(c.prototype,{_emptyInsertValue:\"default values\",select(){const t=this.with(),e=u.map(t=>this[t](this));return t+s(e).join(\" \")},insert(){const t=this.single.insert||[];let e=this.with()+`insert into ${this.tableName} `;const{returning:r}=this.single,n=r?this._returning(\"insert\",r)+\" \":\"\";if(Array.isArray(t)){if(0===t.length)return\"\"}else if(\"object\"==typeof t&&o(t))return{sql:e+n+this._emptyInsertValue,returning:r};const i=this._prepInsert(t);if(\"string\"==typeof i)e+=i;else if(i.columns.length){e+=`(${this.formatter.columnize(i.columns)}`,e+=`) ${n}values (`;let t=-1;for(;++t0&&i.push(this.formatter.columnize(e.value))}return 0===i.length&&(i=[\"*\"]),`select ${t}`+(e?e+\" \":\"\")+i.join(\", \")+(this.tableName?` from ${this.tableName}`:\"\")},_returning(t,e){switch(t){case\"update\":case\"insert\":return e?`output ${this.formatter.columnizeWithPrefix(\"inserted.\",e)}`:\"\";case\"del\":return e?`output ${this.formatter.columnizeWithPrefix(\"deleted.\",e)}`:\"\";case\"rowcount\":return e?\";select @@rowcount\":\"\"}},truncate(){return`truncate table ${this.tableName}`},forUpdate:()=>\"with (UPDLOCK)\",forShare:()=>\"with (HOLDLOCK)\",columnInfo(){const t=this.single.columnInfo;let e=this.single.schema;const r=this.client.customWrapIdentifier(this.single.table,a);e&&(e=this.client.customWrapIdentifier(e,a));let n=\"select * from information_schema.columns where table_name = ? and table_catalog = ?\";const i=[r,this.client.database()];return e?(n+=\" and table_schema = ?\",i.push(e)):n+=\" and table_schema = 'dbo'\",{sql:n,bindings:i,output(e){const r=e.reduce(function(t,e){return t[e.COLUMN_NAME]={defaultValue:e.COLUMN_DEFAULT,type:e.DATA_TYPE,maxLength:e.CHARACTER_MAXIMUM_LENGTH,nullable:\"YES\"===e.IS_NULLABLE},t},{});return t&&r[t]||r}}},top(){const t=!this.single.limit&&0!==this.single.limit,e=!this.single.offset;return t||!e?\"\":`top (${this.formatter.parameter(this.single.limit)})`},limit:()=>\"\",offset(){const t=!this.single.limit&&0!==this.single.limit,e=!this.single.offset;if(e)return\"\";let r=`offset ${e?\"0\":this.formatter.parameter(this.single.offset)} rows`;return t||(r+=` fetch next ${this.formatter.parameter(this.single.limit)} rows only`),r}}),t.exports=c},function(t,e,r){const n=r(0),i=r(22);function o(t,e){i.call(this,t,e)}function s(t,e){return t?`${t}.${e}`:e}n(o,i),Object.assign(o.prototype,{dropTablePrefix:\"DROP TABLE \",dropTableIfExists(t){const e=this.formatter.wrap(s(this.schema,t));this.pushQuery(`if object_id('${e}', 'U') is not null DROP TABLE ${e}`)},renameTable(t,e){this.pushQuery(`exec sp_rename ${this.formatter.parameter(s(this.schema,t))}, ${this.formatter.parameter(e)}`)},hasTable(t){const e=\"select object_id from sys.tables \"+`where object_id = object_id(${this.formatter.parameter(this.formatter.wrap(s(this.schema,t)))})`;this.pushQuery({sql:e,output:t=>t.length>0})},hasColumn(t,e){const r=\"select object_id from sys.columns \"+`where name = ${this.formatter.parameter(e)} `+`and object_id = object_id(${this.formatter.parameter(this.formatter.wrap(s(this.schema,t)))})`;this.pushQuery({sql:r,output:t=>t.length>0})}}),t.exports=o},function(t,e,r){const n=r(0),i=r(23),o=r(11);function s(){i.apply(this,arguments)}n(s,i),Object.assign(s.prototype,{createAlterTableMethods:[\"foreign\",\"primary\"],createQuery(t,e){const r=(e?`if object_id('${this.tableName()}', 'U') is null CREATE TABLE `:\"CREATE TABLE \")+this.tableName()+(this._formatting?\" (\\n \":\" (\")+t.sql.join(this._formatting?\",\\n \":\", \")+\")\";if(this.single.comment){const{comment:t}=this.single;t.length>60&&this.client.logger.warn(\"The max length for a table comment is 60 characters\")}this.pushQuery(r)},lowerCase:!1,addColumnsPrefix:\"ADD \",dropColumnPrefix:\"DROP COLUMN \",alterColumnPrefix:\"ALTER COLUMN \",addColumns(t,e){e=e||this.addColumnsPrefix,t.sql.length>0&&this.pushQuery({sql:(this.lowerCase?\"alter table \":\"ALTER TABLE \")+this.tableName()+\" \"+e+t.sql.join(\", \"),bindings:t.bindings})},dropColumn(){const t=this,e=o.normalizeArr.apply(null,arguments),r=(Array.isArray(e)?e:[e]).map(e=>t.formatter.wrap(e));this.pushQuery((this.lowerCase?\"alter table \":\"ALTER TABLE \")+this.tableName()+\" \"+this.dropColumnPrefix+r.join(\", \"))},comment(){},changeType(){},renameColumn(t,e){this.pushQuery(`exec sp_rename ${this.formatter.parameter(this.tableName()+\".\"+t)}, ${this.formatter.parameter(e)}, 'COLUMN'`)},dropFKRefs(t,e){const r=this.client.formatter(this.tableBuilder);return Promise.all(e.map(function(e){const n=r.wrap(e.CONSTRAINT_NAME),i=r.wrap(e.TABLE_NAME);return t.query({sql:`ALTER TABLE ${i} DROP CONSTRAINT ${n}`})}))},createFKRefs(t,e){const r=this.client.formatter(this.tableBuilder);return Promise.all(e.map(function(e){const n=r.wrap(e.TABLE_NAME),i=r.wrap(e.CONSTRAINT_NAME),o=r.columnize(e.COLUMN_NAME),s=r.columnize(e.REFERENCED_COLUMN_NAME),a=r.wrap(e.REFERENCED_TABLE_NAME),c=` ON UPDATE ${e.UPDATE_RULE}`,u=` ON DELETE ${e.DELETE_RULE}`;return t.query({sql:`ALTER TABLE ${n} ADD CONSTRAINT ${i}`+\" FOREIGN KEY (\"+o+\") REFERENCES \"+a+\" (\"+s+\")\"+c+u})}))},index(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`CREATE INDEX ${e} ON ${this.tableName()} (${this.formatter.columnize(t)})`)},primary(t,e){e=e?this.formatter.wrap(e):this.formatter.wrap(`${this.tableNameRaw}_pkey`),this.forCreate?this.pushQuery(`CONSTRAINT ${e} PRIMARY KEY (${this.formatter.columnize(t)})`):this.pushQuery(`ALTER TABLE ${this.tableName()} ADD CONSTRAINT ${e} PRIMARY KEY (${this.formatter.columnize(t)})`)},unique(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),Array.isArray(t)||(t=[t]);const r=t.map(t=>this.formatter.columnize(t)+\" IS NOT NULL\").join(\" AND \");this.pushQuery(`CREATE UNIQUE INDEX ${e} ON ${this.tableName()} (${this.formatter.columnize(t)}) WHERE ${r}`)},dropIndex(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`DROP INDEX ${e} ON ${this.tableName()}`)},dropForeign(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"foreign\",this.tableNameRaw,t),this.pushQuery(`ALTER TABLE ${this.tableName()} DROP CONSTRAINT ${e}`)},dropPrimary(t){t=t?this.formatter.wrap(t):this.formatter.wrap(`${this.tableNameRaw}_pkey`),this.pushQuery(`ALTER TABLE ${this.tableName()} DROP CONSTRAINT ${t}`)},dropUnique(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`DROP INDEX ${e} ON ${this.tableName()}`)}}),t.exports=s},function(t,e,r){const n=r(0),i=r(24);function o(){i.apply(this,arguments),this.modifiers=[\"nullable\",\"defaultTo\",\"first\",\"after\",\"comment\"]}n(o,i),Object.assign(o.prototype,{increments:\"int identity(1,1) not null primary key\",bigincrements:\"bigint identity(1,1) not null primary key\",bigint:\"bigint\",double:(t,e)=>\"float\",floating:(t,e)=>\"float\",integer:()=>\"int\",mediumint:\"int\",smallint:\"smallint\",tinyint:()=>\"tinyint\",varchar(t){return`nvarchar(${this._num(t,255)})`},text:\"nvarchar(max)\",mediumtext:\"nvarchar(max)\",longtext:\"nvarchar(max)\",enu:\"nvarchar(100)\",uuid:\"uniqueidentifier\",datetime:\"datetime2\",timestamp:({useTz:t=!1}={})=>t?\"datetimeoffset\":\"datetime2\",bit(t){return t>1&&this.client.logger.warn(\"Bit field is exactly 1 bit length for MSSQL\"),\"bit\"},binary(t){return t?`varbinary(${this._num(t)})`:\"varbinary(max)\"},bool:\"bit\",first(){return this.client.logger.warn(\"Column first modifier not available for MSSQL\"),\"\"},after(t){return this.client.logger.warn(\"Column after modifier not available for MSSQL\"),\"\"},comment(t){return t&&t.length>255&&this.client.logger.warn(\"Your comment is longer than the max comment length for MSSQL\"),\"\"}}),t.exports=o},function(t,e){},function(t,e){t.exports=mssql},function(t,e){},function(t,e,r){const n=r(18),i=r(10),{isUndefined:o}=r(1),s=i(\"knex:tx\");class a extends n{}Object.assign(a.prototype,{query(t,e,r,n){const i=this,a=this.trxClient.query(t,e).catch(t=>1305===t.errno,()=>{this.trxClient.logger.warn(\"Transaction was implicitly committed, do not mix transactions and DDL with MySQL (#805)\")}).catch(function(t){r=2,n=t,i._completed=!0,s(\"%s error running transaction query\",i.txid)}).then(function(t){if(1===r&&i._resolver(n),2===r){if(o(n)){if(i.doNotRejectOnRollback&&/^ROLLBACK\\b/i.test(e))return void i._resolver();n=new Error(`Transaction rejected with non-error: ${n}`)}i._rejecter(n)}return t});return 1!==r&&2!==r||(i._completed=!0),a}}),t.exports=a},function(t,e,r){const n=r(0),i=r(19),{identity:o}=r(1);function s(t,e){i.call(this,t,e);const{returning:r}=this.single;r&&this.client.logger.warn(\".returning() is not supported by mysql and will not have any effect.\")}n(s,i),Object.assign(s.prototype,{_emptyInsertValue:\"() values ()\",update(){const t=this.join(),e=this._prepUpdate(this.single.update),r=this.where(),n=this.order(),i=this.limit();return`update ${this.tableName}`+(t?` ${t}`:\"\")+\" set \"+e.join(\", \")+(r?` ${r}`:\"\")+(n?` ${n}`:\"\")+(i?` ${i}`:\"\")},forUpdate:()=>\"for update\",forShare:()=>\"lock in share mode\",skipLocked:()=>\"skip locked\",noWait:()=>\"nowait\",columnInfo(){const t=this.single.columnInfo;return{sql:\"select * from information_schema.columns where table_name = ? and table_schema = ?\",bindings:[this.client.customWrapIdentifier(this.single.table,o),this.client.database()],output(e){const r=e.reduce(function(t,e){return t[e.COLUMN_NAME]={defaultValue:e.COLUMN_DEFAULT,type:e.DATA_TYPE,maxLength:e.CHARACTER_MAXIMUM_LENGTH,nullable:\"YES\"===e.IS_NULLABLE},t},{});return t&&r[t]||r}}},limit(){const t=!this.single.limit&&0!==this.single.limit;return t&&!this.single.offset?\"\":`limit ${this.single.offset&&t?\"18446744073709551615\":this.formatter.parameter(this.single.limit)}`}}),t.exports=s},function(t,e,r){const n=r(0),i=r(22),{some:o}=r(1);function s(t,e){i.call(this,t,e)}n(s,i),Object.assign(s.prototype,{renameTable(t,e){this.pushQuery(`rename table ${this.formatter.wrap(t)} to ${this.formatter.wrap(e)}`)},hasTable(t){let e=\"select * from information_schema.tables where table_name = ?\";const r=[t];this.schema?(e+=\" and table_schema = ?\",r.push(this.schema)):e+=\" and table_schema = database()\",this.pushQuery({sql:e,bindings:r,output:function(t){return t.length>0}})},hasColumn(t,e){this.pushQuery({sql:`show columns from ${this.formatter.wrap(t)}`,output(t){return o(t,t=>this.client.wrapIdentifier(t.Field)===this.client.wrapIdentifier(e))}})}}),t.exports=s},function(t,e,r){const n=r(0),i=r(23);function o(){i.apply(this,arguments)}n(o,i),Object.assign(o.prototype,{createQuery(t,e){const r=e?\"create table if not exists \":\"create table \",{client:n}=this;let i={},o=r+this.tableName()+\" (\"+t.sql.join(\", \")+\")\";n.connectionSettings&&(i=n.connectionSettings);const s=this.single.charset||i.charset||\"\",a=this.single.collate||i.collate||\"\",c=this.single.engine||\"\";if(s&&(o+=` default character set ${s}`),a&&(o+=` collate ${a}`),c&&(o+=` engine = ${c}`),this.single.comment){const t=this.single.comment||\"\";t.length>60&&this.client.logger.warn(\"The max length for a table comment is 60 characters\"),o+=` comment = '${t}'`}this.pushQuery(o)},addColumnsPrefix:\"add \",alterColumnsPrefix:\"modify \",dropColumnPrefix:\"drop \",comment(t){this.pushQuery(`alter table ${this.tableName()} comment = '${t}'`)},changeType(){},renameColumn(t,e){const r=this,n=this.tableName(),i=this.formatter.wrap(t)+\" \"+this.formatter.wrap(e);this.pushQuery({sql:`show fields from ${n} where field = `+this.formatter.parameter(t),output(o){const s=o[0],a=this;return r.getFKRefs(a).then(([o])=>new Promise((t,e)=>{try{o.length||t(),t(r.dropFKRefs(a,o))}catch(t){e(t)}}).then(function(){let t=`alter table ${n} change ${i} ${s.Type}`;return\"YES\"!==String(s.Null).toUpperCase()?t+=\" NOT NULL\":t+=\" NULL\",void 0!==s.Default&&null!==s.Default&&(t+=` DEFAULT '${s.Default}'`),a.query({sql:t})}).then(function(){if(o.length)return r.createFKRefs(a,o.map(function(r){return r.REFERENCED_COLUMN_NAME===t&&(r.REFERENCED_COLUMN_NAME=e),r.COLUMN_NAME===t&&(r.COLUMN_NAME=e),r}))}))}})},getFKRefs(t){const e=this.client.formatter(this.tableBuilder),r=\"SELECT KCU.CONSTRAINT_NAME, KCU.TABLE_NAME, KCU.COLUMN_NAME, KCU.REFERENCED_TABLE_NAME, KCU.REFERENCED_COLUMN_NAME, RC.UPDATE_RULE, RC.DELETE_RULE FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC USING(CONSTRAINT_NAME)WHERE KCU.REFERENCED_TABLE_NAME = \"+e.parameter(this.tableNameRaw)+\" AND KCU.CONSTRAINT_SCHEMA = \"+e.parameter(this.client.database())+\" AND RC.CONSTRAINT_SCHEMA = \"+e.parameter(this.client.database());return t.query({sql:r,bindings:e.bindings})},dropFKRefs(t,e){const r=this.client.formatter(this.tableBuilder);return Promise.all(e.map(function(e){const n=r.wrap(e.CONSTRAINT_NAME),i=r.wrap(e.TABLE_NAME);return t.query({sql:`alter table ${i} drop foreign key ${n}`})}))},createFKRefs(t,e){const r=this.client.formatter(this.tableBuilder);return Promise.all(e.map(function(e){const n=r.wrap(e.TABLE_NAME),i=r.wrap(e.CONSTRAINT_NAME),o=r.columnize(e.COLUMN_NAME),s=r.columnize(e.REFERENCED_COLUMN_NAME),a=r.wrap(e.REFERENCED_TABLE_NAME),c=` ON UPDATE ${e.UPDATE_RULE}`,u=` ON DELETE ${e.DELETE_RULE}`;return t.query({sql:`alter table ${n} add constraint ${i} `+\"foreign key (\"+o+\") references \"+a+\" (\"+s+\")\"+c+u})}))},index(t,e,r){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} add${r?` ${r}`:\"\"} index ${e}(${this.formatter.columnize(t)})`)},primary(t,e){e=e?this.formatter.wrap(e):this.formatter.wrap(`${this.tableNameRaw}_pkey`),this.pushQuery(`alter table ${this.tableName()} add primary key ${e}(${this.formatter.columnize(t)})`)},unique(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} add unique ${e}(${this.formatter.columnize(t)})`)},dropIndex(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop index ${e}`)},dropForeign(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"foreign\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop foreign key ${e}`)},dropPrimary(){this.pushQuery(`alter table ${this.tableName()} drop primary key`)},dropUnique(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop index ${e}`)}}),t.exports=o},function(t,e,r){const n=r(0),i=r(24),{isObject:o}=r(1);function s(){i.apply(this,arguments),this.modifiers=[\"unsigned\",\"nullable\",\"defaultTo\",\"comment\",\"collate\",\"first\",\"after\"]}n(s,i),Object.assign(s.prototype,{increments:\"int unsigned not null auto_increment primary key\",bigincrements:\"bigint unsigned not null auto_increment primary key\",bigint:\"bigint\",double(t,e){return t?`double(${this._num(t,8)}, ${this._num(e,2)})`:\"double\"},integer(t){return`int${t=t?`(${this._num(t,11)})`:\"\"}`},mediumint:\"mediumint\",smallint:\"smallint\",tinyint(t){return`tinyint${t=t?`(${this._num(t,1)})`:\"\"}`},text(t){switch(t){case\"medium\":case\"mediumtext\":return\"mediumtext\";case\"long\":case\"longtext\":return\"longtext\";default:return\"text\"}},mediumtext(){return this.text(\"medium\")},longtext(){return this.text(\"long\")},enu:t=>`enum('${t.join(\"', '\")}')`,datetime:t=>(o(t)&&({precision:t}=t),\"number\"==typeof t?`datetime(${t})`:\"datetime\"),timestamp:t=>(o(t)&&({precision:t}=t),\"number\"==typeof t?`timestamp(${t})`:\"timestamp\"),time:t=>(o(t)&&({precision:t}=t),\"number\"==typeof t?`time(${t})`:\"time\"),bit(t){return t?`bit(${this._num(t)})`:\"bit\"},binary(t){return t?`varbinary(${this._num(t)})`:\"blob\"},json:()=>\"json\",jsonb:()=>\"json\",defaultTo(t){if(null==t)return;if((\"json\"===this.type||\"jsonb\"===this.type)&&o(t))return`default ('${JSON.stringify(t)}')`;const e=s.super_.prototype.defaultTo.apply(this,arguments);return\"blob\"!==this.type&&-1===this.type.indexOf(\"text\")?e:\"\"},unsigned:()=>\"unsigned\",comment(t){return t&&t.length>255&&this.client.logger.warn(\"Your comment is longer than the max comment length for MySQL\"),t&&`comment '${t}'`},first:()=>\"first\",after(t){return`after ${this.formatter.wrap(t)}`},collate:t=>t&&`collate '${t}'`}),t.exports=s},function(t,e){t.exports=mysql},function(t,e,r){const n=r(0),i=r(78),o=r(182);function s(t){i.call(this,t)}n(s,i),Object.assign(s.prototype,{driverName:\"mysql2\",transaction(){return new o(this,...arguments)},_driver:()=>r(183),validateConnection:t=>!t._fatalError}),t.exports=s},function(t,e,r){const n=r(18),i=r(10)(\"knex:tx\"),{isUndefined:o}=r(1);class s extends n{}Object.assign(s.prototype,{query(t,e,r,n){const s=this,a=this.trxClient.query(t,e).catch(t=>\"ER_SP_DOES_NOT_EXIST\"===t.code,()=>{this.trxClient.logger.warn(\"Transaction was implicitly committed, do not mix transactions and DDL with MySQL (#805)\")}).catch(function(t){r=2,n=t,s._completed=!0,i(\"%s error running transaction query\",s.txid)}).then(function(t){if(1===r&&s._resolver(n),2===r){if(o(n)){if(s.doNotRejectOnRollback&&/^ROLLBACK\\b/i.test(e))return void s._resolver();n=new Error(`Transaction rejected with non-error: ${n}`)}return s._rejecter(n),t}});return 1!==r&&2!==r||(s._completed=!0),a}}),t.exports=s},function(t,e){t.exports=mysql2},function(t,e,r){\"use strict\";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(25),e.createHash=e.Hash=r(30),e.createHmac=e.Hmac=r(84);var n=r(190),i=Object.keys(n),o=[\"sha1\",\"sha224\",\"sha256\",\"sha384\",\"sha512\",\"md5\",\"rmd160\"].concat(i);e.getHashes=function(){return o};var s=r(87);e.pbkdf2=s.pbkdf2,e.pbkdf2Sync=s.pbkdf2Sync;var a=r(192);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var c=r(209);e.DiffieHellmanGroup=c.DiffieHellmanGroup,e.createDiffieHellmanGroup=c.createDiffieHellmanGroup,e.getDiffieHellman=c.getDiffieHellman,e.createDiffieHellman=c.createDiffieHellman,e.DiffieHellman=c.DiffieHellman;var u=r(214);e.createSign=u.createSign,e.Sign=u.Sign,e.createVerify=u.createVerify,e.Verify=u.Verify,e.createECDH=r(252);var h=r(253);e.publicEncrypt=h.publicEncrypt,e.privateEncrypt=h.privateEncrypt,e.publicDecrypt=h.publicDecrypt,e.privateDecrypt=h.privateDecrypt;var f=r(256);e.randomFill=f.randomFill,e.randomFillSync=f.randomFillSync,e.createCredentials=function(){throw new Error([\"sorry, createCredentials is not implemented yet\",\"we accept pull requests\",\"https://github.com/crypto-browserify/crypto-browserify\"].join(\"\\n\"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){var n=r(0),i=r(26),o=r(2).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,c=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+h(d,i,o,a)+c+r[l]+s[d];c=a,a=o,o=u(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=c},function(t,e,r){var n=r(0),i=r(26),o=r(2).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,i.call(this,64,56)}function u(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function f(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,c=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=u(n)+f(p,i,o,a)+c+r[d]+s[p]|0;c=a,a=o,o=h(i),i=n,n=m}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=c},function(t,e,r){var n=r(0),i=r(82),o=r(26),s=r(2).Buffer,a=new Array(64);function c(){this.init(),this._w=a,o.call(this,64,56)}n(c,i),c.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},c.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=c},function(t,e,r){var n=r(0),i=r(83),o=r(26),s=r(2).Buffer,a=new Array(160);function c(){this.init(),this._w=a,o.call(this,128,112)}n(c,i),c.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},c.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=c},function(t,e,r){\"use strict\";var n=r(0),i=r(2).Buffer,o=r(16),s=i.alloc(128),a=64;function c(t,e){o.call(this,\"digest\"),\"string\"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,n){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}r[n+0]=i>>>0,r[n+1]=o>>>0},e.rip=function(t,e,r,n){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+s&1,i<<=1,i|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.pc1=function(t,e,r,n){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,i){for(var o=0,s=0,a=n.length>>>1,c=0;c>>n[c]&1;for(c=a;c>>n[c]&1;r[i+0]=o>>>0,r[i+1]=s>>>0},e.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(t>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(e>>>18-6*n&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r>>o[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var n=t.toString(2);n.length0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r=\"encrypt\"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=s.r28shl(r,a),i=s.r28shl(i,a),s.pc2(r,i,t.keys,o)}},u.prototype._update=function(t,e,r,n){var i=this._desState,o=s.readUInt32BE(t,e),a=s.readUInt32BE(t,e+4);s.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],\"encrypt\"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],s.writeUInt32BE(r,o,n),s.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,o=l}s.rip(a,o,n,i)},u.prototype._decrypt=function(t,e,r,n,i){for(var o=r,a=e,c=t.keys.length-2;c>=0;c-=2){var u=t.keys[c],h=t.keys[c+1];s.expand(o,t.tmp,0),u^=t.tmp[0],h^=t.tmp[1];var f=s.substitute(u,h),l=o;o=(a^s.permute(f))>>>0,a=l}s.rip(o,a,n,i)}},function(t,e,r){\"use strict\";var n=r(9),i=r(0),o={};function s(t){n.equal(t.length,8,\"Invalid IV length\"),this.iv=new Array(8);for(var e=0;e15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},l.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r>s%8,t._prev=o(t._prev,r?n:i);return a}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i>7;return o}e.encrypt=function(t,e,r){for(var o=e.length,s=n.allocUnsafe(o),a=-1;++a>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}s.prototype.ghash=function(t){for(var e=-1;++e0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},s.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=s},function(t,e,r){var n=r(94),i=r(2).Buffer,o=r(56),s=r(95),a=r(16),c=r(38),u=r(39);function h(t,e,r){a.call(this),this._cache=new f,this._last=void 0,this._cipher=new c.AES(e),this._prev=i.from(r),this._mode=t,this._autopadding=!0}function f(){this.cache=i.allocUnsafe(0)}function l(t,e,r){var a=o[t.toLowerCase()];if(!a)throw new TypeError(\"invalid suite type\");if(\"string\"==typeof r&&(r=i.from(r)),\"GCM\"!==a.mode&&r.length!==a.iv)throw new TypeError(\"invalid iv length \"+r.length);if(\"string\"==typeof e&&(e=i.from(e)),e.length!==a.key/8)throw new TypeError(\"invalid key length \"+e.length);return\"stream\"===a.type?new s(a.module,e,r,!0):\"auth\"===a.type?new n(a.module,e,r,!0):new h(a.module,e,r)}r(0)(h,a),h.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return i.concat(n)},h.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error(\"unable to decrypt data\");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError(\"invalid suite type\");var n=u(e,!1,r.key,r.iv);return l(t,n.key,n.iv)},e.createDecipheriv=l},function(t,e){e[\"des-ecb\"]={key:8,iv:0},e[\"des-cbc\"]=e.des={key:8,iv:8},e[\"des-ede3-cbc\"]=e.des3={key:24,iv:8},e[\"des-ede3\"]={key:24,iv:0},e[\"des-ede-cbc\"]={key:16,iv:8},e[\"des-ede\"]={key:16,iv:0}},function(t,e,r){(function(t){var n=r(96),i=r(212),o=r(213);var s={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(i[e].prime,\"hex\"),n=new t(i[e].gen,\"hex\");return new o(r,n)},e.createDiffieHellman=e.DiffieHellman=function e(r,i,a,c){return t.isBuffer(i)||void 0===s[i]?e(r,\"binary\",i,a):(i=i||\"binary\",c=c||\"binary\",a=a||new t([2]),t.isBuffer(a)||(a=new t(a,c)),\"number\"==typeof r?new o(n(r,a),a,!0):(t.isBuffer(r)||(r=new t(r,i)),new o(r,a,!0)))}}).call(this,r(3).Buffer)},function(t,e){},function(t,e){},function(t){t.exports={modp1:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"},modp2:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"},modp5:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"},modp14:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"},modp15:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"},modp16:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"},modp17:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"},modp18:{gen:\"02\",prime:\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"}}},function(t,e,r){(function(e){var n=r(4),i=new(r(97)),o=new n(24),s=new n(11),a=new n(10),c=new n(3),u=new n(7),h=r(96),f=r(25);function l(t,r){return r=r||\"utf8\",e.isBuffer(t)||(t=new e(t,r)),this._pub=new n(t),this}function d(t,r){return r=r||\"utf8\",e.isBuffer(t)||(t=new e(t,r)),this._priv=new n(t),this}t.exports=m;var p={};function m(t,e,r){this.setGenerator(e),this.__prime=new n(t),this._prime=n.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}function b(t,r){var n=new e(t.toArray());return r?n.toString(r):n}Object.defineProperty(m.prototype,\"verifyError\",{enumerable:!0,get:function(){return\"number\"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString(\"hex\"),n=[r,t.toString(16)].join(\"_\");if(n in p)return p[n];var f,l=0;if(t.isEven()||!h.simpleSieve||!h.fermatTest(t)||!i.test(t))return l+=1,l+=\"02\"===r||\"05\"===r?8:4,p[n]=l,l;switch(i.test(t.shrn(1))||(l+=2),r){case\"02\":t.mod(o).cmp(s)&&(l+=8);break;case\"05\":(f=t.mod(a)).cmp(c)&&f.cmp(u)&&(l+=8);break;default:l+=4}return p[n]=l,l}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new n(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var r=(t=(t=new n(t)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new e(r.toArray()),o=this.getPrime();if(i.length0&&r.ishrn(n),r}function f(t,r,i){var o,s;do{for(o=new e(0);8*o.length=0;){var o;if(i.isOdd()){var s=i.andln(n-1);o=s>(n>>1)-1?(n>>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,c=1;c0||e.cmpn(-i)>0;){var o,s,a,c=t.andln(3)+n&3,u=e.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),o=0==(1&c)?0:3!=(a=t.andln(7)+n&7)&&5!==a||2!==u?c:-c,r[0].push(o),s=0==(1&u)?0:3!=(a=e.andln(7)+i&7)&&5!==a||2!==c?u:-u,r[1].push(s),2*n===o+1&&(n=1-n),2*i===s+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n=\"_\"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return\"string\"==typeof t?n.toArray(t,\"hex\"):t},n.intFromLE=function(t){return new i(t,\"hex\",\"le\")}},function(t,e,r){\"use strict\";var n=r(4),i=r(6).utils,o=i.getNAF,s=i.getJSF,a=i.assert;function c(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error(\"Not implemented\")},c.prototype.validate=function(){throw new Error(\"Not implemented\")},c.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1),i=(1<=c;e--)u=(u<<1)+n[e];s.push(u)}for(var h=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=i;l>0;l--){for(c=0;c=0;u--){for(e=0;u>=0&&0===s[u];u--)e++;if(u>=0&&e++,c=c.dblp(e),u<0)break;var h=s[u];a(0!==h),c=\"affine\"===t.type?h>0?c.mixedAdd(i[h-1>>1]):c.mixedAdd(i[-h-1>>1].neg()):h>0?c.add(i[h-1>>1]):c.add(i[-h-1>>1].neg())}return\"affine\"===t.type?c.toP():c},c.prototype._wnafMulAdd=function(t,e,r,n,i){for(var a=this._wnafT1,c=this._wnafT2,u=this._wnafT3,h=0,f=0;f=1;f-=2){var d=f-1,p=f;if(1===a[d]&&1===a[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=s(r[d],r[p]);h=Math.max(g[0].length,h),u[d]=new Array(h),u[p]=new Array(h);for(var y=0;y=0;f--){for(var x=0;f>=0;){var S=!0;for(y=0;y=0&&x++,w=w.dblp(x),f<0)break;for(y=0;y0?A=c[y][C-1>>1]:C<0&&(A=c[y][-C-1>>1].neg()),w=\"affine\"===A.type?w.mixedAdd(A):w.add(A))}}for(f=0;f=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(s=e,a=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:i},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:c.add(u).neg()}},u.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error(\"invalid point\");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o\":\"\"},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},h.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(f,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),f=n.redMul(u),l=c.redSqr().redIAdd(h).redISub(f).redISub(f),d=c.redMul(f.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),h=r.redMul(c),f=a.redSqr().redIAdd(u).redISub(h).redISub(h),l=a.redMul(h.redISub(f)).redISub(i.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(f,l,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?\"\":\"\"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){\"use strict\";var n=r(40),i=r(4),o=r(0),s=n.base,a=r(6).utils;function c(t){s.call(this,\"mont\",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){s.BasePoint.call(this,t,\"projective\"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(c,s),t.exports=c,c.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},o(u,s.BasePoint),c.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},c.prototype.point=function(t,e){return new u(this,t,e)},c.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray(\"be\",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?\"\":\"\"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error(\"Not supported on Montgomery curve\")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),c=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error(\"Not supported on Montgomery curve\")},u.prototype.jumlAdd=function(){throw new Error(\"Not supported on Montgomery curve\")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){\"use strict\";var n=r(40),i=r(6),o=r(4),s=r(0),a=n.base,c=i.utils.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,a.call(this,\"edwards\",t),this.a=new o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function h(t,e,r,n,i){a.BasePoint.call(this,t,\"projective\"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(e,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(u,a),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(i.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error(\"invalid point\");var c=a.fromRed().isOdd();return(e&&!c||!e&&c)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(i.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error(\"invalid point\");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error(\"invalid point\");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},s(h,a.BasePoint),u.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new h(this,t,e,r,n)},h.fromJSON=function(t,e){return new h(t,e[0],e[1],e[2])},h.prototype.inspect=function(){return this.isInfinity()?\"\":\"\"},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),c=i.redMul(s),u=o.redMul(a),h=i.redMul(a),f=s.redMul(o);return this.curve.point(c,u,f,h)},h.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var s=(u=this.curve._mulA(i)).redAdd(o);if(this.zOne)t=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),e=s.redMul(u.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),c=s.redSub(a).redISub(a);t=n.redSub(i).redISub(o).redMul(c),e=s.redMul(u.redSub(o)),r=s.redMul(c)}}else{var u=i.redAdd(o);a=this.curve._mulC(this.z).redSqr(),c=u.redSub(a).redSub(a);t=this.curve._mulC(n.redISub(u)).redMul(c),e=this.curve._mulC(u).redMul(i.redISub(o)),r=u.redMul(c)}return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(e),u=o.redMul(s),h=a.redMul(c),f=o.redMul(c),l=s.redMul(a);return this.curve.point(u,h,l,f)},h.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),f=n.redMul(c).redMul(h);return this.curve.twisted?(e=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(e=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(f,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},function(t,e,r){\"use strict\";var n,i=e,o=r(58),s=r(6),a=s.utils.assert;function c(t){\"short\"===t.type?this.curve=new s.curve.short(t):\"edwards\"===t.type?this.curve=new s.curve.edwards(t):this.curve=new s.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),\"Invalid curve\"),a(this.g.mul(this.n).isInfinity(),\"Invalid curve, G*N != O\")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new c(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u(\"p192\",{type:\"short\",prime:\"p192\",p:\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff\",a:\"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc\",b:\"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1\",n:\"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831\",hash:o.sha256,gRed:!1,g:[\"188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012\",\"07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811\"]}),u(\"p224\",{type:\"short\",prime:\"p224\",p:\"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001\",a:\"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe\",b:\"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4\",n:\"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d\",hash:o.sha256,gRed:!1,g:[\"b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21\",\"bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34\"]}),u(\"p256\",{type:\"short\",prime:null,p:\"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff\",a:\"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc\",b:\"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b\",n:\"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551\",hash:o.sha256,gRed:!1,g:[\"6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296\",\"4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5\"]}),u(\"p384\",{type:\"short\",prime:null,p:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff\",a:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc\",b:\"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef\",n:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973\",hash:o.sha384,gRed:!1,g:[\"aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7\",\"3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f\"]}),u(\"p521\",{type:\"short\",prime:null,p:\"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff\",a:\"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc\",b:\"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00\",n:\"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409\",hash:o.sha512,gRed:!1,g:[\"000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66\",\"00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650\"]}),u(\"curve25519\",{type:\"mont\",prime:\"p25519\",p:\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",a:\"76d06\",b:\"1\",n:\"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",hash:o.sha256,gRed:!1,g:[\"9\"]}),u(\"ed25519\",{type:\"edwards\",prime:\"p25519\",p:\"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed\",a:\"-1\",c:\"1\",d:\"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3\",n:\"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed\",hash:o.sha256,gRed:!1,g:[\"216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a\",\"6666666666666666666666666666666666666666666666666666666666666658\"]});try{n=r(229)}catch(t){n=void 0}u(\"secp256k1\",{type:\"short\",prime:\"k256\",p:\"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f\",a:\"0\",b:\"7\",n:\"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141\",h:\"1\",hash:o.sha256,beta:\"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee\",lambda:\"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72\",basis:[{a:\"3086d221a7d46bcde86c90e49284eb15\",b:\"-e4437ed6010e88286f547fa90abfe4c3\"},{a:\"114ca50f7a8e2f3f657c1108d9d44cfd8\",b:\"3086d221a7d46bcde86c90e49284eb15\"}],gRed:!1,g:[\"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\",\"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8\",n]})},function(t,e,r){\"use strict\";e.sha1=r(224),e.sha224=r(225),e.sha256=r(101),e.sha384=r(226),e.sha512=r(102)},function(t,e,r){\"use strict\";var n=r(13),i=r(32),o=r(100),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,h=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,h),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e0))return a.iaddn(1),this.keyFromPrivate(a)}},u.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},u.prototype.sign=function(t,e,r,o){\"object\"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray(\"be\",s),u=t.toArray(\"be\",s),h=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||\"utf8\"}),f=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(h.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(f)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),b=m.umod(this.n);if(0!==b.cmpn(0)){var g=d.invm(this.n).mul(b.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(b)?2:0);return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),y^=1),new c({r:b,s:g,recoveryParam:y})}}}}}},u.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new c(e,\"hex\")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),h=u.mul(t).umod(this.n),f=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(h,r.getPublic(),f)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(h,r.getPublic(),f)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},u.prototype.recoverPubKey=function(t,e,r,i){s((3&r)===r,\"The recovery param is more than two bits\"),e=new c(e,i);var o=this.n,a=new n(t),u=e.r,h=e.s,f=1&r,l=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error(\"Unable to find sencond key candinate\");u=l?this.curve.pointFromX(u.add(this.curve.n),f):this.curve.pointFromX(u,f);var d=e.r.invm(o),p=o.sub(a).mul(d).umod(o),m=h.mul(d).umod(o);return this.g.mulAdd(p,u,m)},u.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new c(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error(\"Unable to find valid recovery factor\")}},function(t,e,r){\"use strict\";var n=r(58),i=r(99),o=r(9);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||\"hex\"),r=i.toArray(t.nonce,t.nonceEnc||\"hex\"),n=i.toArray(t.pers,t.persEnc||\"hex\");o(e.length>=this.minEntropy/8,\"Not enough entropy. Minimum is: \"+this.minEntropy+\" bits\"),this._init(e,r,n)}t.exports=s,s.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,\"Not enough entropy. Minimum is: \"+this.minEntropy+\" bits\"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error(\"Reseed is required\");\"string\"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||\"hex\"),this._update(r));for(var o=[];o.length\"}},function(t,e,r){\"use strict\";var n=r(4),i=r(6).utils,o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,\"Signature without r or s\"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function c(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=e.place;o>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;if(c(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=c(t,r),s=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var u=c(t,r);if(t.length!==u+r.place)return!1;var h=t.slice(r.place,u+r.place);return 0===s[0]&&128&s[1]&&(s=s.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new n(s),this.s=new n(h),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var o=n.concat(r),s=[48];return h(s,o.length),s=s.concat(o),i.encode(s,t)}},function(t,e,r){\"use strict\";var n=r(58),i=r(6),o=i.utils,s=o.assert,a=o.parseBytes,c=r(235),u=r(236);function h(t){if(s(\"ed25519\"===t,\"only tested with ed25519 so far\"),!(this instanceof h))return new h(t);t=i.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=h,h.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},h.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=e)throw new Error(\"invalid sig\")}t.exports=function(t,r,c,u,h){var f=o(c);if(\"ec\"===f.type){if(\"ecdsa\"!==u&&\"ecdsa/rsa\"!==u)throw new Error(\"wrong public key type\");return function(t,e,r){var n=s[r.data.algorithm.curve.join(\".\")];if(!n)throw new Error(\"unknown curve \"+r.data.algorithm.curve.join(\".\"));var o=new i(n),a=r.data.subjectPrivateKey.data;return o.verify(e,t,a)}(t,r,f)}if(\"dsa\"===f.type){if(\"dsa\"!==u)throw new Error(\"wrong public key type\");return function(t,e,r){var i=r.data.p,s=r.data.q,c=r.data.g,u=r.data.pub_key,h=o.signature.decode(t,\"der\"),f=h.s,l=h.r;a(f,s),a(l,s);var d=n.mont(i),p=f.invm(s);return 0===c.toRed(d).redPow(new n(e).mul(p).mod(s)).fromRed().mul(u.toRed(d).redPow(l.mul(p).mod(s)).fromRed()).mod(i).mod(s).cmp(l)}(t,r,f)}if(\"rsa\"!==u&&\"ecdsa/rsa\"!==u)throw new Error(\"wrong public key type\");r=e.concat([h,r]);for(var l=f.modulus.byteLength(),d=[1],p=0;r.length+d.length+2r-l-2)throw new Error(\"message too long\");var d=f.alloc(r-n-l-2),p=r-h-1,m=i(h),b=a(f.concat([u,d,f.alloc(1,1),e],p),s(m,p)),g=a(m,s(b,h));return new c(f.concat([f.alloc(1),g,b],r))}(p,e);else if(1===l)d=function(t,e,r){var n,o=e.length,s=t.modulus.byteLength();if(o>s-11)throw new Error(\"message too long\");n=r?f.alloc(s-o-3,255):function(t){var e,r=f.allocUnsafe(t),n=0,o=i(2*t),s=0;for(;n=0)throw new Error(\"data too long for modulus\")}return r?h(d,p):u(d,p)}},function(t,e,r){var n=r(41),i=r(108),o=r(109),s=r(4),a=r(57),c=r(30),u=r(110),h=r(2).Buffer;t.exports=function(t,e,r){var f;f=t.padding?t.padding:r?1:4;var l,d=n(t),p=d.modulus.byteLength();if(e.length>p||new s(e).cmp(d.modulus)>=0)throw new Error(\"decryption error\");l=r?u(new s(e),d):a(e,d);var m=h.alloc(p-l.length);if(l=h.concat([m,l],p),4===f)return function(t,e){var r=t.modulus.byteLength(),n=c(\"sha1\").update(h.alloc(0)).digest(),s=n.length;if(0!==e[0])throw new Error(\"decryption error\");var a=e.slice(1,s+1),u=e.slice(s+1),f=o(a,i(u,s)),l=o(u,i(f,r-s-1));if(function(t,e){t=h.from(t),e=h.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++i=e.length){o++;break}var s=e.slice(2,i-1);(\"0002\"!==n.toString(\"hex\")&&!r||\"0001\"!==n.toString(\"hex\")&&r)&&o++;s.length<8&&o++;if(o)throw new Error(\"decryption error\");return e.slice(i)}(0,l,r);if(3===f)return l;throw new Error(\"unknown padding\")}},function(t,e,r){\"use strict\";(function(t,n){function i(){throw new Error(\"secure random number generation not supported by this browser\\nuse chrome, FireFox or Internet Explorer 11\")}var o=r(2),s=r(25),a=o.Buffer,c=o.kMaxLength,u=t.crypto||t.msCrypto,h=Math.pow(2,32)-1;function f(t,e){if(\"number\"!=typeof t||t!=t)throw new TypeError(\"offset must be a number\");if(t>h||t<0)throw new TypeError(\"offset must be a uint32\");if(t>c||t>e)throw new RangeError(\"offset out of range\")}function l(t,e,r){if(\"number\"!=typeof t||t!=t)throw new TypeError(\"size must be a number\");if(t>h||t<0)throw new TypeError(\"size must be a uint32\");if(t+e>r||t>c)throw new RangeError(\"buffer too small\")}function d(t,e,r,i){if(n.browser){var o=t.buffer,a=new Uint8Array(o,e,r);return u.getRandomValues(a),i?void n.nextTick(function(){i(null,t)}):t}if(!i)return s(r).copy(t,e),t;s(r,function(r,n){if(r)return i(r);n.copy(t,e),i(null,t)})}u&&u.getRandomValues||!n.browser?(e.randomFill=function(e,r,n,i){if(!(a.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array');if(\"function\"==typeof r)i=r,r=0,n=e.length;else if(\"function\"==typeof n)i=n,n=e.length-r;else if(\"function\"!=typeof i)throw new TypeError('\"cb\" argument must be a function');return f(r,e.length),l(n,r,e.length),d(e,r,n,i)},e.randomFillSync=function(e,r,n){void 0===r&&(r=0);if(!(a.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array');f(r,e.length),void 0===n&&(n=e.length-r);return l(n,r,e.length),d(e,r,n)}):(e.randomFill=i,e.randomFillSync=i)}).call(this,r(8),r(5))},function(t,e,r){const n=r(7),i=r(18),{isUndefined:o}=r(1),s=r(10)(\"knex:tx\");t.exports=class extends i{begin(){return n.resolve()}commit(t,e){return this._completed=!0,t.commitAsync().then(()=>e).then(this._resolver,this._rejecter)}release(t,e){return this._resolver(e)}rollback(t,e){return this._completed=!0,s(\"%s: rolling back\",this.txid),t.rollbackAsync().throw(e).catch(t=>{if(o(t)){if(this.doNotRejectOnRollback)return void this._resolver();t=new Error(`Transaction rejected with non-error: ${t}`)}return this._rejecter(t)})}acquireConnection(t,e){const r=t&&t.connection;return new n((t,e)=>{try{t(r||this.client.acquireConnection())}catch(t){e(t)}}).then(t=>(t.__knexTxId=this.txid,t)).then(t=>(this.outerTx||t.setAutoCommit(!1),t)).then(async t=>{try{return await e(t)}finally{s(\"%s: releasing connection\",this.txid),t.setAutoCommit(!0),r?s(\"%s: not releasing external connection\",this.txid):this.client.releaseConnection(t)}})}}},function(t,e,r){const n=r(0),i=r(22),o=r(20),s=r(59);function a(){i.apply(this,arguments)}n(a,i),a.prototype.renameTable=function(t,e){const r=s.renameTableAndAutoIncrementTrigger(this.client.logger,t,e);this.pushQuery(r)},a.prototype.hasTable=function(t){this.pushQuery({sql:\"select TABLE_NAME from USER_TABLES where TABLE_NAME = \"+this.formatter.parameter(t),output:t=>t.length>0})},a.prototype.hasColumn=function(t,e){const r=\"select COLUMN_NAME from USER_TAB_COLUMNS \"+`where TABLE_NAME = ${this.formatter.parameter(t)} `+`and COLUMN_NAME = ${this.formatter.parameter(e)}`;this.pushQuery({sql:r,output:t=>t.length>0})},a.prototype.dropSequenceIfExists=function(t){this.pushQuery(o.wrapSqlWithCatch(`drop sequence ${this.formatter.wrap(t)}`,-2289))},a.prototype._dropRelatedSequenceIfExists=function(t){const e=o.generateCombinedName(this.client.logger,\"seq\",t);this.dropSequenceIfExists(e)},a.prototype.dropTable=function(t){this.pushQuery(`drop table ${this.formatter.wrap(t)}`),this._dropRelatedSequenceIfExists(t)},a.prototype.dropTableIfExists=function(t){this.pushQuery(o.wrapSqlWithCatch(`drop table ${this.formatter.wrap(t)}`,-942)),this._dropRelatedSequenceIfExists(t)},t.exports=a},function(t,e,r){const n=r(0),i=r(49),{toArray:o}=r(1);function s(){i.apply(this,arguments)}n(s,i),s.prototype.checkIn=function(){return this._modifiers.checkIn=o(arguments),this},t.exports=s},function(t,e,r){const n=r(0),i=r(20),o=r(23),s=r(11),a=r(59),{map:c}=r(1);function u(){o.apply(this,arguments)}n(u,o),Object.assign(u.prototype,{addColumns(t,e){if(t.sql.length>0){e=e||this.addColumnsPrefix;const r=c(t.sql,t=>t);let n=`${this.lowerCase?\"alter table \":\"ALTER TABLE \"}${this.tableName()} ${e}`;t.sql.length>1?n+=`(${r.join(\", \")})`:n+=r.join(\", \"),this.pushQuery({sql:n,bindings:t.bindings})}},renameColumn(t,e){const r=this.tableName().slice(1,-1);return this.pushQuery(a.renameColumnTrigger(this.client.logger,r,t,e))},compileAdd(t){const e=this.formatter.wrap(t),r=this.prefixArray(\"add column\",this.getColumns(t));return this.pushQuery({sql:`alter table ${e} ${r.join(\", \")}`})},createQuery(t,e){const r=`create table ${this.tableName()} (${t.sql.join(\", \")})`;this.pushQuery({sql:e?i.wrapSqlWithCatch(r,-955):r,bindings:t.bindings}),this.single.comment&&this.comment(this.single.comment)},comment(t){this.pushQuery(`comment on table ${this.tableName()} is '${t}'`)},addColumnsPrefix:\"add \",alterColumnsPrefix:\"modify \",dropColumn(){const t=s.normalizeArr.apply(null,arguments);this.pushQuery(`alter table ${this.tableName()} drop (${this.formatter.columnize(t)})`)},changeType(){},_indexCommand(t,e,r){return this.formatter.wrap(i.generateCombinedName(this.client.logger,t,e,r))},primary(t,e){e=e?this.formatter.wrap(e):this.formatter.wrap(`${this.tableNameRaw}_pkey`),this.pushQuery(`alter table ${this.tableName()} add constraint ${e} primary key (${this.formatter.columnize(t)})`)},dropPrimary(t){t=t?this.formatter.wrap(t):this.formatter.wrap(this.tableNameRaw+\"_pkey\"),this.pushQuery(`alter table ${this.tableName()} drop constraint ${t}`)},index(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`create index ${e} on ${this.tableName()}`+\" (\"+this.formatter.columnize(t)+\")\")},dropIndex(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"index\",this.tableNameRaw,t),this.pushQuery(`drop index ${e}`)},unique(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} add constraint ${e}`+\" unique (\"+this.formatter.columnize(t)+\")\")},dropUnique(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"unique\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop constraint ${e}`)},dropForeign(t,e){e=e?this.formatter.wrap(e):this._indexCommand(\"foreign\",this.tableNameRaw,t),this.pushQuery(`alter table ${this.tableName()} drop constraint ${e}`)}}),t.exports=u},function(t,e){},function(t,e,r){(function(e,n){const i=r(1),o=r(0),s=r(263),a=r(264),{BlobHelper:c,ReturningHelper:u,isConnectionError:h}=r(60),f=r(7),l=r(27),{promisify:d}=r(15),p=r(265),m=r(79),b=r(80);function g(){m.apply(this,arguments),this.driver&&(e.env.UV_THREADPOOL_SIZE=e.env.UV_THREADPOOL_SIZE||1,e.env.UV_THREADPOOL_SIZE=parseInt(e.env.UV_THREADPOOL_SIZE)+this.driver.poolMax)}o(g,m),g.prototype.driverName=\"oracledb\",g.prototype._driver=function(){const t=this,e=r(113);return t.fetchAsString=[],this.config.fetchAsString&&i.isArray(this.config.fetchAsString)&&this.config.fetchAsString.forEach(function(r){i.isString(r)&&(r=r.toUpperCase(),e[r]&&(\"NUMBER\"!==r&&\"DATE\"!==r&&\"CLOB\"!==r&&this.logger.warn('Only \"date\", \"number\" and \"clob\" are supported for fetchAsString'),t.fetchAsString.push(e[r])))}),e},g.prototype.queryCompiler=function(){return new s(this,...arguments)},g.prototype.columnCompiler=function(){return new a(this,...arguments)},g.prototype.formatter=function(){return new _(this,...arguments)},g.prototype.transaction=function(){return new p(this,...arguments)},g.prototype.prepBindings=function(t){return i.map(t,t=>t instanceof c&&this.driver?{type:this.driver.BLOB,dir:this.driver.BIND_OUT}:t instanceof u&&this.driver?{type:this.driver.STRING,dir:this.driver.BIND_OUT}:\"boolean\"==typeof t?t?1:0:t)},g.prototype.acquireRawConnection=function(){const t=this;return new f(function(e,r){const n=t.connectionSettings.externalAuth?{externalAuth:t.connectionSettings.externalAuth}:{user:t.connectionSettings.user,password:t.connectionSettings.password};n.connectString=t.connectionSettings.connectString||t.connectionSettings.host+\"/\"+t.connectionSettings.database,t.connectionSettings.prefetchRowCount&&(n.prefetchRows=t.connectionSettings.prefetchRowCount),i.isUndefined(t.connectionSettings.stmtCacheSize)||(n.stmtCacheSize=t.connectionSettings.stmtCacheSize),t.driver.fetchAsString=t.fetchAsString,t.driver.getConnection(n,function(n,i){if(n)return r(n);i.commitAsync=function(){return new f((t,e)=>{if(i.isTransaction)return t();this.commit(function(r){if(r)return e(r);t()})})},i.rollbackAsync=function(){return new f((t,e)=>{this.rollback(function(r){if(r)return e(r);t()})})};const o=d(function(e,r,n,o){if((n=n||{}).outFormat=t.driver.OUT_FORMAT_OBJECT||t.driver.OBJECT,!n.outFormat)throw new Error(\"not found oracledb.outFormat constants\");n.resultSet?i.execute(e,r||[],n,function(t,e){if(t)return h(t)&&(i.close().catch(function(t){}),i.__knex__disposed=t),o(t);const r={rows:[],resultSet:e.resultSet},n=function(t,e,i){e.getRows(i,function(s,a){if(s)h(s)&&(t.close().catch(function(t){}),t.__knex__disposed=s),e.close(function(){return o(s)});else{if(0===a.length)return o(null,r);if(a.length>0){if(a.length!==i)return r.rows=r.rows.concat(a),o(null,r);r.rows=r.rows.concat(a),n(t,e,i)}}})};n(i,e.resultSet,100)}):i.execute(e,r||[],n,function(t,e){return t?(h(t)&&(i.close().catch(function(t){}),i.__knex__disposed=t),o(t)):o(null,e)})});i.executeAsync=function(t,e,r){return o(t,e,r).then(async t=>{const e=()=>t.resultSet?d(t.resultSet.close).call(t.resultSet):Promise.resolve(),r=[];if(t.rows&&Array.isArray(t.rows))for(let e=0;e{}),t}return await e(),t})},e(i)})})},g.prototype.destroyRawConnection=function(t){return t.release()},g.prototype._query=function(t,e){if(!e.sql)throw new Error(\"The query is empty\");const r={autoCommit:!1};return\"select\"===e.method&&(r.resultSet=!0),f.resolve(t.executeAsync(e.sql,e.bindings,r)).then(async function(r){let n=i.flatten(r.outBinds);if(e.response=r.rows||[],e.rowsAffected=r.rows?r.rows.rowsAffected:r.rowsAffected,\"raw\"===e.method&&n.length>0)return{response:n};if(\"update\"===e.method){const t=e.rowsAffected.length||e.rowsAffected,r=[],o=[],s=e=>(function(r,i){const s=i*t;o.push(n[e+s])});for(let n=0;n{let o=\"string\"===e?\"\":n.alloc(0);t.on(\"error\",function(t){i(t)}),t.on(\"data\",function(t){\"string\"===e?o+=t:o=n.concat([o,t])}),t.on(\"end\",function(){r(o)})})}(t,i)};class _ extends b{parameter(t){return\"function\"==typeof t?this.outputQuery(this.compileCallback(t),!0):t instanceof c?\"EMPTY_BLOB()\":this.unwrapRaw(t,!0)||\"?\"}}t.exports=g}).call(this,r(5),r(3).Buffer)},function(t,e,r){(function(e){const n=r(1),i=r(0),o=r(111),s=r(60).ReturningHelper,a=r(60).BlobHelper;function c(t,e){o.call(this,t,e)}i(c,o),n.assign(c.prototype,{insert:function(){const t=this,e=this._prepOutbindings(this.single.insert,this.single.returning),r=e.outBinding,i=e.returning,o=e.values;if(Array.isArray(o)&&1===o.length&&n.isEmpty(o[0]))return this._addReturningToSqlAndConvert(\"insert into \"+this.tableName+\" (\"+this.formatter.wrap(this.single.returning)+\") values (default)\",r[0],this.tableName,i);if(n.isEmpty(this.single.insert)&&\"function\"!=typeof this.single.insert)return\"\";const c=this._prepInsert(o),u={};if(n.isString(c))return this._addReturningToSqlAndConvert(\"insert into \"+this.tableName+\" \"+c,r[0],this.tableName,i);if(1===c.values.length)return this._addReturningToSqlAndConvert(\"insert into \"+this.tableName+\" (\"+this.formatter.columnize(c.columns)+\") values (\"+this.formatter.parameterize(c.values[0])+\")\",r[0],this.tableName,i);const h=0===c.columns.length;return u.returning=i,u.sql=\"begin \"+n.map(c.values,function(e,i){const o=h?\"\":t.formatter.parameterize(e,t.client.valueForUndefined);let u=\"insert into \"+t.tableName;u+=h?\" (\"+t.formatter.wrap(t.single.returning)+\") values (default)\":\" (\"+t.formatter.columnize(c.columns)+\") values (\"+o+\")\";let f=\"\",l=\"\",d=\"\",p=\"\";n.each(e,function(t){t instanceof a||(d+=\" ?,\")}),d=d.slice(0,-1),n.each(r[i],function(e){const r=e.columnName||e;if(f+=t.formatter.wrap(r)+\",\",l+=\" ?,\",p+=\" out ?,\",e instanceof a)return t.formatter.bindings.push(e);t.formatter.bindings.push(new s(r))}),f=f.slice(0,-1),l=l.slice(0,-1),p=p.slice(0,-1),f&&l&&(u+=\" returning \"+f+\" into\"+l),u=t.formatter.client.positionBindings(u);const m=o.replace(\"DEFAULT, \",\"\").replace(\", DEFAULT\",\"\").replace(\"EMPTY_BLOB(), \",\"\").replace(\", EMPTY_BLOB()\",\"\");return\"execute immediate '\"+u.replace(/'/g,\"''\")+(m||e?\"' using \":\"\")+m+(m&&p?\",\":\"\")+p+\";\"}).join(\" \")+\"end;\",u.outBinding=r,\"*\"===i[0]&&(u.returningSql=function(){return\"select * from \"+t.tableName+\" where ROWID in (\"+this.outBinding.map(function(t,e){return\":\"+(e+1)}).join(\", \")+\") order by case ROWID \"+this.outBinding.map(function(t,e){return\"when CHARTOROWID(:\"+(e+1)+\") then \"+e}).join(\" \")+\" end\"}),u},_addReturningToSqlAndConvert:function(t,e,r,i){const o=this,c={sql:t};if(!e)return c;const u=Array.isArray(e)?e:[e];let h=\"\",f=\"\";return n.each(u,function(t){const e=t.columnName||t;if(h+=o.formatter.wrap(e)+\",\",f+=\"?,\",t instanceof a)return o.formatter.bindings.push(t);o.formatter.bindings.push(new s(e))}),c.sql=t,h=h.slice(0,-1),f=f.slice(0,-1),h&&f&&(c.sql+=\" returning \"+h+\" into \"+f),c.outBinding=[e],\"*\"===i[0]&&(c.returningSql=function(){return\"select * from \"+o.tableName+\" where ROWID = :1\"}),c.returning=i,c},_prepOutbindings:function(t,r){const i={};let o=t||[],s=r||[];!Array.isArray(o)&&n.isPlainObject(t)&&(o=[o]),s&&!Array.isArray(s)&&(s=[s]);const c=[];return n.each(o,function(t,r){\"*\"===s[0]?c[r]=[\"ROWID\"]:c[r]=n.clone(s),n.each(t,function(i,s){if(i instanceof e){t[s]=new a(s,i);const e=c[r].indexOf(s);e>=0&&(c[r].splice(e,1),t[s].returning=!0),c[r].push(t[s])}n.isUndefined(i)&&delete o[r][s]})}),i.returning=s,i.outBinding=c,i.values=o,i},update:function(){const t=this,e={},r=this._prepOutbindings(this.single.update||this.single.counter,this.single.returning),i=r.outBinding,o=r.returning,c=this._prepUpdate(this.single.update),u=this.where();let h=\"\",f=\"\";return n.isEmpty(c)&&\"function\"!=typeof this.single.update?\"\":(n.each(i,function(e){n.each(e,function(e){const r=e.columnName||e;if(h+=t.formatter.wrap(r)+\",\",f+=\" ?,\",e instanceof a)return t.formatter.bindings.push(e);t.formatter.bindings.push(new s(r))})}),h=h.slice(0,-1),f=f.slice(0,-1),e.outBinding=i,e.returning=o,e.sql=\"update \"+this.tableName+\" set \"+c.join(\", \")+(u?\" \"+u:\"\"),i.length&&!n.isEmpty(i[0])&&(e.sql+=\" returning \"+h+\" into\"+f),\"*\"===o[0]&&(e.returningSql=function(){let e=\"select * from \"+t.tableName;const r=this.rowsAffected.length||this.rowsAffected;let n=\" where ROWID in (\",i=\") order by case ROWID \";for(let t=0;te).then(this._resolver,this._rejecter)}release(t,e){return this._resolver(e)}rollback(t,e){const r=this;return this._completed=!0,s(\"%s: rolling back\",this.txid),t.rollbackAsync().timeout(5e3).catch(i.TimeoutError,function(t){r._rejecter(t)}).then(function(){if(n(e)){if(r.doNotRejectOnRollback)return void r._resolver();e=new Error(`Transaction rejected with non-error: ${e}`)}r._rejecter(e)})}savepoint(t){return this.query(t,`SAVEPOINT ${this.txid}`)}acquireConnection(t,e){const r=t&&t.connection,n=this;return new i((t,e)=>{try{this.client.acquireConnection().then(e=>{e.__knexTxId=this.txid,e.isTransaction=!0,t(e)}).catch(e)}catch(t){e(t)}}).then(async t=>{try{return await e(t)}finally{s(\"%s: releasing connection\",this.txid),t.isTransaction=!1;try{await t.commitAsync()}catch(t){n._rejecter(t)}finally{r?s(\"%s: not releasing external connection\",n.txid):await n.client.releaseConnection(t)}}})}}},function(t,e){},function(t,e,r){const n=r(0),i=r(114),{map:o}=r(1),s=r(268),a=r(269),c=r(270),u=r(271),h=r(272),f=r(273);function l(t){i.apply(this,arguments)}n(l,i),Object.assign(l.prototype,{transaction(){return new s(this,...arguments)},queryCompiler(){return new a(this,...arguments)},columnBuilder(){return new c(this,...arguments)},columnCompiler(){return new u(this,...arguments)},tableCompiler(){return new h(this,...arguments)},schemaCompiler(){return new f(this,...arguments)},dialect:\"redshift\",driverName:\"pg-redshift\",_driver:()=>r(119),processResponse(t,e){const r=t.response;return t.output?t.output.call(e,r):\"raw\"===t.method?r:\"SELECT\"===r.command?\"first\"===t.method?r.rows[0]:\"pluck\"===t.method?o(r.rows,t.pluck):r.rows:\"INSERT\"===r.command||\"UPDATE\"===r.command||\"DELETE\"===r.command?r.rowCount:r}}),t.exports=l},function(t,e,r){const n=r(18);t.exports=class extends n{savepoint(t){return this.trxClient.logger(\"Redshift does not support savepoints.\"),Promise.resolve()}release(t,e){return this.trxClient.logger(\"Redshift does not support savepoints.\"),Promise.resolve()}rollbackTo(t,e){return this.trxClient.logger(\"Redshift does not support savepoints.\"),Promise.resolve()}}},function(t,e,r){const n=r(0),i=r(19),o=r(115),{reduce:s,identity:a}=r(1);function c(t,e){o.call(this,t,e)}n(c,o),Object.assign(c.prototype,{truncate(){return`truncate ${this.tableName.toLowerCase()}`},insert(){const t=i.prototype.insert.apply(this,arguments);return\"\"===t?t:(this._slightReturn(),{sql:t})},update(){const t=i.prototype.update.apply(this,arguments);return this._slightReturn(),{sql:t}},del(){const t=i.prototype.del.apply(this,arguments);return this._slightReturn(),{sql:t}},_slightReturn(){this.single.isReturning&&this.client.logger.warn(\"insert/update/delete returning is not supported by redshift dialect\")},forUpdate(){return this.client.logger.warn(\"table lock is not supported by redshift dialect\"),\"\"},forShare(){return this.client.logger.warn(\"lock for share is not supported by redshift dialect\"),\"\"},columnInfo(){const t=this.single.columnInfo;let e=this.single.schema;const r=this.client.customWrapIdentifier(this.single.table,a);e&&(e=this.client.customWrapIdentifier(e,a));let n=\"select * from information_schema.columns where table_name = ? and table_catalog = ?\";const i=[r.toLowerCase(),this.client.database().toLowerCase()];return e?(n+=\" and table_schema = ?\",i.push(e)):n+=\" and table_schema = current_schema()\",{sql:n,bindings:i,output(e){const r=s(e.rows,function(t,e){return t[e.column_name]={type:e.data_type,maxLength:e.character_maximum_length,nullable:\"YES\"===e.is_nullable,defaultValue:e.column_default},t},{});return t&&r[t]||r}}}}),t.exports=c},function(t,e,r){const n=r(0),i=r(49);function o(){i.apply(this,arguments)}n(o,i),o.prototype.primary=function(){return this.notNullable(),i.prototype.primary.apply(this,arguments)},o.prototype.index=function(){return this.client.logger.warn(\"Redshift does not support the creation of indexes.\"),this},t.exports=o},function(t,e,r){const n=r(0),i=r(116);function o(){i.apply(this,arguments)}n(o,i),Object.assign(o.prototype,{bigincrements:\"bigint identity(1,1) primary key not null\",binary:\"varchar(max)\",bit:t=>!1!==t.length?`char(${t.length})`:\"char(1)\",blob:\"varchar(max)\",enu:\"varchar(255)\",enum:\"varchar(255)\",increments:\"integer identity(1,1) primary key not null\",json:\"varchar(max)\",jsonb:\"varchar(max)\",longblob:\"varchar(max)\",mediumblob:\"varchar(16777218)\",set:\"text\",text:\"varchar(max)\",datetime:t=>t?\"timestamp\":\"timestamptz\",timestamp:t=>t?\"timestamp\":\"timestamptz\",tinyblob:\"varchar(256)\",uuid:\"char(36)\",varbinary:\"varchar(max)\",bigint:\"bigint\",bool:\"boolean\",double:\"double precision\",floating:\"real\",smallint:\"smallint\",tinyint:\"smallint\",comment(t){this.pushAdditional(function(){this.pushQuery(`comment on column ${this.tableCompiler.tableName()}.`+this.formatter.wrap(this.args[0])+\" is \"+(t?`'${t}'`:\"NULL\"))},t)}}),t.exports=o},function(t,e,r){const n=r(0),{has:i}=r(1),o=r(117);function s(){o.apply(this,arguments)}n(s,o),s.prototype.index=function(t,e,r){this.client.logger.warn(\"Redshift does not support the creation of indexes.\")},s.prototype.dropIndex=function(t,e){this.client.logger.warn(\"Redshift does not support the deletion of indexes.\")},s.prototype.createQuery=function(t,e){let r=(e?\"create table if not exists \":\"create table \")+this.tableName()+\" (\"+t.sql.join(\", \")+\")\";this.single.inherits&&(r+=` like (${this.formatter.wrap(this.single.inherits)})`),this.pushQuery({sql:r,bindings:t.bindings}),i(this.single,\"comment\")&&this.comment(this.single.comment)},s.prototype.primary=function(t,e){e=e?this.formatter.wrap(e):this.formatter.wrap(`${this.tableNameRaw}_pkey`),t.constructor!==Array&&(t=[t]);const r=this.grouped.columns;if(r)for(let e=0;e\"columns\"===r.grouping&&r.builder&&\"add\"===r.builder._method&&r.builder._args&&r.builder._args.indexOf(t[e])>-1);if(n&&(n=n.builder),!(n&&n._modifiers&&n._modifiers.nullable&&!1===n._modifiers.nullable[0]))return n?this.client.logger.warn(\"Redshift does not allow primary keys to contain nullable columns.\"):this.client.logger.warn(\"Redshift does not allow primary keys to contain nonexistent columns.\")}return this.pushQuery(`alter table ${this.tableName()} add constraint ${e} primary key (${this.formatter.columnize(t)})`)},s.prototype.addColumns=function(t,e,r){if(e===this.alterColumnsPrefix)o.prototype.addColumns.call(this,t,e,r);else{e=e||this.addColumnsPrefix,r=r||this.getColumns();for(const t of r){const r=this.tableName(),n=t.compileColumn();this.pushQuery({sql:`alter table ${r} ${e}${n}`,bindings:[]})}}},t.exports=s},function(t,e,r){const n=r(0),i=r(118);function o(){i.apply(this,arguments)}n(o,i),t.exports=o},function(t,e,r){const n=r(7),i=r(0),{isUndefined:o,map:s,defaults:a}=r(1),{promisify:c}=r(15),u=r(21),h=r(275),f=r(276),l=r(277),d=r(278),p=r(279),m=r(280);function b(t){u.call(this,t),o(t.useNullAsDefault)&&this.logger.warn(\"sqlite does not support inserting default values. Set the `useNullAsDefault` flag to hide this warning. (see docs http://knexjs.org/#Builder-insert).\")}i(b,u),Object.assign(b.prototype,{dialect:\"sqlite3\",driverName:\"sqlite3\",_driver:()=>r(281),schemaCompiler(){return new f(this,...arguments)},queryCompiler(){return new h(this,...arguments)},columnCompiler(){return new l(this,...arguments)},tableCompiler(){return new d(this,...arguments)},ddl(t,e,r){return new p(this,t,e,r)},wrapIdentifierImpl:t=>\"*\"!==t?`\\`${t.replace(/`/g,\"``\")}\\``:\"*\",acquireRawConnection(){return new n((t,e)=>{const r=new this.driver.Database(this.connectionSettings.filename,n=>{if(n)return e(n);t(r)})})},destroyRawConnection:async t=>c(e=>t.close(e))(),_query(t,e){const{method:r}=e;let i;switch(r){case\"insert\":case\"update\":case\"counter\":case\"del\":i=\"run\";break;default:i=\"all\"}return new n(function(r,n){if(!t||!t[i])return n(new Error(`Error calling ${i} on connection.`));t[i](e.sql,e.bindings,function(t,i){return t?n(t):(e.response=i,e.context=this,r(e))})})},_stream(t,e,r){const i=this;return new n(function(n,o){return r.on(\"error\",o),r.on(\"end\",n),i._query(t,e).then(t=>t.response).then(t=>t.forEach(t=>r.write(t))).catch(function(t){r.emit(\"error\",t)}).then(function(){r.end()})})},processResponse(t,e){const r=t.context;let{response:n}=t;if(t.output)return t.output.call(e,n);switch(t.method){case\"select\":case\"pluck\":case\"first\":return\"pluck\"===t.method&&(n=s(n,t.pluck)),\"first\"===t.method?n[0]:n;case\"insert\":return[r.lastID];case\"del\":case\"update\":case\"counter\":return r.changes;default:return n}},poolDefaults(){return a({min:1,max:1},u.prototype.poolDefaults.call(this))},formatter(){return new m(this,...arguments)}}),t.exports=b},function(t,e,r){const n=r(0),i=r(19),{assign:o,each:s,isEmpty:a,isString:c,noop:u,reduce:h,identity:f}=r(1);function l(t,e){i.call(this,t,e);const{returning:r}=this.single;r&&this.client.logger.warn(\".returning() is not supported by sqlite3 and will not have any effect.\")}function d(){return\"\"}n(l,i),o(l.prototype,{forShare:d,forUpdate:d,insert(){const t=this.single.insert||[];let e=this.with()+`insert into ${this.tableName} `;if(Array.isArray(t)){if(0===t.length)return\"\";if(1===t.length&&t[0]&&a(t[0]))return e+this._emptyInsertValue}else if(\"object\"==typeof t&&a(t))return e+this._emptyInsertValue;const r=this._prepInsert(t);if(c(r))return e+r;if(0===r.columns.length)return\"\";if(e+=`(${this.formatter.columnize(r.columns)})`,null!==this.client.valueForUndefined&&s(r.values,t=>{s(t,t=>{if(void 0===t)throw new TypeError(\"`sqlite` does not support inserting default values. Specify values explicitly or use the `useNullAsDefault` config flag. (see docs http://knexjs.org/#Builder-insert).\")})}),1===r.values.length){return e+` values (${this.formatter.parameterize(r.values[0],this.client.valueForUndefined)})`}const n=[];let i=-1;for(;++it.length>0})},s.prototype.hasColumn=function(t,e){this.pushQuery({sql:`PRAGMA table_info(${this.formatter.wrap(t)})`,output(t){return o(t,t=>this.client.wrapIdentifier(t.name.toLowerCase())===this.client.wrapIdentifier(e.toLowerCase()))}})},s.prototype.renameTable=function(t,e){this.pushQuery(`alter table ${this.formatter.wrap(t)} rename to ${this.formatter.wrap(e)}`)},t.exports=s},function(t,e,r){const n=r(0),i=r(24);function o(){i.apply(this,arguments),this.modifiers=[\"nullable\",\"defaultTo\"]}n(o,i),o.prototype.double=o.prototype.decimal=o.prototype.floating=\"float\",o.prototype.timestamp=\"datetime\",o.prototype.enu=function(t){return`text check (${this.formatter.wrap(this.args[0])} in ('${t.join(\"', '\")}'))`},o.prototype.json=\"json\",t.exports=o},function(t,e,r){const n=r(0),i=r(23),{filter:o,values:s}=r(1);function a(){i.apply(this,arguments),this.primaryKey=void 0}n(a,i),a.prototype.createQuery=function(t,e){let r=(e?\"create table if not exists \":\"create table \")+this.tableName()+\" (\"+t.sql.join(\", \");r+=this.foreignKeys()||\"\",r+=this.primaryKeys()||\"\",r+=\")\",this.pushQuery(r)},a.prototype.addColumns=function(t,e){if(e)throw new Error(\"Sqlite does not support alter column.\");for(let e=0,r=t.sql.length;e0&&t[0].args.length>0){const e=t[0].args[0];let r=t[0].args[1]||\"\";return r&&(r=\" constraint \"+this.formatter.wrap(r)),`,${r} primary key (${this.formatter.columnize(e)})`}},a.prototype.foreignKeys=function(){let t=\"\";const e=o(this.grouped.alterTable||[],{method:\"foreign\"});for(let r=0,n=e.length;rt}n(m.prototype,{tableName(){return this.formatter(this.tableNameRaw,t=>t)},getColumn:async function(t){const e=o(this.pragma,e=>this.client.wrapIdentifier(e.name).toLowerCase()===this.client.wrapIdentifier(t).toLowerCase());if(!e)throw new Error(`The column ${t} is not in the ${this.tableName()} table`);return e},getTableSql(){return this.trx.disableProcessing(),this.trx.raw(`SELECT name, sql FROM sqlite_master WHERE type=\"table\" AND name=\"${this.tableName()}\"`).then(t=>(this.trx.enableProcessing(),t))},renameTable:async function(){return this.trx.raw(`ALTER TABLE \"${this.tableName()}\" RENAME TO \"${this.alteredName}\"`)},dropOriginal(){return this.trx.raw(`DROP TABLE \"${this.tableName()}\"`)},dropTempTable(){return this.trx.raw(`DROP TABLE \"${this.alteredName}\"`)},copyData(){return this.trx.raw(`SELECT * FROM \"${this.tableName()}\"`).then(t=>this.insertChunked(20,this.alteredName,s,t))},reinsertData(t){return this.trx.raw(`SELECT * FROM \"${this.alteredName}\"`).then(e=>this.insertChunked(20,this.tableName(),t,e))},async insertChunked(t,e,r,n){r=r||s;const i=p(n,t);for(const t of i)await this.trx.queryBuilder().table(e).insert(a(t,r))},createTempTable(t){return this.trx.raw(t.sql.replace(this.tableName(),this.alteredName))},_doReplace(t,e,r){const n=t.replace(/\\s+/g,\" \"),i=n.match(/^CREATE TABLE\\s+(\\S+)\\s*\\((.*)\\)/),o=i[1],s=i[2];if(!s)throw new Error(\"No column definitions in this statement!\");let a=0,c=[],u=0,h=0;const p=s.length;for(h=0;h{let e=t.trim().split(\" \");const n=[new RegExp(`\\`${m}\\``,\"i\"),new RegExp(`\"${m}\"`,\"i\"),new RegExp(`'${m}'`,\"i\"),new RegExp(`\\\\[${m}\\\\]`,\"i\")];m.match(/^\\S+$/)&&n.push(new RegExp(`\\\\b${m}\\\\b`,\"i\"));const i=t=>n.reduce((t,e)=>t.replace(e,r),t);if((t=>f(n,e=>t.match(e)))(e[0]))return r?(e[0]=r,e.join(\" \")):\"\";const s=/constraint/i.test(e[0])?2:0;if(/primary|unique/i.test(e[s])){const e=t.replace(/\\(.*\\)/,i);return e!==t&&d(r)?\"\":e}if(/foreign/.test(e[s])){const n=i((e=t.split(/ references /i))[0]);if(e[0]!==n){if(d(r))return\"\";e[0]=n}if(e[1].slice(0,o.length)===o){const t=e[1].replace(/\\(.*\\)/,i);if(e[1]!==t){if(d(r))return\"\";e[1]=t}}return e.join(\" references \")}return t})).filter(l(d))).length)throw new Error(\"Unable to drop last column from table\");return n.replace(/\\(.*\\)/,()=>`(${c.join(\", \")})`).replace(/,\\s*([,)])/,\"$1\")},renameColumn:async function(t,e){return this.client.transaction(async r=>{this.trx=r;const n=await this.getColumn(t),i=await this.getTableSql(n),o=this.client.wrapIdentifier(t),s=this.client.wrapIdentifier(e),a=i[0],h=this._doReplace(a.sql,o,s);if(i===h)throw new Error(\"Unable to find the column to change\");const{from:f,to:l}=u(this.client.postProcessResponse(u({from:t,to:e})));return this.reinsertMapped(a,h,t=>(t[l]=t[f],c(t,f)))},{connection:this.connection})},dropColumn:async function(t){return this.client.transaction(e=>(this.trx=e,Promise.all(t.map(t=>this.getColumn(t))).then(()=>this.getTableSql()).then(e=>{const r=e[0];let n=r.sql;if(t.forEach(t=>{const e=this.client.wrapIdentifier(t);n=this._doReplace(n,e,\"\")}),e===n)throw new Error(\"Unable to find the column to change\");const i=Object.keys(this.client.postProcessResponse(h(t.map(t=>[t,t]))));return this.reinsertMapped(r,n,t=>c(t,...i))})),{connection:this.connection})},reinsertMapped(t,e,r){return Promise.resolve().then(()=>this.createTempTable(t)).then(()=>this.copyData()).then(()=>this.dropOriginal()).then(()=>this.trx.raw(e)).then(()=>this.reinsertData(r)).then(()=>this.dropTempTable())}}),t.exports=m},function(t,e,r){const n=r(29),i=r(14);t.exports=class extends n{values(t){return Array.isArray(t)?Array.isArray(t[0])?`( values ${t.map(t=>`(${this.parameterize(t)})`).join(\", \")})`:`(${this.parameterize(t)})`:t instanceof i?`(${this.parameter(t)})`:this.parameter(t)}}},function(t,e){t.exports=sqlite3}]);","extractedComments":[]}