diff --git a/docs/404.html b/docs/404.html index 1ec95c2..4269bc1 100644 --- a/docs/404.html +++ b/docs/404.html @@ -29,6 +29,6 @@
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 1ec95c2..4269bc1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,6 +29,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-9806d396881bb1e0c476.js b/docs/static/js/main-f00bf12f5b428b34fa4f.js similarity index 76% rename from docs/static/js/main-9806d396881bb1e0c476.js rename to docs/static/js/main-f00bf12f5b428b34fa4f.js index 90b75ad..b1f20f3 100644 --- a/docs/static/js/main-9806d396881bb1e0c476.js +++ b/docs/static/js/main-f00bf12f5b428b34fa4f.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=this[e],a=1,i=0;++i=a&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function $(e){this.m=e}function R(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function x(e){return e}function _(e){e.divRemTo(this.m,null,e)}function L(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function P(e,t){e.squareTo(t),this.reduce(t)}function D(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function U(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function M(e){var t=a();return e.copyTo(t),this.reduce(t),t}function F(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function V(e,t){e.squareTo(t),this.reduce(t)}function K(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(){return 0==(this.t>0?1&this.data[0]:this.s)}function j(e,t){if(e>4294967295||e<1)return n.ONE;var r=a(),i=a(),o=t.convert(this),u=b(e)-1;for(o.copyTo(r);--u>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,o,r);else{var s=r;r=i,i=s}return t.revert(r)}function q(e,t){var r;return r=e<256||t.isEven()?new $(t):new U(t),this.exp(e,r)}function G(){var e=a();return this.copyTo(e),e}function z(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function Y(){return 0==this.t?this.s:this.data[0]<<16>>16}function J(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Q(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function X(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=a(),o=a(),u="";for(this.divRemTo(n,i,o);i.signum()>0;)u=(r+o.intValue()).toString(e).substr(1)+u,i.divRemTo(n,i,o);return o.intValue().toString(e)+u}function Z(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),i=!1,o=0,u=0,s=0;s=r&&(this.dMultiply(a),this.dAddOffset(u,0),o=0,u=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(u,0)),i&&n.ZERO.subTo(this,this)}function ee(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),se,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var a=new Array,i=7&e;a.length=1+(e>>3),t.nextBytes(a),i>0?a[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t}function re(e){return 0==this.compareTo(e)}function ne(e){return this.compareTo(e)<0?this:e}function ae(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,a,i=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function me(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Be(e){var t=a();return this.addTo(e,t),t}function ke(e){var t=a();return this.subTo(e,t),t}function Ne(e){var t=a();return this.multiplyTo(e,t),t}function $e(e){var t=a();return this.divRemTo(e,t,null),t}function Re(e){var t=a();return this.divRemTo(e,null,t),t}function xe(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function _e(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Le(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Pe(){}function De(e){return e}function Ue(e,t,r){e.multiplyTo(t,r)}function Oe(e,t){e.squareTo(t)}function Me(e){return this.exp(e,new Pe)}function Fe(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var a;for(a=r.t-this.t;n=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t}function je(e){return e}function qe(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Ge(e,t){e.squareTo(t),this.reduce(t)}function ze(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function We(e,t){var r,n,i=e.bitLength(),o=d(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new $(t):t.isEven()?new Ke(t):new U(t);var u=new Array,s=3,c=r-1,f=(1<1){var l=a();for(n.sqrTo(u[1],l);s<=f;)u[s]=a(),n.mulTo(l,u[s-2],u[s]),s+=2}var h,p,g=e.t-1,v=!0,y=a();for(i=b(e.data[g])-1;g>=0;){for(i>=c?h=e.data[g]>>i-c&f:(h=(e.data[g]&(1<0&&(h|=e.data[g-1]>>this.DB+i-c)),s=r;0==(1&h);)h>>=1,--s;if((i-=s)<0&&(i+=this.DB,--g),v)u[h].copyTo(o),v=!1;else{for(;s>1;)n.sqrTo(o,y),n.sqrTo(y,o),s-=2;s>0?n.sqrTo(o,y):(p=o,o=y,y=p),n.mulTo(y,u[h],o)}for(;g>=0&&0==(e.data[g]&1<0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Je(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Qe(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),a=this.clone(),i=d(1),o=d(0),u=d(0),s=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;a.isEven();)a.rShiftTo(1,a),t?(u.isEven()&&s.isEven()||(u.addTo(this,u),s.subTo(e,s)),u.rShiftTo(1,u)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(a)>=0?(r.subTo(a,r),t&&i.subTo(u,i),o.subTo(s,o)):(a.subTo(r,a),t&&u.subTo(i,u),s.subTo(o,s))}return 0!=a.compareTo(n.ONE)?n.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s}function Xe(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=ut[ut.length-1]){for(t=0;t=0);var s=a.modPow(i,this);if(0!=s.compareTo(n.ONE)&&0!=s.compareTo(t)){for(var c=1;c++a-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=a-11,i}n.putByte(0),n.putByte(r);var o,u=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var s=0;s0;){for(var c=0,f=d.random.getBytes(u),s=0;s1;){if(255!==i.getByte()){--i.read;break}++s}else if(2===u)for(s=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++s}if(0!==i.getByte()||s!==a-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function i(e,t,r){function n(){a(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void a(e.qBits,i))})}function a(e,t){d.prime.generateProbablePrime(e,o,t)}function i(t,o){if(t)return r(t);if(e.q=o,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(0!==e.p.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.p=null,void n();if(0!==e.q.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.q=null,void a(e.qBits,i);if(e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(h.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,i);var s=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,s,e.p,e.q,s.mod(e.p1),s.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng),n()}function o(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=d.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function u(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function s(e){return d.util.isNodejs&&"function"==typeof p[e]}function c(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.crypto&&"object"==typeof v.globalScope.crypto.subtle&&"function"==typeof v.globalScope.crypto.subtle[e]}function f(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.msCrypto&&"object"==typeof v.globalScope.msCrypto.subtle&&"function"==typeof v.globalScope.msCrypto.subtle[e]}function l(e){for(var t=d.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n=0||!n.gcd(t.n).equals(h.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var a=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);a.compareTo(i)<0;)a=a.add(t.p);var o=a.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return o=o.multiply(n.modInverse(t.n)).mod(t.n)};y.rsa.encrypt=function(e,t,r){var a,i=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,a=n(e,t,r)):(a=d.util.createBuffer(),a.putBytes(e));for(var u=new h(a.toHex(),16),s=w(u,t,i),c=s.toString(16),f=d.util.createBuffer(),l=o-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),f.getBytes()},y.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=i,o}var u=new h(d.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=w(u,t,r),c=s.toString(16),f=d.util.createBuffer(),l=i-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),!1!==n?a(f.getBytes(),t,r):f.getBytes()},y.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,a=r.prng||d.random,i={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},y.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new h(null);r.fromInt(30);for(var n,a=0,i=function(e,t){return e|t},o=+new Date,s=0;null===e.keys&&(t<=0||sc?e.pqState=0:e.num.isProbablePrime(u(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(m[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(h.ONE).gcd(e.e).compareTo(h.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(h.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var l=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)}}n=+new Date,s+=n-o,o=n}return null!==e.keys},y.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!d.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(s("generateKeyPair"))return p.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return n(e);n(null,{privateKey:y.privateKeyFromPem(r),publicKey:y.publicKeyFromPem(t)})});if(c("generateKey")&&c("exportKey"))return v.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return v.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(e)));n(null,{privateKey:t,publicKey:y.setRsaPublicKey(t.n,t.e)})}});if(f("generateKey")&&f("exportKey")){var a=v.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,r=v.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(t)));n(null,{privateKey:r,publicKey:y.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(a.onerror=function(e){n(e)})}}else if(s("generateKeyPairSync")){var o=p.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:y.privateKeyFromPem(o.privateKey),publicKey:y.publicKeyFromPem(o.publicKey)}}var u=y.rsa.createKeyPairGenerationState(e,t,r);if(!n)return y.rsa.stepKeyPairGenerationState(u,0),u.keys;i(u,r,n)},y.setRsaPublicKey=y.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,a){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return d.pkcs1.encode_rsa_oaep(t,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return y.rsa.encrypt(i,r,!0)},r.verify=function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=a(t,r,!0),e===g.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=a(t,r,!0),e===t}});var i=y.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())},r},y.setRsaPrivateKey=y.rsa.setPrivateKey=function(e,t,r,n,i,o,u,s){var c={n:e,e:t,d:r,p:n,q:i,dP:o,dQ:u,qInv:s};return c.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=y.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:a};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return d.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},c.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:T},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return y.rsa.encrypt(n,c,r)},c},y.wrapRsaPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(e).getBytes())])},y.privateKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,b,t,r)&&(e=g.fromDer(d.util.createBuffer(t.privateKey))),t={},r=[],!g.validate(e,C,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var a,i,o,u,s,c,f,l;return a=d.util.createBuffer(t.privateKeyModulus).toHex(),i=d.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=d.util.createBuffer(t.privateKeyPrivateExponent).toHex(),u=d.util.createBuffer(t.privateKeyPrime1).toHex(),s=d.util.createBuffer(t.privateKeyPrime2).toHex(),c=d.util.createBuffer(t.privateKeyExponent1).toHex(),f=d.util.createBuffer(t.privateKeyExponent2).toHex(),l=d.util.createBuffer(t.privateKeyCoefficient).toHex(),y.setRsaPrivateKey(new h(a,16),new h(i,16),new h(o,16),new h(u,16),new h(s,16),new h(c,16),new h(f,16),new h(l,16))},y.privateKeyToAsn1=y.privateKeyToRSAPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.p)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.qInv))])},y.publicKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),$=c.hmac.create();$.start(u,e),$.update(f.toDer(B).getBytes());var R=$.getMac();A=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.sha1).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.NULL,!1,"")]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,R.getBytes())]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,k.getBytes()),f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(N).getBytes())])}return f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(3).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(B).getBytes())])]),A])},d.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var a=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var o={name:"ContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=o;var u={name:"EncryptedContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(u)},i.encryptedDataValidator={name:"EncryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"}].concat(u)};var s={name:"SignerInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,capture:"signerInfos",optional:!0,value:[s]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(3),r(6),r(27),r(7),r(17),r(29),r(18),r(13),r(1),r(19);var a=n.asn1,i=e.exports=n.pki=n.pki||{};i.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=a.fromDer(t.body);return i.privateKeyFromAsn1(o)},i.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:a.toDer(i.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(0);r(1),r(12),r(2),function(){function t(e,t,n,a){return"workers"in n?i(e,t,n,a):r(e,t,n,a)}function r(e,t,r,n){var i=o(e,t),s=u(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),a(i,e,t,0,s,c,n)}function a(e,t,r,i,u,s,c){var l=+new Date;do{if(e.bitLength()>t&&(e=o(t,r)),e.isProbablePrime(u))return c(null,e);e.dAddOffset(f[i++%8],0)}while(s<0||+new Date-le&&(s=o(e,t));var h=s.toString(16);r.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(d,0)}}f=Math.max(1,f);for(var n=[],a=0;a=32)return i(),e();var t=32-u.pools[0].messageLength<<5;u.seedFile(t,function(t,r){if(t)return e(t);u.collect(r),i(),e()})}function r(){if(u.pools[0].messageLength>=32)return i();var e=32-u.pools[0].messageLength<<5;u.collect(u.seedFileSync(e)),i()}function i(){u.reseeds=4294967295===u.reseeds?0:u.reseeds+1;var e=u.plugin.md.create();e.update(u.keyBytes);for(var t=1,r=0;r<32;++r)u.reseeds%t==0&&(e.update(u.pools[r].digest().getBytes()),u.pools[r].start()),t<<=1;u.keyBytes=e.digest().getBytes(),e.start(),e.update(u.keyBytes);var n=e.digest().getBytes();u.key=u.plugin.formatKey(u.keyBytes),u.seed=u.plugin.formatSeed(n),u.generated=0}function o(e){var t=null,r=n.util.globalScope,a=r.crypto||r.msCrypto;a&&a.getRandomValues&&(t=function(e){return a.getRandomValues(e)});var i=n.util.createBuffer();if(t)for(;i.length()>16),f+=(32767&c)<<16,f+=c>>15,f=(2147483647&f)+(f>>31),d=4294967295&f;for(var s=0;s<3;++s)l=d>>>(s<<3),l^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&l))}return i.getBytes(e)}for(var u={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},s=e.md,c=new Array(32),f=0;f<32;++f)c[f]=s.create();return u.pools=c,u.pool=0,u.generate=function(e,r){function a(l){if(l)return r(l);if(f.length()>=e)return r(null,f.getBytes(e));if(u.generated>1048575&&(u.key=null),null===u.key)return n.util.nextTick(function(){t(a)});var d=i(u.key,u.seed);u.generated+=d.length,f.putBytes(d),u.key=s(i(u.key,o(u.seed))),u.seed=c(i(u.key,u.seed)),n.util.setImmediate(a)}if(!r)return u.generateSync(e);var i=u.plugin.cipher,o=u.plugin.increment,s=u.plugin.formatKey,c=u.plugin.formatSeed,f=n.util.createBuffer();u.key=null,a()},u.generateSync=function(e){var t=u.plugin.cipher,a=u.plugin.increment,i=u.plugin.formatKey,o=u.plugin.formatSeed;u.key=null;for(var s=n.util.createBuffer();s.length()1048575&&(u.key=null),null===u.key&&r();var c=t(u.key,u.seed);u.generated+=c.length,s.putBytes(c),u.key=i(t(u.key,a(u.seed))),u.seed=o(t(u.key,u.seed))}return s.getBytes(e)},a?(u.seedFile=function(e,t){a.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},u.seedFileSync=function(e){return a.randomBytes(e).toString()}):(u.seedFile=function(e,t){try{t(null,o(e))}catch(e){t(e)}},u.seedFileSync=o),u.collect=function(e){for(var t=e.length,r=0;r>n&255);u.collect(r)},u.registerWorker=function(e){if(e===self)u.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&u.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},u}}).call(t,r(20))},function(e,t,r){var n=r(0);r(1);var a=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],o=function(e,t){return e<>16-t},u=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,o=e.length(),u=t,s=Math.ceil(u/8),c=255>>(7&u);for(r=o;r<128;r++)i.putByte(a[i.at(r-1)+i.at(r-o)&255]);for(i.setAt(128-s,a[i.at(128-s)&c]),r=127-s;r>=0;r--)i.setAt(r,a[i.at(r+1)^i.at(r+s)]);return i};var s=function(e,t,r){var a,s,c,f,l=!1,d=null,h=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)g.push(e.getInt16Le());r?(a=function(e){for(c=0;c<4;c++)e[c]+=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=o(e[c],i[c]),f++},s=function(e){for(c=0;c<4;c++)e[c]+=g[63&e[(c+3)%4]]}):(a=function(e){for(c=3;c>=0;c--)e[c]=u(e[c],i[c]),e[c]-=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),f--},s=function(e){for(c=3;c>=0;c--)e[c]-=g[63&e[(c+3)%4]]});var v=function(e){var t=[];for(c=0;c<4;c++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var a=0;a=8;)v([[5,a],[1,s],[6,a],[1,s],[5,a]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(l=!0,y.update()),!r&&(t=0===d.length()))if(e)t=e(8,h,!r);else{var a=h.length(),i=h.at(a-1);i>a?t=!1:h.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var a=n.rc2.createEncryptionCipher(e,128);return a.start(t,r),a},n.rc2.createEncryptionCipher=function(e,t){return s(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var a=n.rc2.createDecryptionCipher(e,128);return a.start(t,r),a},n.rc2.createDecryptionCipher=function(e,t){return s(e,t,!1)}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),c=[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],s=!0}function a(e,t,r){for(var n,a,i,o,u,s,f,l,d,h,p,g,v,y,m,b=r.length();b>=64;){for(f=0;f<16;++f)t[f]=r.getInt32();for(;f<64;++f)n=t[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=t[f-15],a=(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[f]=n+t[f-7]+a+t[f-16]|0;for(l=e.h0,d=e.h1,h=e.h2,p=e.h3,g=e.h4,v=e.h5,y=e.h6,m=e.h7,f=0;f<64;++f)o=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),u=y^g&(v^y),i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&d|h&(l^d),n=m+o+u+c[f]+t[f],a=i+s,m=y,y=v,v=g,g=p+n>>>0,p=h,h=d,d=l,l=n+a>>>0;e.h0=e.h0+l|0,e.h1=e.h1+d|0,e.h2=e.h2+h|0,e.h3=e.h3+p|0,e.h4=e.h4+g|0,e.h5=e.h5+v|0,e.h6=e.h6+y|0,e.h7=e.h7+m|0,b-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(64),o={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l,d=8*o.fullMessageLength[0],h=0;h>>0,d+=l,n.putInt32(d>>>0),d=f>>>0;n.putInt32(d);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};a(p,r,n);var g=i.util.createBuffer();return g.putInt32(p.h0),g.putInt32(p.h1),g.putInt32(p.h2),g.putInt32(p.h3),g.putInt32(p.h4),g.putInt32(p.h5),g.putInt32(p.h6),g.putInt32(p.h7),g},o};var u=null,s=!1,c=null},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),128),f=[[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]],l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function a(e,t,r){for(var n,a,i,o,u,s,c,l,d,h,p,g,v,y,m,b,C,E,S,T,w,I,A,B,k,N,$,R,x,_,L,P,D,U,O,M=r.length();M>=128;){for(x=0;x<16;++x)t[x][0]=r.getInt32()>>>0,t[x][1]=r.getInt32()>>>0;for(;x<80;++x)P=t[x-2],_=P[0],L=P[1],n=((_>>>19|L<<13)^(L>>>29|_<<3)^_>>>6)>>>0,a=((_<<13|L>>>19)^(L<<3|_>>>29)^(_<<26|L>>>6))>>>0,U=t[x-15],_=U[0],L=U[1],i=((_>>>1|L<<31)^(_>>>8|L<<24)^_>>>7)>>>0,o=((_<<31|L>>>1)^(_<<24|L>>>8)^(_<<25|L>>>7))>>>0,D=t[x-7],O=t[x-16],L=a+D[1]+o+O[1],t[x][0]=n+D[0]+i+O[0]+(L/4294967296>>>0)>>>0,t[x][1]=L>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],$=e[7][0],R=e[7][1],x=0;x<80;++x)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,L=R+l+h+f[x][1]+t[x][1],n=$+c+d+f[x][0]+t[x][0]+(L/4294967296>>>0)>>>0,a=L>>>0,L=s+g,i=u+p+(L/4294967296>>>0)>>>0,o=L>>>0,$=k,R=N,k=A,N=B,A=w,B=I,L=T+a,w=S+n+(L/4294967296>>>0)>>>0,I=L>>>0,S=C,T=E,C=m,E=b,m=v,b=y,L=a+o,v=n+i+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+v+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+b,e[1][0]=e[1][0]+m+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+E,e[2][0]=e[2][0]+C+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+T,e[3][0]=e[3][0]+S+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+I,e[4][0]=e[4][0]+w+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+B,e[5][0]=e[5][0]+A+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+N,e[6][0]=e[6][0]+k+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+R,e[7][0]=e[7][0]+$+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,$=f.handleHeartbeat,R=[];R[f.ConnectionEnd.client]=[[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[A,B,I,I,$],[I,B,k,I,$],[I,B,k,N,$],[I,B,k,I,$]],R[f.ConnectionEnd.server]=[[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[A,B,I,I,$],[I,B,k,I,$],[I,B,k,N,$],[I,B,k,I,$]];var x=f.handleHelloRequest,_=f.handleServerHello,L=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[I,I,_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,L,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var F=f.handleClientHello,V=f.handleClientKeyExchange,K=f.handleCertificateVerify;M[f.ConnectionEnd.server]=[[I,F,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,L,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,K,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],f.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===f.Versions.TLS_1_0.major&&e.version.minor===f.Versions.TLS_1_0.minor;o&&(i+=2*t.fixed_iv_length);var u=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:u.getBytes(t.mac_key_length),server_write_MAC_key:u.getBytes(t.mac_key_length),client_write_key:u.getBytes(t.enc_key_length),server_write_key:u.getBytes(t.enc_key_length)};return o&&(s.client_write_IV=u.getBytes(t.fixed_iv_length),s.server_write_IV=u.getBytes(t.fixed_iv_length)),s},f.createConnectionState=function(e){var t=e.entity===f.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=f.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case f.CompressionMethod.none:break;case f.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=o;break;default:throw new Error("Unsupported compression algorithm.")}}return n},f.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},f.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},f.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),f.createRecord(e,{type:f.ContentType.alert,data:r})},f.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(p+=2);var g=e.session.id,v=g.length+1+2+4+28+2+i+1+u+p,y=n.util.createBuffer();return y.putByte(f.HandshakeType.client_hello),y.putInt24(v),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),c(y,1,n.util.createBuffer(g)),c(y,2,t),c(y,1,o),p>0&&c(y,2,s),y},f.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,a=n.util.createBuffer();return a.putByte(f.HandshakeType.server_hello),a.putInt24(r),a.putByte(e.version.major),a.putByte(e.version.minor),a.putBytes(e.session.sp.server_random),c(a,1,n.util.createBuffer(t)),a.putByte(e.session.cipherSuite.id[0]),a.putByte(e.session.cipherSuite.id[1]),a.putByte(e.session.compressionMethod),a},f.createCertificate=function(e){var t=e.entity===f.ConnectionEnd.client,r=null;if(e.getCertificate){var a;a=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,a)}var i=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var o=null,u=0;uf.MaxFragment;)a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,f.MaxFragment))})),i=i.slice(f.MaxFragment);i.length>0&&a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var o=0;o0&&(a=r.order[0]),null!==a&&a in r.cache){t=r.cache[a],delete r.cache[a];for(var i in r.order)if(r.order[i]===a){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var a=r.order.shift();delete r.cache[a]}var a=n.util.bytesToHex(e);r.order.push(a),r.cache[a]=t}}return r},f.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var a in f.CipherSuites)r.push(f.CipherSuites[a])}var i=e.server?f.ConnectionEnd.server:f.ConnectionEnd.client,o=e.sessionCache?f.createSessionCache(e.sessionCache):null,u={version:{major:f.Version.major,minor:f.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:o,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===f.ConnectionEnd.client?"client":"server"),r.send&&(f.queue(t,f.createAlert(t,r.alert)),f.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};u.reset=function(e){u.version={major:f.Version.major,minor:f.Version.minor},u.record=null,u.session=null,u.peerCertificate=null,u.state={pending:null,current:null},u.expect=(u.entity,f.ConnectionEnd.client,0),u.fragmented=null,u.records=[],u.open=!1,u.handshakes=0,u.handshaking=!1,u.isConnected=!1,u.fail=!(e||void 0===e),u.input.clear(),u.tlsData.clear(),u.data.clear(),u.state.current=f.createConnectionState(u)},u.reset();var s=function(e,t){var r=t.type-f.ContentType.change_cipher_spec,n=R[e.entity][e.expect];r in n?n[r](e,t):f.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,a=r.length();if(a<5)t=5-a;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}})}return t},l=function(e){var t=0,r=e.input,n=r.length();if(n0&&(u.sessionCache&&(t=u.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&u.sessionCache&&null!==(t=u.sessionCache.getSession())&&(e=t.id),u.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(u.version=t.version,u.session.sp=t.sp),u.session.sp.client_random=f.createRandom().getBytes(),u.open=!0,f.queue(u,f.createRecord(u,{type:f.ContentType.handshake,data:f.createClientHello(u)})),f.flush(u)}},u.process=function(e){var t=0;return e&&u.input.putBytes(e),u.fail||(null!==u.record&&u.record.ready&&u.record.fragment.isEmpty()&&(u.record=null),null===u.record&&(t=c(u)),u.fail||null===u.record||u.record.ready||(t=l(u)),!u.fail&&null!==u.record&&u.record.ready&&s(u,u.record)),t},u.prepare=function(e){return f.queue(u,f.createRecord(u,{type:f.ContentType.application_data,data:n.util.createBuffer(e)})),f.flush(u)},u.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),u.expectedHeartbeatPayload=e,f.queue(u,f.createRecord(u,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_request,e,t)})),f.flush(u)},u.close=function(e){if(!u.fail&&u.sessionCache&&u.session){var t={id:u.session.id,version:u.session.version,sp:u.session.sp};t.sp.keys=null,u.sessionCache.setSession(t.id,t)}u.open&&(u.open=!1,u.input.clear(),(u.isConnected||u.handshaking)&&(u.isConnected=u.handshaking=!1,f.queue(u,f.createAlert(u,{level:f.Alert.Level.warning,description:f.Alert.Description.close_notify})),f.flush(u)),u.closed(u)),u.reset(e)},u},e.exports=n.tls=n.tls||{};for(var q in f)"function"!=typeof f[q]&&(n.tls[q]=f[q]);n.tls.prf_tls1=a,n.tls.hmac_sha1=i,n.tls.createSessionCache=f.createSessionCache,n.tls.createConnection=f.createConnection},function(e,t,r){"use strict";var n=function(){var e={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,$a(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,ka(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Ia(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function $(e,t){for(var r,n=[],a=R(e,t,0,n);a&&(r=n.pop());a=R(r.a,r.b,0,n));return a}function R(e,t,r,n){if(r>100)return n.push(_(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&k(5),!1;"Set_elm_builtin"===e.$&&(e=$a(e),t=$a(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=ka(e),t=ka(t));for(var a in e)if(!R(e[a],t[a],r+1,n))return!1;return!0}function x(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ve("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=de(e.b,t[a]);return Va(n)?n:di(f(vi,a,n.a));case 8:if("object"!=typeof t||null===t||pe(t))return ve("an OBJECT",t);var i=vr;for(var o in t)if(t.hasOwnProperty(o)){var n=de(e.b,t[o]);if(!Va(n))return di(f(gi,o,n.a));i=O(_(o,n.a),i)}return hi(La(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=gn[e].r,o=Le(0);return gn[e].b=o,gn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=Ce(i(t.a)),s=0;s0&&yt(r,1,n,f));case 4:for(var l=e.j,d=t.j,h=!1,p=e.k;4===p.$;)h=!0,"object"!=typeof l?l=[l,p.j]:l.push(p.j),p=p.k;for(var g=t.k;4===g.$;)h=!0,"object"!=typeof d?d=[d,g.j]:d.push(g.j),g=g.k;return h&&l.length!==d.length?void yt(r,0,n,t):((h?bt(l,d):l===d)||yt(r,2,n,d),void mt(p,g,r,n+1));case 0:return void(e.a!==t.a&&yt(r,3,n,t.a));case 1:return void Ct(e,t,r,n,St);case 2:return void Ct(e,t,r,n,Tt);case 3:if(e.h!==t.h)return void yt(r,0,n,t);var v=Et(e.d,t.d);v&&yt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&yt(r,5,n,y))}}}function bt(e,t){for(var r=0;ru?yt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&yt(r,8,n,{w:a,x:o,y:k})}function wt(e,t,r,n,a,i){var o=e[r];if(!o)return o={c:0,z:n,r:a,s:void 0},i.push({r:a,A:o}),void(e[r]=o);if(1===o.c){i.push({r:a,A:o}),o.c=2;var u=[];return mt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}wt(e,t,r+Pn,n,a,i)}function It(e,t,r,n,a){var i=e[r];if(!i){var o=yt(t,9,a,void 0);return void(e[r]={c:1,z:n,r:a,s:o})}if(0===i.c){i.c=2;var u=[];return mt(n,i.z,u,a),void yt(t,9,a,{w:u,A:i})}It(e,t,r+Pn,n,a)}function At(e,t,r,n){Bt(e,t,r,0,0,t.b,n)}function Bt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)At(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Bt(e,t,f,0,a,i,o)}else if(9===c){u.t=e,u.u=o;var l=u.s;if(l){l.A.s=e;var f=l.w;f.length>0&&Bt(e,t,f,0,a,i,o)}}else u.t=e,u.u=o;if(n++,!(u=r[n])||(s=u.r)>i)return n}var d=t.$;if(4===d){for(var h=t.k;4===h.$;)h=h.k;return Bt(e,h,r,n,a+1,i,e.elm_event_node_ref)}for(var p=t.e,g=e.childNodes,v=0;vi))return n;a=m}return n}function kt(e,t,r,n){return 0===r.length?e:(At(e,t,r,n),Nt(e,r))}function Nt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(th,o,function(e){return fi(rh(e)?u+", "+e.a:u)},t)}}return t}function Ht(e,t,r){t.upload.addEventListener("progress",function(n){t.c||ke(f(ah,e,_(r,fh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||ke(f(ah,e,_(r,ch({received:n.loaded,size:n.lengthComputable?fi(n.total):li}))))})}function jt(e){try{return fi(decodeURIComponent(e))}catch(e){return li}}function qt(e,t){function r(){n=1===n?0:(sa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&sa(r),n=2)}}function Gt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(zt()))};return ua({setup:function(e){return a.a=e,la.addEventListener("popstate",a),la.navigator.userAgent.indexOf("Trident")<0||la.addEventListener("hashchange",a),r(function(t,r){if(!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&r.button<1&&!t.target&&!t.hasAttribute("download")){r.preventDefault();var a=t.href,i=zt(),o=$N(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?CN(o):bN(a)))}})},init:function(t){return l(e.init,t,zt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function zt(){return $N(En.location.href).a||k(1)}function Wt(e,t){return Ae(function(r){sa(function(){var n=document.getElementById(e);r(n?we(t(n)):Ie(EN(e)))})})}function Yt(e){return Ae(function(t){sa(function(){t(we(e()))})})}function Jt(e){return f(Nw,SN,Ae(function(t){try{la.location=e}catch(e){En.location.reload(!1)}}))}function Qt(){return f(tu,Ua(dc),f(tu,zs,lc))}console.warn("Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.0/optimize for better performance and smaller assets.");var Xt,Zt,er=[],tr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),sr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;ar.length&&(a=r.length);for(var i=n+a,o=new Array(i),u=0;u0}),r(function(e,t){return x(e,t)>=0}),r(function(e,t){var r=x(e,t);return r<0?Sa:r?Aa:Ea})),pr={$:"#0"},gr=r(U),vr={$:"[]"},yr=r(O),mr=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),br=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return x(e(t),e(r))}))})),Cr=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===Ea?0:n===Sa?-1:1}))}),Er=r(function(e,t){return e+t}),Sr=(r(function(e,t){return e-t}),r(function(e,t){return e*t})),Tr=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),wr=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Ir=Math.PI,Ar=(Math.E,Math.cos),Br=Math.sin,kr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),Nr=Math.floor,$r=Math.round,Rr=(Math.sqrt,Math.log),xr=isNaN,_r=(r(function(e,t){return e&&t}),r(function(e,t){return e||t}),r(function(e,t){return e!==t}),r(function(e,t){return e+t})),Lr=r(function(e,t){return e+t}),Pr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return vr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=oe(function(e){return"number"!=typeof e?ve("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ae(function(r){r(we(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),Wn=r(function(e,t){try{return fi(f(e,t,0).b)}catch(e){return li}}),Yn=(r(function(e,t){return _(t+1,e.getInt8(t))}),n(function(e,t,r){return _(r+2,t.getInt16(r,e))}),n(function(e,t,r){return _(r+4,t.getInt32(r,e))}),r(function(e,t){return _(t+1,e.getUint8(t))})),Jn=(n(function(e,t,r){return _(r+2,t.getUint16(r,e))}),n(function(e,t,r){return _(r+4,t.getUint32(r,e))}),n(function(e,t,r){return _(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return _(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return _(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?fi(l):li}a.push(d(Eg,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?fi(o):li}return r(d(Eg,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),a(function(e,t,r,n){return Pe(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:k(0),o=Lt(i);return qt(r,function(e){var r=a(e),n=vt(o,r);i=kt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Pe(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=En.title,o=En.body,u=Lt(o);return qt(r,function(e){Xt=n;var r=a(e),s=Tn("body")(vr)(r.body),c=vt(u,s);o=kt(o,u,c,t),u=s,Xt=0,i!==r.title&&(En.title=i=r.title)})})})),sa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ca=(r(function(e,t){return f(Nw,SN,Ae(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Nw,SN,Ae(function(){history.pushState({},"",t),e()}))})),fa=(r(function(e,t){return f(Nw,SN,Ae(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),la=("undefined"!=typeof document&&document,"undefined"!=typeof window?window:fa),da=(n(function(e,t,r){return Ne(Ae(function(n){function a(e){ke(r(e))}return e.addEventListener(t,a,Zt&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=de(e,t);return Va(r)?fi(r.a):li}),r(function(e,t){return Wt(t,function(t){return t[e](),pr})}),r(function(e,t){return Yt(function(){return la.scroll(e,t),pr})}),n(function(e,t,r){return Wt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,pr})}),r(function(e,t){return Ae(function(r){var n=setInterval(function(){ke(t)},e);return function(){clearInterval(n)}})})),ha=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),pa=function(e){return{$:"GTag",a:e}},ga=function(e){return{$:"GotoRoute",a:e}},va={$:"RequestBrowserNotificationPermission"},ya=function(e){return{$:"UserNotice",a:e}},ma={$:"Web3Connect"},ba=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),Ca=r(function(e,t){return t(e)}),Ea={$:"EQ"},Sa={$:"LT"},Ta=ur,wa=n(function(e,t,n){var a=n.c,i=n.d,o=r(function(t,r){if("SubTree"===t.$){var n=t.a;return l(Ta,o,r,n)}var a=t.a;return l(Ta,e,r,a)});return l(Ta,o,l(Ta,e,t,i),a)}),Ia=function(e){return l(wa,Ra,vr,e)},Aa={$:"GT"},Ba=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(Ba,e,t,o)),c=i;e=u,t=s,r=c}}),ka=function(e){return l(Ba,n(function(e,t,r){return f(Ra,_(e,t),r)}),vr,e)},Na=function(e){return l(Ba,n(function(e,t,r){return f(Ra,e,r)}),vr,e)},$a=function(e){var t=e.a;return Na(t)},Ra=yr,xa=Er,_a=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),La=function(e){return l(_a,Ra,vr,e)},Pa=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l(_a,e,t,La(p)):d(Pa,e,t,r+1,p)))))}return f(e,a,f(e,o,f(e,s,t)))}return f(e,a,f(e,o,t))}return f(e,a,t)}return t}),Da=n(function(e,t,r){return d(Pa,e,t,0,r)}),Ua=r(function(e,t){return l(Da,r(function(t,r){return f(Ra,e(t),r)}),vr,t)}),Oa=r(function(e,t){return e(t)}),Ma=n(function(e,t,r){return e(t(r))}),Fa=function(e){return e},Va=function(e){return"Ok"===e.$},Ka=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Ha=kr,ja=r(function(e,t){return Rr(t)/Rr(e)}),qa=V,Ga=Ha(f(ja,2,32)),za=er,Wa=d(Ka,0,Ga,za,za),Ya=function(e){return{$:"Leaf",a:e}},Ja=function(e){return{$:"SubTree",a:e}},Qa=rr,Xa=r(function(e,t){for(;;){var r=f(Qa,32,e),n=r.a,a=r.b,i=f(Ra,Ja(n),t);if(!a.b)return La(i);var o=a,u=i;e=o,t=u}}),Za=lr,ei=function(e){return e.a},ti=r(function(e,t){for(;;){var r=Ha(t/32);if(1===r)return f(Qa,32,e).a;var n=f(Xa,e,vr),a=r;e=n,t=a}}),ri=Nr,ni=r(function(e,t){return x(e,t)>0?e:t}),ai=Sr,ii=m,oi=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ri(f(ja,32,r-1)),a=e?La(t.nodeList):t.nodeList,i=f(ti,a,t.nodeListSize);return d(Ka,ii(t.tail)+r,f(ni,5,n*Ga),i,t.tail)}return d(Ka,ii(t.tail),Ga,za,t.tail)}),ui=tr,si=i(function(e,t,r,n,a){for(;;){if(t<0)return f(oi,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ya(l(ui,32,t,e)),o=e,u=t-32,s=r,c=f(Ra,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ci=r(function(e,t){if(e<=0)return Wa;var r=e%32,n=l(ui,r,e-r,t);return h(si,t,e-r-32,e,vr,n)}),fi=function(e){return{$:"Just",a:e}},li={$:"Nothing"},di=function(e){return{$:"Err",a:e}},hi=function(e){return{$:"Ok",a:e}},pi=r(function(e,t){return{$:"Failure",a:e,b:t}}),gi=r(function(e,t){return{$:"Field",a:e,b:t}}),vi=r(function(e,t){return{$:"Index",a:e,b:t}}),yi=function(e){return{$:"OneOf",a:e}},mi=gr,bi=j,Ci=function(e){var t=bi(e);return 97<=t&&t<=122},Ei=function(e){var t=bi(e);return t<=90&&65<=t},Si=function(e){return Ci(e)||Ei(e)},Ti=function(e){var t=bi(e);return t<=57&&48<=t},wi=function(e){return Ci(e)||Ei(e)||Ti(e)},Ii=function(e){return l(_a,r(function(e,t){return t+1}),0,e)},Ai=mr,Bi=n(function(e,t,r){for(;;){if(!(x(e,t)<1))return r;var n=e,a=t-1,i=f(Ra,t,r);e=n,t=a,r=i}}),ki=r(function(e,t){return l(Bi,e,t,vr)}),Ni=r(function(e,t){return l(Ai,e,f(ki,0,Ii(t)-1),t)}),$i=Vr,Ri=Z,xi=r(function(e,t){return f(Mr,e,F(t))}),_i=z,Li=r(function(e,t){return M(f(Or,e,t))}),Pi=function(e){return f(xi,"\n ",f(Li,"\n",e))},Di=on,Ui=r(function(e,t){return"\n\n("+Ri(e+1)+") "+Pi(Oi(t))}),Oi=function(e){return f(Mi,e,vr)},Mi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=_i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Si(n)&&f($i,wi,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Ra,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ri(s)+"]",o=n,u=f(Ra,c,t);e=o,t=u;continue e;case"OneOf":var l=e.a;if(l.b){if(l.b.b){var d=function(){return t.b?"The Json.Decode.oneOf at json"+f(xi,"",La(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ri(Ii(l))+" ways:";return f(xi,"\n\n",f(Ra,h,f(Ni,Ui,l)))}var n=l.a,o=n,u=t;e=o,t=u;continue e}return"Ran into a Json.Decode.oneOf with no possibilities"+function(){return t.b?" at json"+f(xi,"",La(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(xi,"",La(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Pi(f(Di,4,g))+"\n\n")+p}}),Fi=en,Vi=tn,Ki=ae,Hi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},ji=An,qi={$:"Empty"},Gi=function(e){return{$:"Styled",a:e}},zi=function(e){return{$:"Text",a:e}},Wi=function(e){return{$:"Unstyled",a:e}},Yi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return Gi({html:r(function(t,r){return f(ji,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Wi(f(Ma,ji(e),a));case"Text":var i=t.a;return zi(i);default:return qi}}),Ji=Yi,Qi=r(function(e,t){return d(ba,t.noticeType,f(Ua,Ua(Ji(e)),t.mainParagraphs),t.align,t.label)}),Xi=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return ya(f(Qi,e,r));case"Web3Connect":return ma;case"GotoRoute":var n=t.a;return ga(n);case"GTag":var a=t.a;return pa(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(ha,i,o,u);default:return va}}),Zi=r(function(e,t){return f(Ua,Xi(e),t)}),eo={$:"EthDai"},to=function(e){return{$:"Native",a:e}},ro=function(e){return{$:"Token",a:e}},no={$:"XDai"},ao=M([ro(eo),to(no)]),io=function(e){var t=e.a;e.b,e.c;return t},oo=function(e){var t=(e.a,e.b);e.c;return t},uo=function(e){e.a,e.b;return e.c},so={$:"InitialBlank"},co=r(function(e,t){return t.b?l(Da,Ra,t,e):e}),fo=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=t.b;if(e(r))return!0;var a=e,i=n;e=a,t=i}}),lo=r(function(e,t){return f(fo,function(t){return $(t,e)},t)}),ho=r(function(e,t){return f(lo,e,t.userNotices)?t:D(t,{userNotices:f(co,t.userNotices,M([e]))})}),po=r(function(e,t){return l(_a,ho,t,e)}),go=Fa,vo={$:"Buyer"},yo={$:"Seller"},mo=r(function(e,t){return{options:t,type_:e}}),bo={$:"OfferType"},Co=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),Eo=r(function(e,t){return f(mo,bo,M([l(Co,"Buying",e,function(e){return $(e.parameters.initiatorRole,vo)}),l(Co,"Selling",t,function(e){return $(e.parameters.initiatorRole,yo)})]))}),So={$:"Closed"},To={$:"Committed"},wo={$:"Judgment"},Io={$:"Open"},Ao={$:"Phase"},Bo=a(function(e,t,r,n){return f(mo,Ao,M([l(Co,"Open",e,function(e){return $(e.state.phase,Io)}),l(Co,"Committed",t,function(e){return $(e.state.phase,To)}),l(Co,"Judgment",r,function(e){return $(e.state.phase,wo)}),l(Co,"Closed",n,function(e){return $(e.state.phase,So)})]))}),ko={$:"Initiator"},No={$:"Responder"},$o=r(function(e,t){if("Just"===t.$){return e(t.a)}return li}),Ro=r(function(e,t){return $(t,e.parameters.initiatorAddress)?fi(ko):f($o,function(e){return $(t,e)?fi(No):li},e.state.responder)}),xo=r(function(e,t){if("Just"===t.$){var r=t.a;return fi(e(r))}return li}),_o=r(function(e,t){return f(xo,function(t){var r=_(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return yo}r.a,r.b;return vo}if("Seller"===r.b.$){r.a,r.b;return vo}r.a,r.b;return yo},f(Ro,e,t))}),Lo={$:"Role"},Po=n(function(e,t,r){return f(mo,Lo,M([l(Co,"Buyer",t,function(t){return $(f(_o,t,e),fi(vo))}),l(Co,"Seller",r,function(t){return $(f(_o,t,e),fi(yo))})]))}),Do=function(e){return{orderBy:e}},Uo=Do,Oo={$:"Ascending"},Mo={$:"Phase"},Fo=Fe,Vo=Fo(vr),Ko=function(e){return{$:"Posix",a:e}},Ho=Ko,jo=r(function(e,t){return _({agentAddress:t,filters:go(M([d(Bo,!0,!0,!0,!1),f(Eo,!0,!0),l(Po,t,!0,!0)])),now:Ho(0),prices:vr,tradeTable:Uo(_(Mo,Oo)),wallet:e},Vo)}),qo=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Go={$:"None"},zo=Go,Wo=function(e){return d(qo,e,Vo,zo,vr)},Yo=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Wo(D(t,{wallet:r}))}return Wo(t)}),Jo=function(e){return{$:"PricesFetched",a:e}},Qo=function(e){return{$:"TradeTableMsg",a:e}},Xo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Zo=r(function(e,t){return f(Xo,e,t)}),eu=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),tu=n(function(e,t,r){return t(e(r))}),ru=r(function(e,t){if("None"===t.$)return Go;var r=t.a,n=t.b,a=l(eu,f(xo,Ma(e),r.onSign),f(xo,Ma(e),r.onBroadcast),f(xo,function(t){var r=t.a,n=t.b;return _(f(tu,r,e),f(xo,function(t){return{confirmations:t.confirmations,toMsg:f(tu,t.toMsg,e)}},n))},r.onMined));return f(Xo,a,n)}),nu=function(e){return{$:"AbiDecoder",a:e}},au=r(function(e,t){return{$:"Tape",a:e,b:t}}),iu=W,ou=Fr,uu=r(function(e,t){return e<1?t:l(ou,e,iu(t),t)}),su=uu(64),cu=n(function(e,t,r){return _(f(au,e,su(t)),r)}),fu=r(function(e,t){return e<1?"":l(ou,0,e,t)}),lu=fu(64),du=r(function(e,t){if("Ok"===t.$){var r=t.a;return hi(e(r))}var n=t.a;return di(n)}),hu=function(e){return-e},pu=r(function(e,t){return e<1?"":l(ou,-e,iu(t),t)}),gu=function(){var e=function(e){if(!f($i,Za(P("0")),f(fu,63,e)))return di("Boolean decode error. "+e+" is not 1 or 0.");switch(f(pu,1,e)){case"0":return hi(!1);case"1":return hi(!0);default:return di("Boolean decode error. "+e+" is not 1 or 0.")}};return nu(function(t){var r=t.a,n=t.b;return f(du,f(cu,r,n),e(lu(n)))})}(),vu=Hr,yu=function(e){return f(vu,"0x",e)||f(vu,"0X",e)?f(uu,2,e):e},mu=function(e){return e.b},bu=r(function(e,t){var r=e.a;return f(du,mu,r(function(e){return f(au,e,e)}(yu(t))))}),Cu=Zr,Eu=ie,Su=Jr,Tu=function(e){return f(Cu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Ki(n)}var a=r.a;return Eu(a)},Su)},wu=f(tu,bu,Tu),Iu=function(e){return{$:"Magnitude",a:e}},Au=function(e){return{$:"Pos",a:e}},Bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),ku=function(e){return{$:"MagnitudeNotNormalised",a:e}},Nu=function(e){e:for(;;){if(e.b){if(e.b.b){var t=e.b,r=t;e=r;continue e}var n=e.a;return fi(n)}return li}},$u=function(e){var t=Nu(e);return"Nothing"!==t.$&&t.a<0},Ru=function(e){return{$:"Neg",a:e}},xu={$:"Zer"},_u=function(e){return!e.b},Lu=r(function(e,t){var r=t.a;if(_u(r))return xu;switch(e.$){case"Zero":return xu;case"Positive":return Au(t);default:return Ru(t)}}),Pu=r(function(e,t){return f(Bu,e,ku(t))}),Du=function(e){return f(Da,r(function(t,r){return e(t)&&_u(r)?vr:f(Ra,t,r)}),vr)}(Za(0)),Uu=Tr,Ou=-1+f(Uu,10,7),Mu=Ou+1,Fu=r(function(e,t){var r=t.a,n=t.b;return _(e(r),n)}),Vu=function(e){return e<0?f(Fu,xa(-1),Vu(e+Mu)):_(e/Mu|0,e%Mu)},Ku=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Vu(r+e),i=a.a,o=a.b;return f(Ra,o,f(Ku,i,n))}{if(!(x(e,Mu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Hu=function(e){var t=e.a;return Iu(Du(f(Ku,0,t)))},ju=Ua(hu),qu={$:"Negative"},Gu={$:"Positive"},zu={$:"Zero"},Wu=function(e){switch(e.$){case"Positive":return qu;case"Negative":return Gu;default:return zu}},Yu=function(e){for(;;){var t=e.a,r=e.b,n=Hu(r),a=n.a;if(!$u(a))return f(Lu,t,Iu(a));e=f(Pu,Wu(t),ju(a))}},Ju=hr,Qu=function(e){switch(f(Ju,e,0).$){case"LT":return qu;case"GT":return Gu;default:return zu}},Xu=function(e){return e<0?-e:e},Zu=function(e){return Yu(f(Bu,Qu(e),ku(M([Xu(e)]))))},es=function(e){e:for(;;)switch(e.$){case"Zer":return 0;case"Pos":if(e.a.a.b){if(e.a.a.b.b){if(e.a.a.b.b.b)break e;var t=e.a.a,r=t.a,n=t.b,a=n.a;return a*f(Uu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},ts=function(e){switch(e.$){case"Zer":return xu;case"Neg":var t=e.a;return Au(t);default:return e}},rs=function(e){return{$:"MagnitudePair",a:e}},ns=r(function(e,t){var r=_(e,t);if(r.a.b){if(r.b.b){var n=r.a,a=n.a,i=n.b,o=r.b,u=o.a,s=o.b;return f(Ra,_(a,u),f(ns,i,s))}var c=r.a,a=c.a,i=c.b;return f(Ra,_(a,0),f(ns,i,vr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Ra,_(0,u),f(ns,vr,s))}return vr}),as=r(function(e,t){var r=e.a,n=t.a;return rs(f(ns,r,n))}),is=function(e){switch(e.$){case"Zer":return f(Pu,zu,vr);case"Neg":var t=e.a.a;return f(Pu,Gu,ju(t));default:var t=e.a.a;return f(Pu,Gu,t)}},os=r(function(e,t){var r=is(t),n=r.b,a=is(e),i=a.b,o=f(as,i,n),u=o.a,s=f(Ua,function(e){return e.a+e.b},u);return Yu(f(Bu,Gu,ku(s)))}),us=a(function(e,t,r,n){e:for(;;){var a=_(r,n);if(a.a.b){if(a.b.b){var i=a.a,o=i.a,u=i.b,s=a.b,c=s.a,l=s.b;if($(o,c)){var d=e,h=t,p=u,g=l;e=d,t=h,r=p,n=g;continue e}var d=o,h=c,p=u,g=l;e=d,t=h,r=p,n=g;continue e}return Aa}return a.b.b?Sa:f(Ju,e,t)}}),ss=function(e){switch(e.$){case"LT":return Aa;case"EQ":return Ea;default:return Sa}},cs=r(function(e,t){var r=_(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(us,0,0,n,a)}return Aa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return ss(d(us,0,0,n,a))}return Sa;default:switch(r.b.$){case"Pos":r.a;return Sa;case"Zer":r.a,r.b;return Ea;default:r.a;return Aa}}}),fs=r(function(e,t){return $(f(cs,e,t),Aa)}),ls=H,ds=r(function(e,t){return!f(fs,e,t)}),hs=function(e){switch(e.$){case"Zer":return Iu(vr);case"Pos":default:var t=e.a;return t}},ps=r(function(e,t){var r=e.a;return Hu(ku(f(Ua,ai(t),r)))}),gs=r(function(e,t){var r=e.a,n=t.a;if(r.b){if(r.b.b){var a=r.a,i=r.b,o=f(ps,Iu(n),a),u=f(gs,Iu(i),Iu(n)),s=u.a,c=f(os,f(Lu,Gu,o),f(Lu,Gu,Iu(f(Ra,0,s))));return hs(c)}var a=r.a;return f(ps,Iu(n),a)}return Iu(vr)}),vs=function(e){switch(e.$){case"Zer":return zu;case"Pos":return Gu;default:return qu}},ys=r(function(e,t){return $(e,zu)||$(t,zu)?zu:$(e,t)?Gu:qu}),ms=r(function(e,t){return f(Lu,f(ys,vs(e),vs(t)),f(gs,hs(e),hs(t)))}),bs=function(e){switch(e.$){case"Zer":return xu;case"Pos":var t=e.a;return Ru(t);default:var t=e.a;return Au(t)}},Cs=r(function(e,t){return f(os,e,bs(t))}),Es=Zu(0),Ss=a(function(e,t,r,n){if(e){var a=Zu(e),i=f(ms,f(ms,a,n),t),o=f(ds,i,r)?_(f(ms,a,t),f(Cs,r,i)):_(Es,r),u=o.a,s=o.b,c=d(Ss,e/2|0,t,s,n),l=c.a,h=c.b;return _(f(os,u,l),h)}return _(Es,r)}),Ts=Ha(f(ja,2,Ou)),ws=n(function(e,t,r){return d(Ss,f(Uu,2,Ts),e,t,r)}),Is=Zu(1),As=r(function(e,t){return e}),Bs=n(function(e,t,r){return l(_a,As(e),t,f(ki,1,r))}),ks=function(e){return l(Bs,ms(Zu(Mu)),Is,e)},Ns=n(function(e,t,r){if(e){var n=l(ws,ks(e),t,r),a=n.a,i=n.b,o=l(Ns,e-1,i,r),u=o.a,s=o.b;return _(f(os,a,u),s)}return l(ws,ks(e),t,r)}),$s=function(e){switch(e.$){case"Zer":return vr;case"Pos":default:var t=e.a.a;return t}},Rs=r(function(e,t){if($(t,Es))return li;var r=Ii($s(e))-Ii($s(t))+1,n=l(Ns,f(ni,0,r),ts(e),ts(t)),a=n.a,i=n.b;return fi(_(f(Lu,f(ys,vs(e),vs(t)),hs(a)),f(Lu,vs(e),hs(i))))}),xs=f(ms,Zu(2),Zu(2147483648)),_s=_r,Ls=function(e){return f(_s,e,"")},Ps=Dn,Ds=n(function(e,t,r){return e<=0?r:l(Ds,e>>1,U(t,t),1&e?U(r,t):r)}),Us=r(function(e,t){return l(Ds,e,t,"")}),Os=n(function(e,t,r){return U(f(Us,e-iu(r),Ls(t)),r)}),Ms=re,Fs=wr,Vs=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},Ks=r(function(e,t){for(;;){if(t<16)return f(Ra,Vs(t),e);var r=f(Ra,Vs(f(Fs,16,t)),e),n=t/16|0;e=r,t=n}}),Hs=function(e){return Ms(e<0?f(Ra,P("-"),f(Ks,vr,-e)):f(Ks,vr,e))},js=function(e){var t=f(Rs,e,xs);if("Nothing"===t.$)return"Failure converting BigInt to hex string. Should be impossible. Open up issue on the elm-bigint repo.";var r=t.a,n=r.a,a=r.b,i=Hs(es(a));return $(n,Zu(0))?i:U(js(n),l(Os,8,P("0"),i))},qs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Iu(vr))?"0":js(Au(t));default:var t=e.a;return"-"+qs(f(ms,Zu(-1),e))}},Gs=function(e){return l(Os,64,P("0"),e)},zs=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b,o=t.c;if("Just"===r.$){var u=r.a,s=Gs(Hs(a)),c=function(e){return U(e,n)}(Gs(Hs(u)));return L(a+32+(iu(n)/2|0),U(i,s),U(o,c))}return L(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(_a,t,L(32*Ii(e),"",""),e))},Ws=Dr,Ys=n(function(e,t,r){return t<128?f(e,t,r):t<2048?f(e,128|63&t,f(e,192|t>>>6,r)):t<65536?f(e,128|63&t,f(e,128|63&t>>>6,f(e,224|t>>>12,r))):f(e,128|63&t,f(e,128|63&t>>>6,f(e,128|63&t>>>12,f(e,240|t>>>18,r))))}),Js=n(function(e,t,n){return l(Ws,r(function(t,r){return l(Ys,e,bi(t),r)}),t,n)}),Qs=function(e){return La(l(Js,Ra,vr,e))},Xs=function(e){return f(xi,"",f(Ua,f(tu,Hs,f(Os,2,P("0"))),Qs(e)))},Zs=function(e){return 64-f(Fs,64,e)},ec=function(e){return U(e,f(Us,Zs(iu(e)),"0"))},tc=function(e){return _(fi(iu(e)/2|0),ec(e))},rc=function(e){return _(li,Gs(e))},nc=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},ac=function(e){switch(e.valueOf()){case"0":return"0000";case"1":return"0001";case"2":return"0010";case"3":return"0011";case"4":return"0100";case"5":return"0101";case"6":return"0110";case"7":return"0111";case"8":return"1000";case"9":return"1001";case"a":return"1010";case"b":return"1011";case"c":return"1100";case"d":return"1101";case"e":return"1110";case"f":return"1111";default:return"error converting hex to binary"}},ic=Ur,oc=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=_(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return _(f(_s,P("1"),r),!0);case"1":return _(f(_s,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return _(f(_s,P("0"),r),!1);case"1":return _(f(_s,P("1"),r),!0);default:break e}return _(r,!0)});return l(ic,t,_("",!1),e).a},uc=function(e){return l(ic,Ra,vr,e)},sc=n(function(e,t,r){for(;;){if(""===t)return La(r);var n=e,a=f(uu,e,t),i=f(Ra,l(ou,0,e,t),r);e=n,t=a,r=i}}),cc=r(function(e,t){return e&&""!==t?l(sc,e,t,vr):M([t])}),fc=function(e){var t=function(){var t=uc(qs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return _(r,f(tu,oc,f(Os,256,P("1"))))}var r=t;return _(r,f(Os,256,P("0")))}(),r=t.a,n=t.b;return Ms(f(Ua,nc,f(cc,4,n(f(xi,"",f(Ua,ac,r))))))},lc=function(e){return{$:"Hex",a:e}},dc=function(e){switch(e.$){case"AddressE":var t=e.a.a;return rc(t);case"UintE":var r=e.a;return rc(qs(r));case"IntE":var n=e.a;return rc(fc(n));case"BoolE":return rc(e.a?"1":"0");case"DBytesE":var a=e.a.a;return tc(a);case"BytesE":var a=e.a.a;return rc(yu(a));case"StringE":var i=e.a;return tc(Xs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return tc(t)}(Qt()(o));default:var i=e.a;return rc(yu(i))}};try{var hc=Qt();Qt=function(){return hc}}catch(e){throw"Some top-level definitions from `Abi.Encode` are causing infinite recursion:\n\n ┌─────┐\n │ abiEncodeList\n │ ↓\n │ lowLevelEncode\n └─────┘\n\nThese errors are very tricky, so read https://elm-lang.org/0.19.0/halting-problem to learn how to fix it!"}var pc=Lr,gc=function(e){return 1===iu(e)?f(pc,"0",e):e},vc=n(function(e,t,r){for(;;){if(e<=0)return r;{if(!t.b)return r;var n=t.a,a=t.b,i=e-1,o=a,u=f(Ra,n,r);e=i,t=o,r=u}}}),yc=r(function(e,t){return La(l(vc,e,t,vr))}),mc=n(function(e,t,r){if(t<=0)return vr;var n=_(t,r);e:for(;;){t:for(;;){if(!n.b.b)return r;if(!n.b.b.b){if(1===n.a)break e;break t}switch(n.a){case 1:break e;case 2:var a=n.b,i=a.a,o=a.b,u=o.a;return M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(Ra,i,f(Ra,u,f(Ra,h,f(Ra,m,f(yc,t-4,b))))):f(Ra,i,f(Ra,u,f(Ra,h,f(Ra,m,l(mc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),bc=r(function(e,t){return l(mc,0,e,t)}),Cc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Ec=function(e){switch(e.$){case"I8":return 1;case"I16":return 2;case"I32":return 4;case"U8":return 1;case"U16":return 2;case"U32":case"F32":return 4;case"F64":return 8;case"Seq":case"Utf8":var t=e.a;return t;default:return Ut(e.a)}},Sc={$:"LE"},Tc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,$(a,Sc));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,$(a,Sc));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,$(a,Sc));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,$(a,Sc));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,$(a,Sc));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,$(a,Sc));case"Seq":var i=e.b;return l(wc,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),wc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Tc,n,t,r);e=i,t=o,r=u}}),Ic=Ot,Ac=r(function(e,t){return{$:"Seq",a:e,b:t}}),Bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Ec(r),i=n;e=a,t=i}}),kc=function(e){return f(Ac,f(Bc,0,e),e)},Nc=function(e){return{$:"U8",a:e}},$c=Nc,Rc=r(function(e,t){return x(e,t)<0?e:t}),xc=dr,_c=function(e){return{$:"Bytes",a:e}},Lc=_c,Pc=function(e){return Ic(kc(f(Ua,Lc,La(e))))},Dc=Ut,Uc=r(function(e,t){var r=e.a;return f(Wn,r,t)}),Oc=function(e){return{$:"Decoder",a:e}},Mc=a(function(e,t,r,n){for(;;){var a=t(e),i=a.a,o=f(i,r,n),u=o.a,s=o.b;if("Loop"!==s.$){return _(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),Fc=r(function(e,t){return Oc(f(Mc,e,t))}),Vc=Oc(Yn),Kc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Hc=function(e){return{$:"Done",a:e}},jc=function(e){return{$:"Loop",a:e}},qc=r(function(e,t){var n=t.a;return Oc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return _(i,e(o))}))}),Gc=function(e){return Oc(r(function(t,r){return _(r,e)}))},zc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Gc(Hc(La(n))):f(qc,function(e){return jc(_(r-1,f(Ra,e,n)))},e)}),Wc=function(e){return f(Kc,vr,f(Uc,f(Fc,_(Dc(e),vr),zc(Vc)),e))},Yc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return _(f(e,n,i),f(e,a,o))}),Jc=r(function(e,t){return l(Yc,Ps,e,t)}),Qc=f(ki,0,4),Xc=r(function(e,t){var r=t.d0,n=t.d1,a=t.d2,i=t.d3,o=t.d4;switch(e){case 0:return r;case 1:return n;case 2:return a;case 3:return i;default:return o}}),Zc=Dt,ef=r(function(e,t){var r=t.a,n=t.b;return _(e(r),e(n))}),tf=function(e){return f(ef,f(tu,Zc,Ps(4294967295)),e)},rf=r(function(e,t){return 5*t+e}),nf=4294967295>>>32-Ga,af=nr,of=n(function(e,t,r){for(;;){var n=nf&t>>>e,a=f(af,n,r);if("SubTree"!==a.$){var i=a.a;return f(af,nf&t,i)}var o=a.a,u=e-Ga,s=t,c=o;e=u,t=s,r=c}}),uf=function(e){return e>>>5<<5},sf=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||x(e,r)>-1?li:fi(x(e,uf(r))>-1?f(af,nf&e,i):l(of,n,e,a))}),cf=r(function(e,t){var r=f(sf,e,t);if("Just"===r.$){return r.a}return _(0,0)}),ff=n(function(e,t,r){var n=f(rf,e,t);return f(cf,n,r)}),lf=ar,df=a(function(e,t,r,n){var a=nf&t>>>e,i=f(af,a,n);if("SubTree"===i.$){var o=i.a,u=d(df,e-Ga,t,r,o);return l(lf,a,Ja(u),n)}var s=i.a,c=l(lf,nf&t,r,s);return l(lf,a,Ya(c),n)}),hf=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||x(e,n)>-1?r:x(e,uf(n))>-1?d(Ka,n,a,i,l(lf,nf&e,t,o)):d(Ka,n,a,d(df,a,e,t,i),o)}),pf=n(function(e,t,r){return l(hf,e,t,r)}),gf=a(function(e,t,r,n){var a=f(rf,e,t);return l(pf,a,r,n)}),vf=Un,yf=r(function(e,t){return l(Yc,vf,e,t)}),mf=function(e){var t=l(Da,r(function(t,n){var a={d0:l(ff,0,t,e.state),d1:l(ff,1,t,e.state),d2:l(ff,2,t,e.state),d3:l(ff,3,t,e.state),d4:l(ff,4,t,e.state)},i=r(function(e,r){return d(gf,e,t,f(yf,f(Xc,e,a),f(Jc,tf(f(Xc,f(Fs,5,e+1),a)),f(Xc,f(Fs,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Qc);return D(e,{state:t})},bf=_(0,0),Cf=function(e){return{current:bf,lfsrstate:1,state:e,x:1,y:0}},Ef=function(e){var t=1&e;return 128&e?_(t,e<<1^113):_(t,e<<1)},Sf=_(1,0),Tf=r(function(e,t){var r=t.a,n=t.b;return e?_(n,r):_(r,n)}),wf=r(function(e,t){if(e){var n=f(Tf,1,t);return l(Yc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),If=r(function(e,t){var r=f(Fs,32,e/32|0),n=f(Tf,r,t),a=f(Fs,32,e);return f(wf,a,n)}),Af=n(function(e,t,r){var n=f(sf,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(hf,e,t(a),r)}),Bf=n(function(e,t,r){return l(Af,e,yf(t),r)}),kf=a(function(e,t,r,n){var a=f(rf,e,t);return l(Bf,a,r,n)}),Nf=function(e){return l(_a,r(function(e,t){var r=(1<>r}),Uf=n(function(e,t,r){return t?_(0,r<0))return t;var a=f(Rc,n,r),i=f(Ua,function(e){return f(Df,e,g)},f(ki,0,a)),o=Pf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(bc,i.outputLen,l(v,g,vr,i.outputLen))},Vf=function(e){return{$:"KS",a:e}},Kf=function(e){var t=e.a;return Vf({config:t,inputLength:0,partial:vr,state:f(ci,25,As(bf))})},Hf=function(e){return Oc(Jn(e))},jf=Ic(kc(vr)),qf=r(function(e,t){var n=t.a;return Oc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Gf=r(function(e,t){return f(qf,function(e){return Hf(t)},Hf(e))}),zf=r(function(e,t){return f(Kc,jf,f(Uc,f(Gf,e,Dc(t)-e),t))}),Wf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Dc(e)?f(Ra,e,n.partial):n.partial;if(!(x(l(_a,r(function(e,t){return t+Dc(e)}),0,i),a)>-1))return Vf(D(n,{inputLength:Dc(e)+n.inputLength,partial:i}));var o=Pc(i),u=f(Kc,jf,f(Uc,Hf(a),o)),s=Wc(u),c=f(Mf,s,n.state),d=Pf(c),h=f(zf,a,o),p=jf,g=Vf(D(n,{inputLength:Dc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Yf=r(function(e,t){return Ff(f(Wf,Ic(kc(f(Ua,$c,t))),Kf(e)))}),Jf=Yf(Cc),Qf=function(e){return lc(f(xi,"",f(Ua,f(tu,Hs,gc),f(bc,4,Jf(f(Ua,bi,uc(e)))))))},Xf=function(e){return f(vu,"0x",e)||f(vu,"0X",e)?e:"0x"+e},Zf=function(e){var t=e.a;return Xf(t)},el=r(function(e,t){var r=zs(f(Ua,dc,t)),n=function(e){return U(e,r)}(yu(Zf(Qf(e))));return lc(n)}),tl=function(e){return{data:fi(f(el,"poke()",vr)),decoder:wu(gu),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},rl=r(function(e,t){return D(t,{checked:e})}),nl=n(function(e,t,r){return f(Ua,function(r){return e(r)?t(r):r},r)}),al=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(nl,f(tu,function(e){return e.type_},Za(r)),function(e){return D(e,{options:l(nl,f(tu,function(e){return e.label},Za(n)),rl(a),e.options)})},t)}),il=function(e){return e.a},ol=r(function(e,t){return f(Ju,il(e),il(t))}),ul=r(function(e,t){return Ho(il(e)-il(t))}),sl=function(e){return{$:"Ok",a:e}},cl={$:"Outdated"},fl=r(function(e,t){return $(f(ol,f(ul,e,t.timestamp),Ho(6e5)),Aa)?cl:sl(t.price)}),ll=r(function(e,t){return{price:e,timestamp:t}}),dl=r(function(e,t){return _(e,t)}),hl=Qr,pl=Wr,gl=n(function(e,t,r){return{col:t,problem:r,row:e}}),vl=function(e){return l(gl,e.row,e.col,e.problem)},yl=r(function(e,t){e:for(;;)switch(e.$){case"Empty":return t;case"AddRight":var r=e.a,n=e.b,a=r,i=f(Ra,n,t);e=a,t=i;continue e;default:var r=e.a,o=e.b,a=r,i=f(yl,o,t);e=a,t=i;continue e}}),ml=r(function(e,t){var r=e.a,n=r({col:1,context:vr,indent:1,offset:0,row:1,src:t});if("Good"===n.$){var a=n.b;return hi(a)}var i=n.b;return di(f(yl,i,vr))}),bl=r(function(e,t){var r=f(ml,e,t);if("Ok"===r.$){var n=r.a;return hi(n)}var a=r.a;return di(f(Ua,vl,a))}),Cl=r(function(e,t){return{$:"Bad",a:e,b:t}}),El=n(function(e,t,r){return{$:"Good",a:e,b:t,c:r}}),Sl=function(e){return{$:"Parser",a:e}},Tl=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Cl,a,i)}var o=n.a,u=n.b,s=n.c,c=e(u),d=c.a,h=d(s);if("Bad"===h.$){var p=h.a,i=h.b;return f(Cl,o||p,i)}var p=h.a,g=h.b,v=h.c;return l(El,o||p,g,v)})}),wl=Tl,Il={$:"ExpectingEnd"},Al=r(function(e,t){return{$:"AddRight",a:e,b:t}}),Bl=a(function(e,t,r,n){return{col:t,contextStack:n,problem:r,row:e}}),kl={$:"Empty"},Nl=r(function(e,t){return f(Al,kl,d(Bl,e.row,e.col,t,e.context))}),$l=function(e){return Sl(function(t){return $(iu(t.src),t.offset)?l(El,!1,pr,t):f(Cl,!1,f(Nl,t,e))})}(Il),Rl=n(function(e,t,r){var n=t.a,a=r.a;return Sl(function(t){var r=n(t);if("Bad"===r.$){var i=r.a,o=r.b;return f(Cl,i,o)}var u=r.a,s=r.b,c=r.c,d=a(c);if("Bad"===d.$){var h=d.a,o=d.b;return f(Cl,u||h,o)}var h=d.a,p=d.b,g=d.c;return l(El,u||h,f(e,s,p),g)})}),xl=r(function(e,t){return l(Rl,As,e,t)}),_l=xl,Ll=r(function(e,t){return l(Rl,Oa,e,t)}),Pl=Ll,Dl=r(function(e,t){return{$:"Append",a:e,b:t}}),Ul=n(function(e,t,r){for(;;){if(!r.b)return f(Cl,!1,t);var n=r.a.a,a=r.b,i=n(e);if("Good"===i.$){var o=i;return o}var o=i,u=o.a,s=o.b;if(u)return o;var c=e,l=f(Dl,t,s),d=a;e=c,t=l,r=d}}),Ol=function(e){return Sl(function(t){return l(Ul,t,kl,e)})},Ml=Ol,Fl=function(e){return Sl(function(t){return l(El,!1,e,t)})},Vl=Fl,Kl=function(e){return{$:"ExpectingSymbol",a:e}},Hl=r(function(e,t){return{$:"Token",a:e,b:t}}),jl=function(e){return""===e},ql=Qn,Gl=function(e){var t=e.a,r=e.b,n=!jl(t);return Sl(function(e){var a=h(ql,t,e.offset,e.row,e.col,e.src),i=a.a,o=a.b,u=a.c;return $(i,-1)?f(Cl,!1,f(Nl,e,r)):l(El,n,pr,{col:u,context:e.context,indent:e.indent,offset:i,row:o,src:e.src})})},zl=Gl,Wl=function(e){return zl(f(Hl,e,Kl(e)))},Yl=$r,Jl=te,Ql=Xn,Xl=i(function(e,t,r,n,a){for(;;){var i=l(Ql,e,t,a.src);if($(i,-1))return l(El,x(a.offset,t)<0,pr,{col:n,context:a.context,indent:a.indent,offset:t,row:r,src:a.src});if($(i,-2)){var o=e,u=t+1,s=r+1,c=1,f=a;e=o,t=u,r=s,n=c,a=f}else{var o=e,u=i,s=r,c=n+1,f=a;e=o,t=u,r=s,n=c,a=f}}}),Zl=function(e){return Sl(function(t){return h(Xl,e,t.offset,t.row,t.col,t)})},ed=Zl,td=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Cl,a,i)}var a=n.a,o=n.b,u=n.c;return l(El,a,f(e,l(ou,t.offset,u.offset,t.src),o),u)})}),rd=function(e){return f(td,As,e)},nd=rd,ad=function(e){return{$:"Problem",a:e}},id=function(e){return Sl(function(t){return f(Cl,!1,f(Nl,t,e))})},od=function(e){return id(ad(e))},ud=f(wl,function(e){if(iu(e)<=9){var t=Jl("0."+e);if("Just"===t.$){var r=t.a;return Vl(Yl(1e3*r))}return od('Invalid float: "'+e+'"')}return od("Expected at most 9 digits, but got "+Ri(iu(e)))},nd(ed(Ti))),sd=o(function(e,t,r,n,a,i){return Ho(e+60*t*60*1e3+60*(r-i)*1e3+1e3*n+a)}),cd=ee,fd=function(e){return{$:"Done",a:e}},ld=function(e){return{$:"Loop",a:e}},dd={$:"UnexpectedChar"},hd=r(function(e,t){return Sl(function(r){var n=l(Ql,e,r.offset,r.src);return $(n,-1)?f(Cl,!1,f(Nl,r,t)):$(n,-2)?l(El,!0,pr,{col:1,context:r.context,indent:r.indent,offset:r.offset+1,row:r.row+1,src:r.src}):l(El,!0,pr,{col:r.col+1,context:r.context,indent:r.indent,offset:n,row:r.row,src:r.src})})}),pd=function(e){return f(hd,e,dd)},gd=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Good"===n.$){var a=n.a,i=n.b,o=n.c;return l(El,a,e(i),o)}var a=n.a,u=n.b;return f(Cl,a,u)})}),vd=gd,yd=function(e){return{$:"Done",a:e}},md=function(e){return{$:"Loop",a:e}},bd=function(e){if("Loop"===e.$){var t=e.a;return md(t)}var r=e.a;return yd(r)},Cd=a(function(e,t,r,n){e:for(;;){var a=r(t),i=a.a,o=i(n);if("Good"===o.$){var u=o.a,s=o.b,c=o.c;if("Loop"===s.$){var d=s.a,h=e||u,p=d,g=r,v=c;e=h,t=p,r=g,n=v;continue e}var y=s.a;return l(El,e||u,y,c)}var u=o.a,m=o.b;return f(Cl,e||u,m)}}),Ed=r(function(e,t){return Sl(function(r){return d(Cd,!1,e,t,r)})}),Sd=r(function(e,t){return f(Ed,e,function(e){return f(vd,bd,t(e))})}),Td=function(e){return f(Sd,"",function(t){if($(iu(t),e)){var r=cd(t);if("Just"===r.$){var n=r.a;return f(vd,fd,Vl(n))}return od('Invalid integer: "'+t+'"')}return f(vd,function(e){return ld(f(pc,t,e))},nd(pd(Ti)))})},wd=function(e){return od("Invalid day: "+Ri(e))},Id=function(e){return!f(Fs,4,e)&&(f(Fs,100,e)||!f(Fs,400,e))},Ad=function(e){var t=e-1;return(t/4|0)-(t/100|0)+(t/400|0)},Bd=function(e){var t=e.a,r=e.b,n=e.c;if(n<0)return wd(n);var a=function(e){var a=31536e6*(t-1970),i=r<3||!Id(t)?n-1:n,o=864e5*(i+(Ad(t)-Ad(1970)));return Vl(e+a+o)};switch(r){case 1:return n>31?wd(n):a(0);case 2:return n>29||29===n&&!Id(t)?wd(n):a(26784e5);case 3:return n>31?wd(n):a(50976e5);case 4:return n>30?wd(n):a(7776e6);case 5:return n>31?wd(n):a(10368e6);case 6:return n>30?wd(n):a(130464e5);case 7:return n>31?wd(n):a(156384e5);case 8:return n>31?wd(n):a(183168e5);case 9:return n>30?wd(n):a(209952e5);case 10:return n>31?wd(n):a(235872e5);case 11:return n>30?wd(n):a(262656e5);case 12:return n>31?wd(n):a(288576e5);default:return od('Invalid month: "'+Ri(r)+'"')}},kd=f(wl,Bd,f(Pl,f(Pl,f(Pl,Vl(n(function(e,t,r){return L(e,t,r)})),Td(4)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl("-")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl("-")),Td(2)),Td(2)])))),Nd=function(){var e=n(function(e,t,r){return e*(60*t)+r});return f(Pl,Vl(Fa),Ml(M([f(vd,function(e){return 0},Wl("Z")),f(Pl,f(Pl,f(Pl,Vl(e),Ml(M([f(vd,function(e){return 1},Wl("+")),f(vd,function(e){return-1},Wl("-"))]))),Td(2)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2),Vl(0)]))),f(_l,Vl(0),$l)])))}(),$d=f(wl,function(e){return Ml(M([f(Pl,f(Pl,f(Pl,f(Pl,f(Pl,f(_l,Vl(sd(e)),Wl("T")),Td(2)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(".")),ud),Vl(0)]))),f(_l,Nd,$l)),f(_l,Vl(p(sd,e,0,0,0,0,0)),$l)]))},kd),Rd=function(e){return f(bl,$d,e)},xd=f(Cu,function(e){var t=Rd(e);if("Err"===t.$){t.a;return Eu("TODO deadEndsToString")}var r=t.a;return Ki(r)},Su),_d=l(Vi,dl,f(hl,"symbol",Su),f(hl,"quote",f(hl,"USD",l(Vi,ll,f(hl,"price",pl),f(hl,"last_updated",xd))))),Ld=function(e){return l(Ba,n(function(e,t,r){return f(Ra,t,r)}),vr,e)},Pd={$:"RBEmpty_elm_builtin"},Dd=Pd,Ud={$:"Black"},Od=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Md={$:"Red"},Fd=i(function(e,t,r,n,a){if("RBNode_elm_builtin"===a.$&&"Red"===a.a.$){var i=(a.a,a.b),o=a.c,u=a.d,s=a.e;if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var c=(n.a,n.b),f=n.c,l=n.d,d=n.e;return h(Od,Md,t,r,h(Od,Ud,c,f,l,d),h(Od,Ud,i,o,u,s))}return h(Od,e,i,o,h(Od,Md,t,r,n,u),s)}if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$&&"RBNode_elm_builtin"===n.d.$&&"Red"===n.d.a.$){var c=(n.a,n.b),f=n.c,p=n.d,g=(p.a,p.b),v=p.c,y=p.d,m=p.e,d=n.e;return h(Od,Md,c,f,h(Od,Ud,g,v,y,m),h(Od,Ud,t,r,d,a))}return h(Od,e,t,r,n,a)}),Vd=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Od,Md,e,t,Pd,Pd);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ju,e,a).$){case"LT":return h(Fd,n,a,i,l(Vd,e,t,o),u);case"EQ":return h(Od,n,a,t,o,u);default:return h(Fd,n,a,i,o,l(Vd,e,t,u))}}),Kd=n(function(e,t,r){var n=l(Vd,e,t,r);if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var a=(n.a,n.b),i=n.c,o=n.d,u=n.e;return h(Od,Ud,a,i,o,u)}return n}),Hd=function(e){return l(_a,r(function(e,t){var r=e.a,n=e.b;return l(Kd,r,n,t)}),Dd,e)},jd=ce,qd=f(Fi,Ld,function(e){return f(Fi,Hd,jd(e))}(_d)),Gd=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return li;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ju,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return fi(n);default:var u=e,s=i;e=u,t=s;continue e}}}),zd=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Wd=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.e.d.$&&"Red"===e.e.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=a.e,c=e.e,f=(c.a,c.b),l=c.c,d=c.d,p=(d.a,d.b),g=d.c,v=d.d,y=d.e,m=c.e;return h(Od,Md,p,g,h(Od,Ud,r,n,h(Od,Md,i,o,u,s),v),h(Od,Ud,f,l,y,m))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,u=b.d,s=b.e,C=e.e,f=(C.a,C.b),l=C.c,d=C.d,m=C.e;return t.$,h(Od,Ud,r,n,h(Od,Md,i,o,u,s),h(Od,Md,f,l,d,m))}return e},Yd=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.d.d.$&&"Red"===e.d.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=(u.a,u.b),c=u.c,f=u.d,l=u.e,d=a.e,p=e.e,g=(p.a,p.b),v=p.c,y=p.d,m=p.e;return h(Od,Md,i,o,h(Od,Ud,s,c,f,l),h(Od,Ud,r,n,d,h(Od,Md,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Od,Ud,r,n,h(Od,Md,i,o,C,d),h(Od,Md,g,v,y,m))}return e},Jd=u(function(e,t,r,n,a,i,o){if("RBNode_elm_builtin"===i.$&&"Red"===i.a.$){var u=(i.a,i.b),s=i.c,c=i.d,f=i.e;return h(Od,r,u,s,c,h(Od,Md,n,a,f,o))}e:for(;;){if("RBNode_elm_builtin"===o.$&&"Black"===o.a.$){if("RBNode_elm_builtin"===o.d.$){if("Black"===o.d.a.$){var l=(o.a,o.d);l.a;return Yd(t)}break e}o.a,o.d;return Yd(t)}break e}return t}),Qd=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=a.a,o=a.d,u=e.e;if("Black"===i.$){if("RBNode_elm_builtin"===o.$&&"Red"===o.a.$){o.a;return h(Od,t,r,n,Qd(a),u)}var s=Wd(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Fd,c,f,l,Qd(d),p)}return Pd}return h(Od,t,r,n,Qd(a),u)}return Pd},Xd=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Pd;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(x(e,n)<0){if("RBNode_elm_builtin"===i.$&&"Black"===i.a.$){var u=(i.a,i.d);if("RBNode_elm_builtin"===u.$&&"Red"===u.a.$){u.a;return h(Od,r,n,a,f(Xd,e,i),o)}var s=Wd(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Fd,c,l,d,f(Xd,e,p),v)}return Pd}return h(Od,r,n,a,f(Xd,e,i),o)}return f(Zd,e,g(Jd,e,t,r,n,a,i,o))}),Zd=r(function(e,t){if("RBNode_elm_builtin"===t.$){var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if($(e,n)){var u=zd(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Fd,r,s,c,i,Qd(o))}return Pd}return h(Fd,r,n,a,i,f(Xd,e,o))}return Pd}),eh=r(function(e,t){var r=f(Xd,e,t);if("RBNode_elm_builtin"===r.$&&"Red"===r.a.$){var n=(r.a,r.b),a=r.c,i=r.d,o=r.e;return h(Od,Ud,n,a,i,o)}return r}),th=n(function(e,t,r){var n=t(f(Gd,e,r));if("Just"===n.$){var a=n.a;return l(Kd,e,a,r)}return f(eh,e,r)}),rh=function(e){return"Just"===e.$},nh=vn,ah=yn,ih=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),oh=function(e){return{$:"BadUrl_",a:e}},uh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),sh={$:"NetworkError_"},ch=function(e){return{$:"Receiving",a:e}},fh=function(e){return{$:"Sending",a:e}},lh={$:"Timeout_"},dh=ra,hh=r(function(e,t){if("Ok"===t.$){var r=t.a;return hi(r)}var n=t.a;return di(e(n))}),ph=r(function(e,t){return l(ea,"",Fa,f(tu,t,e))}),gh=function(e){return{$:"BadBody",a:e}},vh=function(e){return{$:"BadStatus",a:e}},yh=function(e){return{$:"BadUrl",a:e}},mh={$:"NetworkError"},bh={$:"Timeout"},Ch=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return di(yh(r));case"Timeout_":return di(bh);case"NetworkError_":return di(mh);case"BadStatus_":var n=t.a;return di(vh(n.statusCode));default:var a=t.b;return f(hh,gh,e(a))}}),Eh=nn,Sh=r(function(e,t){return f(ph,e,Ch(function(e){return f(hh,Oi,f(Eh,t,e))}))}),Th=function(e){return{$:"Request",a:e}},wh=we,Ih=r(function(e,t){return{reqs:e,subs:t}}),Ah=wh(f(Ih,Dd,vr)),Bh=cn,kh=Re,Nh=Ne,$h=n(function(e,t,r){e:for(;;){if(t.b){var n=t.a,a=t.b;if("Cancel"===n.$){var i=n.a,o=f(Gd,i,r);if("Nothing"===o.$){var u=e,s=a,c=r;e=u,t=s,r=c;continue e}var d=o.a;return f(Bh,function(t){return l($h,e,a,f(eh,i,r))},kh(d))}var h=n.a;return f(Bh,function(t){var n=h.tracker;if("Nothing"===n.$)return l($h,e,a,r);var i=n.a;return l($h,e,a,l(Kd,i,t,r))},Nh(l(Zn,e,nh(e),h)))}return wh(r)}}),Rh=a(function(e,t,r,n){return f(Bh,function(e){return wh(f(Ih,e,r))},l($h,e,t,n.reqs))}),xh=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Ra,a,r)}return r}),_h=r(function(e,t){return l(Da,xh(e),vr,t)}),Lh=n(function(e,t,r){return f(Bh,function(t){return f(Bh,function(r){return wh(f(e,t,r))},r)},t)}),Ph=function(e){return l(Da,Lh(Ra),wh(vr),e)},Dh=a(function(e,t,r,n){var a=n.a,i=n.b;return $(t,a)?fi(f(nh,e,i(r))):li}),Uh=n(function(e,t,r){var n=t.a,a=t.b;return f(Bh,function(e){return wh(r)},Ph(f(_h,l(Dh,e,n,a),r.subs)))}),Oh=function(e){return{$:"Cancel",a:e}},Mh=r(function(e,t){if("Cancel"===t.$){var r=t.a;return Oh(r)}var n=t.a;return Th({allowCookiesFromOtherDomains:n.allowCookiesFromOtherDomains,body:n.body,expect:f(ta,e,n.expect),headers:n.headers,method:n.method,timeout:n.timeout,tracker:n.tracker,url:n.url})}),Fh=r(function(e,t){return{$:"MySub",a:e,b:t}}),Vh=r(function(e,t){var r=t.a,n=t.b;return f(Fh,r,f(tu,n,e))});gn.Http=Ue(Ah,Rh,Uh,Mh,Vh);var Kh=Me("Http"),Hh=(Me("Http"),function(e){return Kh(Th({allowCookiesFromOtherDomains:!1,body:e.body,expect:e.expect,headers:e.headers,method:e.method,timeout:e.timeout,tracker:e.tracker,url:e.url}))}),jh=function(e){return Hh({body:dh,expect:f(Sh,e,qd),headers:vr,method:"GET",timeout:li,tracker:li,url:"https://daihard.exchange/prices.json"})},qh=r(function(e,t){return{$:"Trade",a:e,b:t}}),Gh=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),zh={$:"Descending"},Wh=function(e){return"Ascending"===e.$?zh:Oo},Yh=function(e){return d(Gh,e,Vo,zo,vr)},Jh=r(function(e,t){return _(t.a,e(t.b))}),Qh=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Gh,t,Vo,zo,M([ga(f(qh,r,n))]));case"ChangeSort":var a=e.a,i=$(t.orderBy.a,a)?f(Jh,Wh,t.orderBy):_(a,Oo);return Yh(D(t,{orderBy:i}));default:return Yh(t)}}),Xh={$:"BottomRight"},Zh={$:"Caution"},ep=function(e){return zi(e)},tp={align:Xh,label:"cantFetchPrices",mainParagraphs:M([M([ep("Error encountered fetching crypto prices.")])]),noticeType:Zh},rp=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},np=mn,ap=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=rp(tl(r)),a={onBroadcast:li,onMined:li,onSign:li},i=f(Zo,a,n);return d(qo,t,Vo,i,vr);case"TradeClicked":var o=e.a,u=e.b;return d(qo,t,Vo,zo,M([ga(f(qh,o,u))]));case"FiltersMsg":var s=e.a;return Wo(D(t,{filters:f(al,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(Qh,c,t.tradeTable);return d(qo,D(t,{tradeTable:l.model}),f(np,Qo,l.cmd),f(ru,Qo,l.chainCmd),f(Ua,Xi(Qo),l.cmdUps));case"UpdateNow":var h=e.a;return Wo(D(t,{now:h}));case"PricesFetched":var p=e.a;if("Ok"===p.$){var g=p.a,v=f(Ua,Jh(fl(t.now)),g);return Wo(D(t,{prices:v}))}p.a;return d(qo,t,Vo,zo,M([ya(tp)]));case"Refresh":return d(qo,t,jh(Jo),zo,vr);default:return Wo(t)}}),ip={$:"ShouldBeImpossible"},op=fr,up=r(function(e,t){f(op,e,t);return{align:Xh,label:"unexpectedError",mainParagraphs:M([M([ep(e)])]),noticeType:ip}}),sp=function(e){var t=e.a;return Xf(t)},cp=be,fp=f(tu,sp,cp),lp=f(tu,qs,f(tu,Xf,cp)),dp=f(tu,Zf,cp),hp=f(tu,Hs,f(tu,Xf,cp)),pp=r(function(e,t){return l(Da,r(function(t,r){return e(t)?f(Ra,t,r):r}),vr,t)}),gp=sn,vp=function(e){return be(l(_a,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},yp=function(e){return vp(f(Ua,function(e){var t=e.a,r=e.b;return _(t,f(Kc,gp,r))},f(pp,function(e){e.a;return!$(e.b,li)},e)))},mp=function(e){return yp(M([_("to",f(xo,fp,e.to)),_("from",f(xo,fp,e.from)),_("gas",f(xo,hp,e.gas)),_("gasPrice",f(xo,lp,e.gasPrice)),_("value",f(xo,lp,e.value)),_("data",f(xo,dp,e.data)),_("nonce",f(xo,hp,e.nonce))]))},bp=function(e){return{$:"TxSentry",a:e}},Cp=be,Ep=r(function(e,t){return vp(M([_("ref",Cp(e)),_("txParams",t)]))}),Sp=function(e){return{$:"Signing",a:e}},Tp=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Sp(e)}}),wp=n(function(e,t,r){var n=e.a,a=mp(r),i=l(Kd,n.ref,f(Tp,r,t),n.txs);return _(bp(D(n,{ref:n.ref+1,txs:i})),f(np,n.tagger,n.outPort(f(Ep,n.ref,a))))}),Ip=wp,Ap=r(function(e,t){var r=_(e,t);if("None"===r.b.$){r.b;return L(e,Vo,vr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return L(fi(t),r,vr)}(l(Ip,n,i,o))}return L(li,Vo,M([f(up,"submodel sent chainCmd, but there is no txSentry to use!",li)]))}),Bp={$:"CloseAnyDropdownsOrModals"},kp=function(e){return{$:"UpdateWallet",a:e}},Np=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),$p=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Rp=function(e){return"CryptoSwap"===e.$?"ZEC":"USD"},xp={$:"Day"},_p={$:"Hour"},Lp=r(function(e,t){return{num:e,unit:t}}),Pp=function(e){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return L(f(Lp,24,_p),f(Lp,1,_p),f(Lp,24,_p))}e.a;return L(f(Lp,24,_p),f(Lp,24,_p),f(Lp,24,_p));case"OffRamp":default:return L(f(Lp,3,xp),f(Lp,3,xp),f(Lp,3,xp))}},Dp=function(e){return{$:"CryptoSwap",a:e}},Up=function(e){return{$:"DHToken",a:e}},Op=function(e){return{$:"External",a:e}},Mp={$:"OffRamp"},Fp={$:"OnRamp"},Vp={$:"KovanDai"},Kp=function(e){e:for(;;)switch(e.$){case"Mainnet":return fi(ro(eo));case"Kovan":return fi(ro(Vp));case"Private":if(100===e.a)return fi(to(no));break e;default:break e}return li},Hp=function(e){switch(e.$){case"NoneDetected":return li;case"OnlyNetwork":var t=e.a;return fi(t);default:var r=e.a;return fi(r.network)}},jp=function(e){return f($o,Kp,Hp(e))},qp=r(function(e,t){var r=Op("USD"),n=Up(f(Kc,to(no),jp(e))),a=Op("ZEC");return _($(t,Dp(yo))||$(t,Mp)?n:$(t,Dp(vo))?a:r,$(t,Dp(vo))||$(t,Fp)?n:$(t,Dp(yo))?a:r)}),Gp={$:"Even"},zp=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return{amountIn:e,amountOut:r,currencySearch:a,inType:t,interval:c,margin:i,marginType:o,outType:n,paymentMethod:s,receiveAddress:u}}}}}}}}}}},Wp=r(function(e,t){return zp("")(f(qp,e,t).a)("")(f(qp,e,t).b)("")("0")(Gp)("")("")("")}),Yp=a(function(e,t,r,n){return pa(d(Np,e,t,r,n))}),Jp=function(e){return"Buyer"===e.$?"Buyer":"Seller"},Qp=function(e){switch(e.$){case"Expiry":return"Expiry";case"Payment":return"Payment";default:return"Judgment"}},Xp=function(e){return{$:"Address",a:e}},Zp=X,eg=f(tu,yu,f(tu,Zp,Xp)),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return eg("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return eg("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return eg("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return eg("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return eg("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},rg=function(e){return eg("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ng=function(e){return{$:"AddressE",a:e}},ag=ng,ig=function(e){return{$:"UintE",a:e}},og=ig,ug=n(function(e,t,r){return{data:fi(f(el,"approve(address,uint256)",M([ag(t),og(r)]))),decoder:wu(gu),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),sg=function(e){return{$:"TokenValue",a:e}},cg=function(e){return e.a},fg=r(function(e,t){return f(Kc,Es,f(xo,ei,f(Rs,e,t)))}),lg=r(function(e,t){return sg(f(fg,cg(e),Zu(t)))}),dg=function(e){return f(lg,e,12)},hg=function(e){return f(lg,e,3)},pg=sg(Zu(0)),gg=r(function(e,t){var r=pg;return{abortPunishment:dg(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:hg(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),vg=function(e){return f(lg,e,200)},yg=r(function(e,t){return sg(f(os,cg(e),cg(t)))}),mg=function(e){var t=f(lg,e.tradeAmount,200);return f(yg,e.pokeReward,f(yg,vg(e.tradeAmount),f(yg,t,function(){return"Buyer"===e.initiatorRole.$?hg(e.tradeAmount):e.tradeAmount}())))},bg=Vi(Ca),Cg=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),Eg=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Sg=oa,Tg=ia,wg=function(e){return f(Tg,{caseInsensitive:!1,multiline:!1},e)},Ig=aa,Ag=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Bg=r(function(e,t){return!f(fo,f(Ma,ls,e),t)}),kg=Bg(Fa),Ng=G,$g=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Rg=n(function(e,t,r){if("Err"===t.$){var n=t.a;return di(n)}var a=t.a;if("Err"===r.$){var n=r.a;return di(n)}var i=r.a;return hi(f(e,a,i))}),xg=f(Da,Rg(Ra),hi(vr)),_g=function(e){if(e.b){var t=(e.a,e.b);return fi(t)}return li},Lg=n(function(e,t,r){e:for(;;){if(!t.b)return hi(r);var n=t.a,a=t.b;switch(n.valueOf()){case"0":var i=e-1,o=a,u=r;e=i,t=o,r=u;continue e;case"1":var i=e-1,o=a,u=r+f(Uu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Uu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Uu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Uu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Uu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Uu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Uu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Uu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Uu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Uu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Uu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Uu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Uu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Uu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Uu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return di(Ls(s)+" is not a valid hexadecimal character.")}}}),Pg=function(e){if(jl(e))return di("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(vu,"-",e)){var t=f(Kc,vr,_g(uc(e)));return f(du,hu,l(Lg,Ii(t)-1,t,0))}return l(Lg,iu(e)-1,uc(e),0)}();return f(hh,function(t){return f(xi," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Dg=function(e){var t=uc(e);return function(e){return _(t,e)}(f($g,vr,xg(f(Ua,Pg,f(Li,"",f(xi,"",f(Ua,f(tu,Hs,gc),f(bc,20,Jf(f(Ua,f(tu,Ng,bi),t))))))))))},Ug=function(e){var t=r(function(e,t){return!(t>=8&&Ci(e)||t<8&&Ei(e))}),n=Dg(yu(e)),a=n.a,i=n.b,o=l(Ai,t,a,i);return!!Ag(e)&&kg(o)},Og=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-f]{40}$"))),Mg=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9A-F]{40}$"))),Fg=function(e){return'"'+e+'"'},Vg=function(e){var t=yu(e),r=f(fu,24,t),n=f(pu,40,e);return 64===iu(t)&&f($i,Za(P("0")),r)?Mg(n)||Og(n)?hi(Xp(n)):Ug(n)?hi(Xp(n)):di("Given address "+Fg(e)+" failed the EIP-55 checksum test."):40!==iu(t)?di("Given address "+Fg(e)+" is not the correct length."):Ag(t)?Mg(t)||Og(t)?hi(Xp(t)):Ug(t)?hi(Xp(t)):di("Given address "+Fg(e)+" failed the EIP-55 checksum test."):di("Given address "+Fg(e)+" contains invalid hex characters.")},Kg=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),Vg(lu(r)))}),Hg=r(function(e,t){var r=t.a;return nu(function(t){var n=t.a,a=t.b;return r(f(au,n,f(uu,64*e,a)))})}),jg=r(function(e,t){return f(hl,"data",wu(f(Hg,e,t)))}),qg=Xr,Gg=r(function(e,t){return f(hl,"topics",f(qg,e,wu(t)))}),zg=function(e){if("Ok"===e.$){var t=e.a;return fi(t)}return li},Wg=r(function(e,t){for(;;){if(e<=0)return t;{if(!t.b)return t;var r=(t.a,t.b),n=e-1,a=r;e=n,t=a}}}),Yg=n(function(e,t,r){var n=f(Wg,t,r),a=Ii(r)>0;return e>0&&t>0&&a?f(Ra,f(bc,e,r),l(Yg,e,t,n)):vr}),Jg=r(function(e,t){return l(Yg,e,e,t)}),Qg=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return li;var a=n.a;return f(xo,Ra(a),r)});return f(Da,t,fi(vr))}(Fa),Xg=function(e){return f(xo,f(tu,La,f(_a,r(function(e,t){return f(os,Zu(e),f(ms,t,xs))}),Es)),Qg(f(Ua,f(tu,La,f(tu,Ms,f(tu,Pg,zg))),f(Jg,8,La(e)))))},Zg=function(e){var t=uc(Zp(e));e:for(;;){if(!t.b)return li;switch(t.a.valueOf()){case"-":if(t.b.b){if("0"===t.b.a.valueOf()&&t.b.b.b&&"x"===t.b.b.a.valueOf()){if(t.b.b.b.b){var r=t.b,n=r.b,a=n.b;return f(xo,ms(Zu(-1)),Xg(a))}var i=t.b;i.b;return li}var a=t.b;return f(xo,ms(Zu(-1)),Xg(a))}return li;case"+":if(t.b.b){var a=t.b;return Xg(a)}return li;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Xg(a)}t.b;return li}break e;default:break e}}var a=t;return Xg(a)},ev=r(function(e,t){if("Just"===t.$){var r=t.a;return hi(r)}return di(e)}),tv=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),f(ev,"Error Decoding Uint into BigInt",Zg(Xf(lu(r)))))}),rv=f(bg,f(Gg,1,Kg),f(bg,f(jg,1,Kg),f(bg,f(jg,0,tv),Ki(Cg)))),nv=an,av=r(function(e,t){return be(l(_a,Te(e),Ee(),t))}),iv=r(function(e,t){return{address:t.address,blockHash:t.blockHash,blockNumber:t.blockNumber,data:t.data,logIndex:t.logIndex,removed:t.removed,returnData:f(nv,e,vp(M([_("data",cp(t.data)),_("topics",f(av,dp,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),ov=function(e){if(e.b){var t=e.a;e.b;return fi(t)}return li},uv=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return di(r)}),sv=r(function(e,t){return f(du,function(e){return e.id},f(uv,function(e){return f(hh,Oi,f(iv,rv,e).returnData)},f(ev,"No log found from that factoryAddress in that txReceipt",ov(f(pp,function(t){return $(f(tu,sp,Zp)(t.address),f(tu,sp,Zp)(tg(e)))},t.logs)))))}),cv=n(function(e,t,r){return{data:fi(f(el,"allowance(address,address)",M([ag(t),ag(r)]))),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),fv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},lv=function(e){switch(e.$){case"BlockNum":var t=e.a;return cp(Xf(Hs(t)));case"EarliestBlock":return cp("earliest");case"LatestBlock":return cp("latest");default:return cp("pending")}},dv=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return yp(M([_("to",f(xo,fp,t)),_("from",f(xo,fp,r)),_("gas",f(xo,hp,n)),_("gasPrice",f(xo,lp,a)),_("value",f(xo,lp,i)),_("data",f(xo,dp,o))]))},hv=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return di(yh(r));case"Timeout_":return di(bh);case"NetworkError_":return di(mh);case"BadStatus_":var n=t.a,a=t.b;return di(vh(n.statusCode));default:var n=t.a,a=t.b,i=f(Eh,f(hl,"result",e),a);if("Ok"===i.$){var o=i.a;return hi(o)}var u=i.a;return di(gh(Oi(u)))}}),pv=n(function(e,t,r){return vp(M([_("id",Cp(e)),_("jsonrpc",cp("2.0")),_("method",cp(t)),_("params",f(av,Fa,r))]))}),gv=function(e){return f(na,"application/json",f(Di,0,e))},vv=n(function(e,t,r){return gv(l(pv,e,t,r))}),yv=f(ea,"",Fa),mv=Ie,bv=function(e){if("Ok"===e.$){var t=e.a;return wh(t)}var r=e.a;return mv(r)},Cv=function(e){return l(Zn,pr,bv,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:li,url:e.url})},Ev=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Cv({body:l(vv,1,r,n),headers:vr,method:"POST",resolver:yv(hv(a)),timeout:li,url:t})},Sv=n(function(e,t,r){return Ev({decoder:t.decoder,method:"eth_call",params:M([dv(t),lv(r)]),url:e})}),Tv={$:"LatestBlock"},wv=r(function(e,t){return l(Sv,e,t,Tv)}),Iv=function(e){return{$:"Perform",a:e}},Av=wh(pr),Bv=r(function(e,t){return f(Bh,function(t){return wh(e(t))},t)}),kv=r(function(e,t){var r=t.a;return Ne(f(Bh,nh(e),r))}),Nv=n(function(e,t,r){return f(Bv,function(e){return pr},Ph(f(Ua,kv(e),t)))}),$v=n(function(e,t,r){return wh(pr)}),Rv=r(function(e,t){var r=t.a;return Iv(f(Bv,e,r))});gn.Task=Ue(Av,Nv,$v,Rv);var xv=Me("Task"),_v=fn,Lv=r(function(e,t){return xv(Iv(f(_v,f(Ma,f(Ma,wh,e),di),f(Bh,f(Ma,f(Ma,wh,e),hi),t))))}),Pv=a(function(e,t,r,n){return f(Lv,n,f(wv,fv(ro(e)),l(cv,rg(e),t,r)))}),Dv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return eg("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return eg("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return eg("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return eg("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return eg("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Uv=function(e){return{$:"BoolE",a:e}},Ov=Uv,Mv=function(e){return{$:"StringE",a:e}},Fv=Mv,Vv=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:fi(f(el,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ag(t),ag(r),Ov(n),og(a),og(i),og(o),og(u),og(s),og(c),og(l),og(d),Fv(h),Fv(p)]))),decoder:wu(Kg),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}}}}}}}}}}}}}},Kv=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:fi(f(el,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ag(t),ag(r),Ov(n),og(a),og(i),og(o),og(u),og(s),og(c),og(l),og(d),Fv(h),Fv(p)]))),decoder:wu(Kg),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}}}}}}}}}}}}}},Hv=r(function(e,t){return{paymentMethods:t,price:e}}),jv=be,qv=function(e){return f(av,Fa,M([cp(e.symbol),jv(e.amount)]))},Gv=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},zv=function(e){return vp(M([_("type",cp(Gv(e.type_))),_("info",cp(e.info))]))},Wv=function(e){var t=qv(e.price),r=f(av,zv,e.paymentMethods);return f(Di,0,vp(M([_("paymentmethods",r),_("price",t)])))},Yv=r(function(e,t){return D(t,{value:fi(e)})}),Jv=function(e){return Zu(il(e))},Qv=function(e){return f(fg,Jv(e),Zu(1e3))},Xv=r(function(e,t){var r=function(){return"Token"===e.$?Vv:Kv}();return function(){return"Native"===e.$?Yv(cg(mg(t))):Fa}()(r(tg(e))(t.initiatorAddress)(Dv(e))($(t.initiatorRole,yo))(cg(t.tradeAmount))(cg(hg(t.tradeAmount)))(cg(dg(t.tradeAmount)))(cg(t.pokeReward))(Qv(t.autorecallInterval))(Qv(t.autoabortInterval))(Qv(t.autoreleaseInterval))(cg(vg(t.tradeAmount)))(Wv(f(Hv,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Zv=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),ey=function(e){return{$:"CreateNeedsSig",a:e}},ty=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),ry=r(function(e,t){var r=rp(f(Xv,e,t)),n={onBroadcast:li,onMined:fi(_(Zv(e),li)),onSign:fi(ty(e))};return _(fi(ey(e)),f(Zo,n,r))}),ny=function(e){if(""===e)return hi(li);var t=Jl(e);if("Just"===t.$){var r=t.a;return r>0?hi(fi(r)):di("Number must be greater than 0")}return di("Invalid amount")},ay=function(e){if(""===e)return hi(li);var t=cd(e);if("Just"===t.$){var r=t.a;return r>0?hi(fi(r)):di("Number must be greater than 0")}return di("Must be an integer")},iy={$:"Loss"},oy=r(function(e,t){return""===e?hi(li):f(du,fi,f(du,$(t,iy)?hu:Fa,f(du,function(e){return e/100},f(ev,"Invalid margin",Jl(e)))))}),uy=Z,sy=function(e){return uy(Xu(100*e))},cy=r(function(e,t){return f(xo,mu,ov(f(pp,f(tu,ei,Za(e)),t)))}),fy=function(e){return f(cy,e.foreignCurrencyType,e.prices)},ly=function(e){switch(e.$){case"CryptoSwap":return e.a;case"OffRamp":return yo;default:return vo}},dy=function(e){return"Buyer"===ly(e.mode).$?e.dhTokenAmount:e.foreignCurrencyAmount},hy=r(function(e,t){return"Seller"===ly(t.mode).$?D(t,{dhTokenAmount:e}):D(t,{foreignCurrencyAmount:e})}),py={align:Xh,label:"oldPriceDataWarning",mainParagraphs:M([M([ep("Uh oh, it looks like our price data might be out of date. You might want to double check the math...")])]),noticeType:Zh},gy=function(e){var t=fy(e);if("Just"===t.$){if("Ok"===t.a.$){var r=t.a.a,n=e.inputs,a=e.errors,i=f(xo,function(t){return"Buyer"===ly(e.mode).$?t/(1+e.margin)/r:t/(1+e.margin)*r*1.01},dy(e));return _(function(){if("Just"===i.$){var t=i.a;return f(hy,fi(t),D(e,{errors:D(a,{amountIn:li}),inputs:D(n,{amountIn:uy(t)})}))}return e}(),vr)}t.a;return _(e,M([ya(py)]))}return _(e,vr)},vy=function(e){return"Buyer"===ly(e.mode).$?e.foreignCurrencyAmount:e.dhTokenAmount},yy=r(function(e,t){return"Seller"===ly(t.mode).$?D(t,{foreignCurrencyAmount:e}):D(t,{dhTokenAmount:e})}),my=function(e){var t=fy(e);if("Just"===t.$){if("Ok"===t.a.$){var r=t.a.a,n=e.inputs,a=e.errors,i=f(xo,function(t){return"Buyer"===ly(e.mode).$?t*r*(1+e.margin):t/1.01/r*(1+e.margin)},vy(e));return _(function(){if("Just"===i.$){var t=i.a;return f(yy,fi(t),D(e,{errors:D(a,{amountOut:li}),inputs:D(n,{amountOut:uy(t)})}))}return e}(),vr)}t.a;return _(e,M([ya(py)]))}return _(e,vr)},by=function(e){var t=function(){var t=_(ly(e.mode),_(e.inputs.inType,e.inputs.outType));e:for(;;){if("Buyer"===t.a.$){if("External"===t.b.a.$&&"DHToken"===t.b.b.$){var r=(t.a,t.b),n=r.a.a,a=r.b.a;return _(n,a)}break e}if("DHToken"===t.b.a.$&&"External"===t.b.b.$){var i=(t.a,t.b),a=i.a.a,n=i.b.a;return _(n,a)}break e}f(op,"unexpected currency types in input when trying to update model currency types","");return _(e.foreignCurrencyType,e.dhTokenType)}(),r=t.a,n=t.b;return D(e,{dhTokenType:n,foreignCurrencyType:r})},Cy=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Ey={$:"AmountIn"},Sy={$:"AmountOut"},Ty=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wy=function(e){return{$:"ApproveNeedsSig",a:e}},Iy=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ay=r(function(e,t){return{$:"Confirm",a:e,b:t}}),By=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ky=function(e){return{$:"PricesFetched",a:e}},Ny=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),$y=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"DAI"}e.a;return"DAI"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"ETH";default:e.a;return"XDAI"}},Ry=function(e){if("DHToken"===e.$){var t=e.a;return $y(t)}return e.a},xy=r(function(e,t){switch(e.$){case"Expiry":return io(t.intervals);case"Payment":return oo(t.intervals);default:return uo(t.intervals)}}),_y=function(e){switch(e.$){case"Minute":return"Minute";case"Hour":return"Hour";case"Day":return"Day";default:return"Week"}},Ly=function(e){return{chainCmd:zo,cmd:Vo,cmdUps:vr,model:e}},Py=function(e){switch(e.$){case"Loss":return"Loss";case"Even":return"Even";default:return"Profit"}},Dy=function(e){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return"CryptoSwap Seller"}e.a;return"CryptoSwap Buyer";case"OffRamp":return"OffRamp";default:return"OnRamp"}},Uy=r(function(e,t){if("Seller"===ly(t.mode).$)return"DHToken"===e.$?D(t,{dhTokenType:e.a}):(f(op,"Trying to update inType with the wrong currency type",_(ly(t.mode),e)),t);if("External"===e.$){return D(t,{foreignCurrencyType:e.a})}f(op,"Trying to update inType with the wrong currency type",_(ly(t.mode),e));return t}),Oy=r(function(e,t){if("Seller"===ly(t.mode).$)return"External"===e.$?D(t,{foreignCurrencyType:e.a}):(f(op,"Trying to update outType with the wrong currency type",_(ly(t.mode),e)),t);if("DHToken"===e.$){return D(t,{dhTokenType:e.a})}f(op,"Trying to update outType with the wrong currency type",_(ly(t.mode),e));return t}),My=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return L(e(a),t(i),r(o))}),Fy=function(e){return l(My,e,Fa,Fa)},Vy=function(e){return l(My,Fa,e,Fa)},Ky=function(e){return l(My,Fa,Fa,e)},Hy=n(function(e,t,r){return D(r,{intervals:f(function(){switch(e.$){case"Expiry":return Fy;case"Payment":return Vy;default:return Ky}}(),As(t),r.intervals)})}),jy=f(Ma,f(Os,7,P("0")),Ri),qy=function(e){return f(xi,"",e)},Gy=function(e){var t=e.a,r=La(t);if(r.b){var n=r.a,a=r.b;return qy(f(Ra,Ri(n),f(Ua,jy,a)))}return"0"},zy=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Gy(t);default:var t=e.a;return"-"+Gy(t)}},Wy=function(e){return cd(zy(e))},Yy=function(e){return sg(e)},Jy=qr,Qy=function(e){var t=ov(f(Jy,".",e));if("Nothing"===t.$)return _(e,0);var r=t.a,n=iu(e)-1-r;return _(U(f(fu,r,e),f(uu,r+1,e)),n)},Xy=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=t.b;if(e(r)){var a=e,i=n;e=a,t=i;continue e}return t}return vr}}),Zy=function(e){var t=e.a,r=f(Xy,Za(0),t);return Iu(r.b?t:vr)},em=function(e){return f(xo,f(Ma,Zy,Iu),Qg(f(Ua,f(tu,La,f(tu,Ms,cd)),f(Jg,7,La(e)))))},tm=function(e){var t=uc(Zp(e));if(!t.b)return li;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(xo,Lu(qu),em(r))}return li;case"+":if(t.b.b){var r=t.b;return f(xo,Lu(Gu),em(r))}return li;default:var r=t;return f(xo,Lu(Gu),em(r))}},rm=function(e){var t=function(e){return!f(Fs,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(Kc,0,ov(r)))}},nm=function(e){return f(ms,e,e)},am=Zu(2),im=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Is;case"Neg":return xu;default:if($(r,Is))return f(ms,e,t);if(rm(r)){var n=e,a=nm(t),i=f(fg,r,am);e=n,t=a,r=i;continue e}var n=f(ms,t,e),a=nm(t),i=f(fg,f(Cs,r,Is),am);e=n,t=a,r=i;continue e}}),om=r(function(e,t){return l(im,Is,e,t)}),um=r(function(e,t){return e<1?t:l(ou,0,-e,t)}),sm=function(e){if(""===e)return li;var t=Qy(e),r=t.a,n=t.b,a=18-n,i=tm(a<0?f(um,-a,r):r);if("Nothing"===i.$)return li;var o=i.a,u=f(ms,o,f(om,Zu(10),Zu(a)));return fi(u)},cm=function(e){var t=sm(uy(e));if("Just"===t.$){var r=t.a;return Yy(r)}f(op,"Error converting float to tokenValue","");return Yy(Zu(0))},fm=jr,lm=function(e){for(;;){if(f(fm,".",e))return l(ou,0,-1,e);{if(!f(fm,"0",e))return""===e?"0":e;e=l(ou,0,-1,e)}}},dm=function(e){if($(f(cs,e,Zu(0)),Sa))return"-"+dm(bs(e));var t=l(Os,18,P("0"),zy(e)),r=f(um,18,t)+"."+f(pu,18,t);return function(e){return""===e?"0":e}(lm(r))},hm=r(function(e,t){var r=dm(t),n=ov(f(Jy,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(fu,a+1+e,r):f(fu,a,r)}),pm=r(function(e,t){if("Nothing"===e.$)return dm(cg(t));var r=e.a;return f(hm,r,cg(t))}),gm=function(e){var t=Jl(f(pm,li,e));if("Just"===t.$){return t.a}f(op,"Error converting tokenValue to float: string -> float failed",e);return 0},vm={$:"Error"},ym=r(function(e,t){f(op,e+" fetch error",t);return{align:Xh,label:"web3FetchError",mainParagraphs:M([M([ep('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:vm}}),mm=r(function(e,t){return{align:Xh,label:"web3MiningError",mainParagraphs:M([M([ep('Error mining "'+e+'" transaction: '+t)])]),noticeType:vm}}),bm=r(function(e,t){return{align:Xh,label:"web3SigError",mainParagraphs:M([M([ep('Error signing "'+e+'" transaction: '+t)])]),noticeType:Zh}}),Cm=Pr,Em=Cm(function(e){return f(fo,Za(e),M([P("1"),P("2"),P("3"),P("4"),P("5"),P("6"),P("7"),P("8"),P("9"),P("0"),P(".")]))}),Sm=function(e){if("Active"===e.$){var t=e.a;return fi(t)}return li},Tm=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Ly(D(t,{now:r}));case"Refresh":var n=function(){var e=_(Sm(t.wallet),jp(t.wallet));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var r=e.a.a,n=e.b.a.a;return d(Pv,n,r.address,tg(ro(n)),Cy(n))}return Vo}(),a=jh(ky);return d(Ny,t,Fo(M([n,a])),zo,vr);case"PricesFetched":var i=e.a;if("Ok"===i.$){var o=i.a,u=f(Ua,Jh(fl(t.now)),o),s=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{prices:u})),c=s.a,h=s.b;return d(Ny,c,Vo,zo,h)}i.a;return d(Ny,t,Vo,zo,M([ya(tp)]));case"ChangeMode":var p=e.a,c=D(t,{mode:p});return d(Ny,$(t.mode,p)?c:by(D(c,{inputs:f(Wp,t.wallet,p),intervals:Pp(p)})),Vo,zo,M([d(Yp,"change mode","navigation",Dy(p),0)]));case"SwapClicked":var g=t.inputs,v=D(g,{amountIn:g.amountOut,amountOut:g.amountIn,inType:g.outType,outType:g.inType}),y=t.mode;if("CryptoSwap"===y.$){var m=y.a,b=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{inputs:v,lastAmountInputChanged:function(){return"AmountIn"===t.lastAmountInputChanged.$?Sy:Ey}(),mode:function(){return Dp("Buyer"===m.$?yo:vo)}()})),c=b.a,h=b.b;return d(Ny,c,Vo,zo,U(h,M([d(Yp,"swap clicked","navigation",Jp(ly(c.mode)),0)])))}f(op,"swap button clicked, but it should be hidden right now!","");return Ly(t);case"AmountInChanged":var C=e.a,g=t.inputs,E=Em(C),S=function(){var e=t.errors,r=ny(E);if("Ok"===r.$){return _(r.a,D(e,{amountIn:li}))}var n=r.a;return _(li,D(e,{amountIn:fi(n)}))}(),T=S.a,w=S.b,I=my(f(hy,T,D(t,{errors:w,inputs:D(g,{amountIn:E}),lastAmountInputChanged:Ey}))),c=I.a,h=I.b;return d(Ny,c,Vo,zo,h);case"InTypeClicked":return d(Ny,D(t,{showInTypeDropdown:!t.showInTypeDropdown}),Vo,zo,M([d(Yp,"in currency dropdown clicked","input","",0)]));case"InTypeSelected":var A=e.a,B=t.inputs;return function(e){return D(e,{cmdUps:f(co,e.cmdUps,M([d(Yp,"in currency selected","input",Ry(A),0)]))})}(function(e){var t=e.a,r=e.b;return d(Ny,t,Vo,zo,r)}(my(f(Uy,A,D(t,{inputs:D(B,{currencySearch:"",inType:A}),showInTypeDropdown:!1})))));case"AmountOutChanged":var C=e.a,g=t.inputs,E=Em(C),k=function(){var e=t.errors,r=ny(E);if("Ok"===r.$){return _(r.a,D(e,{amountOut:li}))}var n=r.a;return _(li,D(e,{amountOut:fi(n)}))}(),N=k.a,w=k.b,R=gy(f(yy,N,D(t,{errors:w,inputs:D(g,{amountOut:E}),lastAmountInputChanged:Sy}))),c=R.a,h=R.b;return d(Ny,c,Vo,zo,h);case"OutTypeClicked":return d(Ny,D(t,{showOutTypeDropdown:!t.showOutTypeDropdown}),Vo,zo,M([d(Yp,"out currency dropdown clicked","input","",0)]));case"OutTypeSelected":var A=e.a,B=t.inputs;return function(e){return D(e,{cmdUps:f(co,e.cmdUps,M([d(Yp,"out currency selected","input",Ry(A),0)]))})}(function(e){var t=e.a,r=e.b;return d(Ny,t,Vo,zo,r)}(my(f(Oy,A,D(t,{inputs:D(B,{currencySearch:"",outType:A}),showOutTypeDropdown:!1})))));case"SearchInputChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{currencySearch:C})}));case"MarginBoxClicked":return d(Ny,D(t,{showMarginModal:!t.showMarginModal}),Vo,zo,M([d(Yp,"margin box clicked","input","",0)]));case"MarginInputChanged":var C=e.a,g=t.inputs,E=Em(C),x=function(){var e=t.errors,r=f(oy,E,g.marginType);if("Ok"===r.$){var n=r.a;return L(n,$(n,fi(0))?Gp:g.marginType,D(e,{margin:li}))}var a=r.a;return L(li,g.marginType,D(e,{margin:fi(a)}))}(),P=x.a,O=x.b,w=x.c,F=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{errors:w,inputs:D(g,{margin:E,marginType:O}),margin:f(Kc,t.margin,P)})),c=F.a,h=F.b;return d(Ny,c,Vo,zo,h);case"MarginButtonClicked":var V=e.a,g=t.inputs,P=function(){switch(V.$){case"Loss":return t.margin?-Xu(t.margin):-.01;case"Even":return 0;default:return t.margin?Xu(t.margin):.01}}(),K=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{inputs:D(g,{margin:sy(P),marginType:V}),margin:P})),c=K.a,h=K.b;return d(Ny,c,Vo,zo,U(h,M([d(Yp,"margin button clicked","input",Py(V),0)])));case"ReceiveAddressChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{receiveAddress:C})}));case"PaymentMethodChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{paymentMethod:C})}));case"WindowBoxClicked":var H=e.a,g=t.inputs;return d(Ny,D(t,{inputs:D(g,{interval:Ri(f(xy,H,t).num)}),showIntervalModal:fi(H)}),Vo,zo,M([d(Yp,"window box clicked","input",Qp(H),0)]));case"IntervalInputChanged":var C=e.a,j=t.showIntervalModal;if("Just"===j.$){var H=j.a,g=t.inputs,E=Em(C),q=function(){var e=t.errors,r=ay(E);if("Ok"===r.$){var n=r.a;return _(f(Kc,f(xy,H,t),f(xo,function(e){return f(Lp,e,f(xy,H,t).unit)},n)),D(e,{interval:li}))}var a=r.a;return _(f(xy,H,t),D(e,{interval:fi(a)}))}(),G=q.a,w=q.b,c=l(Hy,H,G,D(t,{errors:w,inputs:D(g,{interval:E})}));return d(Ny,c,Vo,zo,vr)}f(op,"Interal input changed, but there is no interval modal open! Wut","");return Ly(t);case"IntervalUnitChanged":var z=e.a,W=t.showIntervalModal;if("Just"===W.$){var H=W.a;return d(Ny,l(Hy,H,f(Lp,f(xy,H,t).num,z),t),Vo,zo,M([d(Yp,"interval unit changed","input",_y(z),0)]))}f(op,"Interal unit changed, but there is no interval modal open! Wut","");return Ly(t);case"CloseModals":var B=t.inputs;return Ly(D(t,{inputs:D(B,{currencySearch:""}),showInTypeDropdown:!1,showIntervalModal:li,showMarginModal:!1,showOutTypeDropdown:!1}));case"PlaceOrderClicked":var Y=e.a,J=e.b,Q=e.c,X=f(gg,J,Q);return d(Ny,D(t,{depositAmount:function(){return"Buyer"===ly(t.mode).$?fi(mg(X)):f(xo,cm,vy(t))}(),txChainStatus:fi(f(Ay,Y,X))}),Vo,zo,M([d(Yp,"place order clicked","txchain",t.inputs.paymentMethod,ri(gm(X.tradeAmount)))]));case"AbortCreate":return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([d(Yp,"abort","txchain","",0)]));case"ConfirmCreate":var Y=e.a,X=e.b,Z=e.c,ee=function(){if("Native"===Y.$)return f(ry,Y,X);var e=Y.a,r=function(){var t=rp(l(ug,rg(e),tg(Y),cg(Z))),r={onBroadcast:li,onMined:li,onSign:fi(f(Iy,e,X))};return f(Zo,r,t)}(),n=t.userAllowance;if("Just"===n.$){var a=n.a;return $(f(cs,a,cg(Z)),Sa)?_(fi(wy(e)),r):f(ry,Y,X)}return _(fi(wy(e)),r)}(),te=ee.a,re=ee.b;return d(Ny,D(t,{txChainStatus:te}),Vo,re,M([d(Yp,"confirm","txchain","",0)]));case"ApproveSigned":var ne=e.a,X=e.b,ae=e.c;if("Ok"===ae.$){var ie=ae.a;return d(Ny,D(t,{txChainStatus:fi(l(Ty,ne,X,ie))}),Vo,zo,M([d(Yp,"approve signed","txchain","",0)]))}var oe=ae.a;return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"appove",oe))]));case"AllowanceFetched":var ne=e.a,i=e.b;if("Ok"===i.$){var ue=i.a,c=D(t,{userAllowance:fi(ue)}),se=_(c.txChainStatus,c.depositAmount);if("Just"===se.a.$&&"ApproveMining"===se.a.a.$&&"Just"===se.b.$){var ce=se.a.a,X=ce.b,fe=se.b.a;if($(f(cs,ue,cg(fe)),Sa))return Ly(c);var le=f(ry,ro(ne),X),te=le.a,re=le.b;return d(Ny,D(c,{txChainStatus:te}),Vo,re,vr)}return Ly(c)}var de=i.a;return d(Ny,t,Vo,zo,M([ya(f(ym,"allowance",de))]));case"CreateSigned":var Y=e.a,ae=e.b;if("Ok"===ae.$){var ie=ae.a;return d(Ny,D(t,{txChainStatus:fi(f(By,Y,ie))}),Vo,zo,M([d(Yp,"create signed","txchain","",0)]))}var oe=ae.a;return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"create",oe))]));case"CreateMined":if("Err"===e.b.$){var Y=e.a,oe=e.b.a;return d(Ny,t,Vo,zo,M([ya(f(mm,"create",oe))]))}var he=e.a,pe=e.b.a,ge=f($o,Wy,zg(f(sv,he,pe)));if("Just"===ge.$){var ve=ge.a;return d(Ny,t,Vo,zo,M([d(Yp,"create mined","txchain","",0),ga(f(qh,he,ve))]))}return d(Ny,t,Vo,zo,M([ya(f(up,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',pe))]));case"NoOp":return Ly(t);default:var ye=e.a;return d(Ny,t,Vo,zo,M([ye]))}}),wm={$:"Refresh"},Im=a(function(e,t,r,n){return{amountIn:e,amountOut:t,interval:n,margin:r}}),Am=d(Im,li,li,li,li),Bm=r(function(e,t){return f(Tm,wm,{depositAmount:li,dhTokenAmount:li,dhTokenType:f(Kc,to(no),jp(e)),errors:Am,foreignCurrencyAmount:li,foreignCurrencyType:Rp(t),inputs:f(Wp,e,t),intervals:Pp(t),lastAmountInputChanged:Ey,margin:0,mode:t,now:Ho(0),prices:vr,showInTypeDropdown:!1,showIntervalModal:li,showMarginModal:!1,showOutTypeDropdown:!1,txChainStatus:li,userAllowance:li,wallet:e})}),km={$:"CloseModals"},Nm=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(Ny,D(t,{wallet:r}),function(){var e=_(Sm(r),jp(r));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var t=e.a.a,n=e.b.a.a;return d(Pv,n,t.address,tg(ro(n)),Cy(n))}return Vo}(),zo,vr)}return f(Tm,km,t)}),$m=r(function(e,t){return f(Bg,function(e){return f(fo,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),Rm=r(function(e,t){return $(f(ol,t.derived.phaseEndTime,e),Aa)}),xm=function(e){return f(xo,sg,sm(e))},_m=function(e){if(""===e)return hi(li);var t=xm(e);if("Nothing"===t.$)return di("I can't interpret this number");var r=t.a;return hi(fi(r))},Lm=r(function(e,t){return{maxDai:t,minDai:e}}),Pm=f(Lm,li,li),Dm=function(e){return jl(e)?li:fi(e)},Um=function(e){return l(Rg,r(function(t,r){return{dai:{max:r,min:t},fiatSymbol:Dm(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(hh,function(e){return D(Pm,{minDai:fi(e)})},_m(e.minDai)),f(hh,function(e){return D(Pm,{maxDai:fi(e)})},_m(e.maxDai)))},Om=Kr,Mm=r(function(e,t){var r=function(t){return f(Bg,function(e){return f(Om,Zp(e),Zp(t))},e)};return f(fo,function(e){return r(e.info)},t)}),Fm=r(function(e,t){return D(t,{paymentMethod:e})}),Vm=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Km=r(function(e,t){return f(cs,cg(e),cg(t))}),Hm=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(co,e.inputs.paymentMethodTerms,M([t]));return jm(D(e,{inputs:f(Vm,r,f(Fm,"",e.inputs))}))},jm=function(e){var t=Hm(e),n=Um(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Mm,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatSymbol;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.symbol,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Km,e.parameters.tradeAmount,r),Sa)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Km,e.parameters.tradeAmount,r),Aa)}()},s=r(function(e,r){return f(Rm,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f($m,t.filters,r)});return D(t,{filterFunc:s})},qm={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:vr},Gm=function(e){return{$:"PricesFetched",a:e}},zm={$:"Expires"},Wm=function(e){return _(jm({errors:Pm,filterFunc:Rm,filters:go(M([f(Eo,!0,!0),d(Bo,!0,!1,!1,!1)])),inputs:qm,now:Ho(0),prices:vr,showCurrencyDropdown:!1,tradeTable:Uo(_(zm,Oo)),wallet:e}),jh(Gm))},Ym=r(function(e,t){var r=f(pp,xc(e),t.inputs.paymentMethodTerms);return jm(D(t,{inputs:f(Vm,r,t.inputs)}))}),Jm=function(e){return jm(D(e,{filterFunc:Rm,inputs:qm}))},Qm=function(e){return{$:"TradeTableMsg",a:e}},Xm=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Zm=function(e){return d(Xm,e,Vo,zo,vr)},eb=r(function(e,t){return D(t,{fiatType:e})}),tb=r(function(e,t){return D(t,{maxDai:e})}),rb=r(function(e,t){return D(t,{minDai:e})}),nb=Q,ab=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Zm(D(t,{now:r}));case"Refresh":return d(Xm,t,jh(Gm),zo,vr);case"PricesFetched":var n=e.a;if("Ok"===n.$){var a=n.a,i=f(Ua,Jh(fl(t.now)),a);return Zm(D(t,{prices:i}))}n.a;return d(Xm,t,Vo,zo,M([ya(tp)]));case"MinDaiChanged":var o=e.a;return Zm(D(t,{inputs:f(rb,Em(o),t.inputs)}));case"MaxDaiChanged":var o=e.a;return Zm(D(t,{inputs:f(tb,Em(o),t.inputs)}));case"FiatTypeInputChanged":var o=e.a;return Zm(D(t,{inputs:f(eb,nb(o),t.inputs)}));case"FiatTypeSelected":var o=e.a;return Zm(jm(D(t,{inputs:f(eb,o,t.inputs),showCurrencyDropdown:!1})));case"ShowCurrencyDropdown":var u=e.a;t.inputs;return Zm(D(t,{inputs:(u?eb(""):Fa)(t.inputs),showCurrencyDropdown:u}));case"FiatTypeLostFocus":return Zm(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var o=e.a;return Zm(D(t,{inputs:f(Fm,o,t.inputs)}));case"AddSearchTerm":return Zm(Hm(t));case"RemoveTerm":var s=e.a;return Zm(f(Ym,s,t));case"ApplyInputs":return d(Xm,jm(t),Vo,zo,vr);case"ResetSearch":return Zm(Jm(t));case"FiltersMsg":var c=e.a;return Zm(jm(D(t,{filters:f(al,c,t.filters)})));case"TradeTableMsg":var l=e.a,h=f(Qh,l,t.tradeTable);return d(Xm,D(t,{tradeTable:h.model}),f(np,Qm,h.cmd),f(ru,Qm,h.chainCmd),f(Ua,Xi(Qm),h.cmdUps));case"NoOp":return Zm(t);default:var p=e.a;return d(Xm,t,Vo,zo,M([p]))}}),ib=function(e){return{$:"ShowCurrencyDropdown",a:e}},ob=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Zm(D(t,{wallet:r}))}return f(ab,ib(!1),t)}),ub=a(function(e,t,r,n){return e(vp(M([_("title",cp(t)),_("body",function(){if("Nothing"===r.$)return gp;var e=r.a;return cp(e)}()),_("image",function(){if("Nothing"===n.$)return gp;var e=n.a;return cp(e)}())])))}),sb=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},cb=function(e){return e.a+"="+e.b},fb=function(e){return e.b?"?"+f(xi,"&",f(Ua,cb,e)):""},lb=r(function(e,t){return"/"+(f(xi,"/",e)+fb(t))}),db=function(e){switch(e.$){case"InitialBlank":return f(lb,M(["DAIHard"]),vr);case"CreateCrypto":return f(lb,M(["DAIHard","create","crypto"]),vr);case"CreateFiat":return f(lb,M(["DAIHard"]),vr);case"Trade":var t=e.a,r=e.b;return f(lb,M(["DAIHard","trade",sb(t),Ri(r)]),vr);case"Marketplace":return f(lb,M(["DAIHard","marketplace"]),vr);case"AgentHistory":var n=e.a;return f(lb,M(["DAIHard","history",sp(n)]),vr);default:return f(lb,vr,vr)}},hb={$:"NotFound"},pb=function(e){return{$:"AgentHistory",a:e}},gb={$:"CreateCrypto"},vb={$:"CreateFiat"},yb={$:"Marketplace"},mb=function(e){return{$:"Parser",a:e}},bb=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Cb=r(function(e,t){return mb(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(bb,f(Ra,u,r),s,a,i,o(l))])}return vr}return vr})}),Eb=f(Cb,"ADDRESS",f(tu,Vg,zg)),Sb={$:"Eth"},Tb={$:"Kovan"},wb=f(Cb,"FACTORY",function(e){switch(e){case"eth":return fi(to(Sb));case"keth":return fi(to(Tb));case"dai":return fi(ro(eo));case"kdai":return fi(ro(Vp));case"xdai":return fi(to(no));default:return li}}),Ib=f(Cb,"NUMBER",cd),Ab=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(bb,r,n,a,i,e(o))}),Bb=r(function(e,t){var r=t.a;return mb(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(Ua,Ab(u),r(h(bb,n,a,i,o,e)))})}),kb=function(e){return l(Da,co,vr,e)},Nb=r(function(e,t){return kb(f(Ua,e,t))}),$b=function(e){return mb(function(t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;if(n.b){var u=n.a,s=n.b;return $(u,e)?M([h(bb,f(Ra,u,r),s,a,i,o)]):vr}return vr})},Rb=r(function(e,t){var r=e.a,n=t.a;return mb(function(e){return f(Nb,n,r(e))})}),xb=mb(function(e){return M([e])}),_b=f(Rb,$b("DAIHard"),function(e){return mb(function(t){return f(Nb,function(e){return(0,e.a)(t)},e)})}(M([f(Bb,gb,$b("cryptoswap")),f(Bb,vb,xb),f(Bb,qh,f(Rb,$b("trade"),f(Rb,wb,Ib))),f(Bb,yb,$b("marketplace")),f(Bb,pb,f(Rb,$b("history"),Eb)),f(Bb,function(e){return pb(e)},f(Rb,$b("history"),Eb))]))),Lb=function(e){e:for(;;){if(e.b){var t=e.a,r=e.b,n=t.unvisited;if(n.b){if(""!==n.a||n.b.b){var a=r;e=a;continue e}return fi(t.value)}return fi(t.value)}return li}},Pb=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Ra,t,Pb(r))}return vr}return vr},Db=function(e){var t=f(Li,"/",e);if(t.b&&""===t.a){var r=t.b;return Pb(r)}var r=t;return Pb(r)},Ub=jt,Ob=r(function(e,t){if("Nothing"===t.$)return fi(M([e]));var r=t.a;return fi(f(Ra,e,r))}),Mb=r(function(e,t){var r=f(Li,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Ub(n);if("Nothing"===o.$)return t;var u=o.a,s=Ub(i);if("Nothing"===s.$)return t;var c=s.a;return l(th,u,Ob(c),t)}return t}),Fb=function(e){if("Nothing"===e.$)return Dd;var t=e.a;return l(Da,Mb,Dd,f(Li,"&",t))},Vb=r(function(e,t){var r=e.a;return Lb(r(h(bb,vr,Db(t.path),Fb(t.query),t.fragment,Fa)))}),Kb=function(e){return f(Kc,hb,f(Vb,_b,e))},Hb=Ge("connectToWeb3",function(e){return gp}),jb=function(e){return vp(M([_("event",cp(e.event)),_("category",cp(e.category)),_("label",cp(e.label)),_("value",Cp(e.value))]))},qb=r(function(e,t){return vp(M([_("address",cp(sp(e))),_("signSeedMsg",cp(t))]))}),Gb=Ge("gTagOut",Fa),zb=Ge("genPrivkey",Fa),Wb=r(function(e,t){for(;;){if(!t.b)return li;var r=t.a,n=t.b;if(e(r))return fi(r);var a=e,i=n;e=a,t=i}}),Yb=n(function(e,t,r){return f($o,sf(t),f(xo,function(e){return e.trades},f(Wb,function(t){return $(t.factory,e)},r)))}),Jb=Ge("notifyPort",Fa),Qb=Ge("requestNotifyPermissionPort",function(e){return gp}),Xb=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Zb=function(e){return{$:"PartiallyLoadedTrade",a:e}},eC=r(function(e,t){return Zb(g(Xb,e,t,li,li,li,li,li))}),tC=function(e){return{$:"CurrentBlockFetched",a:e}},rC=Tu(f(tu,yu,Pg)),nC=function(e){return Ev({decoder:rC,method:"eth_blockNumber",params:vr,url:e})},aC=function(e){return f(Lv,tC,nC(e))},iC=r(function(e,t){return{address_:e,blocknum:t}}),oC=function(e){return nu(function(t){return hi(_(t,e))})},uC=n(function(e,t,r){var n=t.a,a=r.a;return nu(function(t){return f(uv,function(t){var r=t.a,n=t.b;return f(du,Jh(e(n)),a(r))},n(t))})}),sC=r(function(e,t){return l(uC,r(function(e,t){return e(t)}),t,e)}),cC=wu(f(sC,tv,f(sC,Kg,oC(iC)))),fC=r(function(e,t){return{data:fi(f(el,"createdTrades(uint256)",M([og(t)]))),decoder:cC,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),lC=n(function(e,t,r){return f(Lv,r,f(wv,fv(e),f(fC,tg(e),t)))}),dC=function(e){return{$:"CreationInfoFetched",a:e}},hC=r(function(e,t){return l(lC,e,Zu(t),dC)}),pC=function(e){return{$:"EventSentryMsg",a:e}},gC=function(e){return{$:"BlockNumber",a:e}},vC=function(e){return{$:"EventSentry",a:e}},yC=function(e){return{$:"Set_elm_builtin",a:e}},mC=yC(Dd),bC=r(function(e,t){return _(vC({blockNumber:li,errors:vr,nodePath:t,pending:mC,ref:1,requests:Dd,tagger:e,watching:mC}),f(Lv,f(tu,gC,e),nC(t)))}),CC=function(e){return f(bC,pC,fv(e))},EC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),SC=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},TC=SC(f(EC,li,li)),wC=n(function(e,t,r){return{allowance:li,blocknumOnInit:li,chatHistoryModel:li,eventSentry:t,eventsWaitingForChatHistory:vr,expandedPhase:Io,secureCommInfo:TC,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:li,wallet:r}}),IC=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),AC=n(function(e,t,r){var n=f(hC,t,r),a=CC(t),i=a.a,o=a.b;return d(IC,l(wC,f(eC,t,r),i,e),Fo(M([n,o,aC(fv(t))])),zo,M([va]))}),BC=function(e){return{$:"LoadedTrade",a:e}},kC=function(e){return{$:"EventLogFetched",a:e}},NC=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),$C=se,RC=le,xC=Yr,_C=n(function(e,t,r){var n=function(e){return RC(M([e,$C(r)]))};return f(Cu,function(a){var i=f(nv,e,a);if("Ok"===i.$){var o=i.a,u=f(nv,n(t),o);if("Ok"===u.$){var s=u.a;return Ki(s)}var c=u.a;return Eu(Oi(c))}return Ki(r)},xC)}),LC=a(function(e,t,r,n){return f(bg,l(_C,f(hl,e,xC),t,r),n)}),PC=n(function(e,t,r){return f(bg,f(hl,e,t),r)}),DC=Tu(Vg),UC=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),OC=function(e){return{$:"BlockHash",a:e}},MC=function(e){return UC(e)?hi(OC(yu(e))):di("Given blockHash "+Fg(e)+" is not valid.")},FC=Tu(MC),VC=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-fA-F]+$"))),KC=function(e){return VC(e)?hi(lc(yu(e))):di("Something in here is not very hexy: "+Fg(e))},HC=Tu(KC),jC=function(e){return{$:"TxHash",a:e}},qC=function(e){return UC(e)?hi(jC(yu(e))):di("Given txHash "+Fg(e)+" is not valid.")},GC=Tu(qC),zC=c(function(e,t,r,n,a,i,o,u,s){return{address:e,blockHash:u,blockNumber:s,data:t,logIndex:a,removed:n,topics:r,transactionHash:o,transactionIndex:i}}),WC=zr,YC=ue,JC=l(PC,"blockNumber",rC,l(PC,"blockHash",FC,l(PC,"transactionHash",GC,l(PC,"transactionIndex",rC,l(PC,"logIndex",rC,d(LC,"removed",WC,!1,l(PC,"topics",YC(HC),l(PC,"data",Su,l(PC,"address",DC,Ki(zC)))))))))),QC=function(e){return f(av,function(e){if("Just"===e.$){var t=e.a;return cp(Zf(t))}return gp},e)},XC=function(e){return vp(M([_("fromBlock",lv(e.fromBlock)),_("toBlock",lv(e.toBlock)),_("address",fp(e.address)),_("topics",QC(e.topics))]))},ZC=r(function(e,t){return Ev({decoder:YC(JC),method:"eth_getLogs",params:M([XC(t)]),url:e})}),eE=function(e){return{$:"BlockNum",a:e}},tE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Bh,function(r){return f(Bv,mi(r),f(ZC,e,D(t,{fromBlock:eE(n),toBlock:eE(a)})))},f(ZC,e,t)):f(ZC,e,t)}),rE=r(function(e,t){var r=t.a;return yC(l(Kd,e,pr,r))}),nE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(Kd,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return L(vC(D(o,{watching:f(rE,a.ref,o.watching)})),f(Lv,f(tu,NC(a.ref),a.tagger),e),a.ref)}(l(tE,a.nodePath,n,_(s,s)))}return L(vC(D(o,{pending:f(rE,a.ref,o.pending)})),Vo,a.ref)}),aE=nE(!1),iE=r(function(e,t){var r=function(){var e=CC(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return L(t,Fo(M([n,r])),a)}(l(aE,kC,r,{address:t.creationInfo.address,fromBlock:eE(t.creationInfo.blocknum),toBlock:Tv,topics:vr}))}(),n=r.a,a=r.b;return d(IC,l(wC,BC(t),n,e),Fo(M([a,aC(fv(t.factory))])),zo,M([va]))}),oE=function(e){return{$:"AllowanceFetched",a:e}},uE=function(e){return d(IC,e,Vo,zo,vr)},sE=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(IC,D(t,{wallet:r}),function(){var e=L(Sm(r),jp(r),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var n=e.a.a,a=e.b.a.a,i=e.c.a;return $(jp(r),fi(i.factory))?d(Pv,a,n.address,i.creationInfo.address,oE):Vo}return Vo}(),zo,vr)}return uE(D(t,{showChatHistory:!1,showStatsModal:!1}))}),cE=function(e){return{data:fi(f(el,"abort()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},fE=function(e){return{data:fi(f(el,"burn()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},lE=function(e){return{data:fi(f(el,"claim()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},dE=r(function(e,t){return{data:fi(f(el,"initiatorStatement(string)",M([Fv(t)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),hE=function(e){return{data:fi(f(el,"recall()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},pE=function(e){return{data:fi(f(el,"release()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},gE=r(function(e,t){return{data:fi(f(el,"responderStatement(string)",M([Fv(t)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),vE={$:"Invalid"},yE=r(function(e,t){return{amount:t,symbol:e}}),mE=f(Cu,function(e){var t=tm(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("Can't convert that to a BigInt")},Su),bE=RC(M([l(Vi,yE,f(qg,0,Su),f(Cu,function(e){var t=Jl(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("Error converting BigInt to float")},f(Fi,zy,f(qg,1,mE)))),l(Vi,yE,f(qg,0,Su),f(qg,1,pl))])),CE=r(function(e,t){return{info:t,type_:e}}),EE={$:"Bank"},SE={$:"Cash"},TE={$:"Custom"},wE=function(e){switch(e){case"cash":return fi(SE);case"bank":return fi(EE);case"custom":return fi(TE);default:return li}},IE=f(Cu,function(e){var t=wE(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("")},Su),AE=l(Vi,CE,f(hl,"type",IE),f(hl,"info",Su)),BE=function(e){var t=l(Vi,Hv,f(hl,"price",bE),f(hl,"paymentmethods",YC(AE)));return f(Eh,t,e)},kE=r(function(e,t){return{commPubkey:t,responder:e}}),NE=r(function(e,t){var n=r(function(t,r){return l(ou,t,t+2*r,e)}),a=f(tu,Pg,du(ai(2)));return f(uv,function(t){return f(du,function(e){return f(n,t+64,e)},Pg(l(ou,t,t+64,e)))},a(t))}),$E=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=function(e){return 63&e|n<<6};return a?1===a?L(0,0,f(e,o(t),i)):L(o(t),a-1,i):128&t?192==(224&t)?L(31&t,1,i):224==(240&t)?L(15&t,2,i):L(7&t,3,i):L(0,0,f(e,t,i))}),RE=n(function(e,t,r){var n=l(_a,$E(e),L(0,0,t),r);if(n.b)return di("invalid UTF-8 sequence");var a=n.c;return hi(a)}),xE=q,_E=function(e){return Ls(xE(e))},LE=function(e){return l(RE,r(function(e,t){return U(t,_E(e))}),"",e)},PE=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),f(uv,LE,f(uv,f(tu,Ua(Pg),xg),f(du,pp(f(tu,jl,ls)),f(du,cc(2),f(NE,t,lu(r)))))))}),DE=f(bg,f(jg,1,PE),f(bg,f(jg,0,Kg),Ki(kE))),UE=r(function(e,t){return{commPubkey:t,terms:e}}),OE=f(bg,f(jg,1,PE),f(bg,f(jg,0,PE),Ki(UE))),ME=function(e){return{statement:e}},FE=f(bg,f(jg,0,PE),Ki(ME)),VE=function(e){return{statement:e}},KE=f(bg,f(jg,0,PE),Ki(VE)),HE={$:"AbortedEvent"},jE={$:"BurnedEvent"},qE={$:"ClaimedEvent"},GE=function(e){return{$:"CommittedEvent",a:e}},zE=function(e){return{$:"InitiatedEvent",a:e}},WE=function(e){return{$:"InitiatorStatementLogEvent",a:e}},YE={$:"PokeEvent"},JE={$:"RecalledEvent"},QE={$:"ReleasedEvent"},XE=function(e){return{$:"ResponderStatementLogEvent",a:e}},ZE=f(hl,"topics",f(qg,0,HC)),eS=function(e){return lc(f(xi,"",f(Ua,f(tu,Hs,gc),Jf(f(Ua,bi,uc(e))))))},tS=f(Cu,function(e){return $(e,eS("Initiated(string,string)"))?f(Fi,zE,OE):$(e,eS("Committed(address,string)"))?f(Fi,GE,DE):$(e,eS("Recalled()"))?Ki(JE):$(e,eS("Claimed()"))?Ki(qE):$(e,eS("Aborted()"))?Ki(HE):$(e,eS("Released()"))?Ki(QE):$(e,eS("Burned()"))?Ki(jE):$(e,eS("InitiatorStatementLog(string)"))?f(Fi,WE,FE):$(e,eS("ResponderStatementLog(string)"))?f(Fi,XE,KE):$(e,eS("Poke()"))?Ki(YE):Eu("Unrecognized topic hash")},ZE),rS=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},nS=function(e){switch(e.$){case"Invalid":return li;case"PartiallyLoadedTrade":var t=e.a;return fi(t.factory);default:var r=e.a;return fi(r.factory)}},aS=function(e){return $(e.buyerDeposit,hg(e.tradeAmount))&&$(e.abortPunishment,dg(e.tradeAmount))},iS=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),oS=r(function(e,t){return Ho(il(t)+il(e))}),uS=n(function(e,t,r){var n=function(){switch(t.phase.$){case"Open":return e.autorecallInterval;case"Committed":return e.autoabortInterval;case"Judgment":return e.autoreleaseInterval;default:return Ho(0)}}();return{phaseEndTime:function(){return"Closed"===t.phase.$?Ho(f(Uu,2,53)-1):f(oS,t.phaseStartTime,n)}()}}),sS=function(e){var t=L(_(e.creationInfo,e.parameters),_(e.state,e.terms),e.phaseStartInfo);if("Just"===t.a.a.$&&"Just"===t.a.b.$&&"Just"===t.b.a.$&&"Just"===t.b.b.$&&"Just"===t.c.$){var r=t.a,n=r.a.a,a=r.b.a,i=t.b,o=i.a.a,u=i.b.a,s=t.c.a;return BC(v(iS,e.factory,e.id,n,a,o,u,s,l(uS,a,o,u)))}return Zb(e)},cS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{creationInfo:fi(e)}));case"LoadedTrade":f(op,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vE}}),fS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{parameters:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vE}}),lS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{phaseStartInfo:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vE}}),dS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{state:fi(e)}));case"LoadedTrade":var n=t.a;return BC(D(n,{state:e}));default:return vE}}),hS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{terms:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vE}}),pS=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiatedByCustodian:t,initiator:e,pokeReward:s,tradeAmount:r}}),gS=wu(f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,gu,f(sC,Kg,oC(pS))))))))))),vS=function(e){return{data:fi(f(el,"getParameters()",vr)),decoder:gS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},yS=function(e){return f(xo,function(e){return Ho(1e3*e)},cd(zy(e)))},mS=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return di(a)}var i=t.a;if("Err"===r.$){var a=r.a;return di(a)}var o=r.a;if("Err"===n.$){var a=n.a;return di(a)}var u=n.a;return hi(l(e,i,o,u))}),bS=function(e){var t=f(ev,"error converting BigInt to Time.Posix",yS(e.autoabortInterval)),r=f(ev,"error converting BigInt to Time.Posix",yS(e.autoreleaseInterval)),a=f(ev,"error converting BigInt to Time.Posix",yS(e.autorecallInterval));return d(mS,n(function(t,r,n){return{abortPunishment:Yy(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Yy(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?yo:vo,pokeReward:Yy(e.pokeReward),tradeAmount:Yy(e.tradeAmount)}}),a,t,r)},CS=n(function(e,t,r){return f(Lv,r,f(Bv,bS,f(wv,fv(e),vS(t))))}),ES=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return{v0:e,v1:t,v2:r,v3:n,v4:a,v5:i,v6:o,v7:u,v8:s,v9:c}}}}}}}}}}},SS=wu(f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,oC(ES)))))))))))),TS=function(e){return{data:fi(f(el,"getPhaseStartInfo()",vr)),decoder:SS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},wS=i(function(e,t,r,n,a){if("Nothing"===t.$)return li;var i=t.a;if("Nothing"===r.$)return li;var o=r.a;if("Nothing"===n.$)return li;var u=n.a;if("Nothing"===a.$)return li;var s=a.a;return fi(d(e,i,o,u,s))}),IS=function(e){return h(wS,a(function(t,r,n,a){return{claimedBlock:e.v3,claimedTime:n,closedBlock:e.v4,closedTime:a,committedBlock:e.v2,committedTime:r,openedBlock:e.v1,openedTime:t}}),yS(e.v6),yS(e.v7),yS(e.v8),yS(e.v9))},AS=n(function(e,t,r){return f(Lv,r,f(Bv,IS,f(wv,fv(e),TS(t))))}),BS=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),kS=wu(f(sC,tv,f(sC,Kg,f(sC,tv,f(sC,tv,f(sC,tv,oC(BS))))))),NS=function(e){return{data:fi(f(el,"getState()",vr)),decoder:kS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},$S={$:"Aborted"},RS={$:"Burned"},xS={$:"NotClosed"},_S={$:"Recalled"},LS={$:"Released"},PS=function(e){switch(f(Kc,99,cd(zy(e)))){case 0:return fi(xS);case 1:return fi(_S);case 2:return fi($S);case 3:return fi(LS);case 4:return fi(RS);default:return li}},DS=function(e){switch(f(Kc,99,cd(zy(e)))){case 1:return fi(Io);case 2:return fi(To);case 3:return fi(wo);case 4:return fi(So);default:return li}},US=function(e){return $(e,eg("0x0000000000000000000000000000000000000000"))?li:fi(e)},OS=a(function(e,t,r,n){if("Nothing"===t.$)return li;var a=t.a;if("Nothing"===r.$)return li;var i=r.a;if("Nothing"===n.$)return li;var o=n.a;return fi(l(e,a,i,o))}),MS=function(e){var t=yS(e.phaseStartTimestamp),r=DS(e.phase),a=PS(e.closedReason);return d(OS,n(function(t,r,n){return{balance:Yy(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:US(e.responder)}}),r,t,a)},FS=n(function(e,t,r){return f(Lv,r,f(Bv,MS,f(wv,fv(e),NS(t))))}),VS=i(function(e,t,r,n,a){return Fo(M([l(CS,e,t,r),l(FS,e,t,n),l(AS,e,t,a)]))}),KS=function(e){var t=Wy(e);if("Just"===t.$){return t.a}f(op,"Warning! BigInt to Int conversion failed!",zy(e));return 0},HS=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),jS=n(function(e,t,r){for(;;){var n=f(Qa,32,e),a=n.a,i=n.b;if(x(ii(a),32)<0)return f(oi,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Ra,Ya(a),t),s=r+1;e=o,t=u,r=s}}),qS=function(e){return e.b?l(jS,e,vr,0):Wa},GS=rn,zS=function(e){var t=h(GS,HS,f(hl,"encapsulation",Su),f(hl,"iv",Su),f(hl,"tag",Su),f(hl,"encrypted",Su)),r=YC(t),n=f(nv,r,e);if("Err"===n.$){var a=n.a;return di(Oi(a))}var i=n.a;return function(e){var t=_(f(sf,0,e),f(sf,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return hi(_(r,n))}return di("Decoded list has less than 2 items.")}(qS(i))},WS=function(e){var t=function(e){var t=iu(e);return t>1114111?di("string is too long"):hi(f(_s,xE(t),e))};return f(du,xi(""),xg(f(Ua,t,e)))},YS=function(e){var t=e.a,r=e.b;return WS(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},JS=r(function(e,t){return vp(M([_("message",cp(e)),_("pubkeyHexStrings",f(av,cp,M([t.initiatorPubkey,t.responderPubkey])))]))}),QS=function(e){return{$:"LoadedCommInfo",a:e}},XS=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),ZS=function(e){var t=_(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return QS(f(XS,r,n))}return SC(e)},eT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return ZS(D(r,{initiatorPubkey:fi(e)}))}var n=t.a;return QS(D(n,{initiatorPubkey:e}))}),tT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return ZS(D(r,{responderPubkey:fi(e)}))}var n=t.a;return QS(D(n,{responderPubkey:e}))}),rT=r(function(e,t){var r=_(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return vo}r.a,r.b;return yo}if("Buyer"===r.b.$){r.a,r.b;return yo}r.a,r.b;return vo}),nT=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=bi(r),i=f(Wg,a,n),o=Ms(f(bc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),aT=n(function(e,t,r){if("Nothing"===t.$)return li;var n=t.a;if("Nothing"===r.$)return li;var a=r.a;return fi(f(e,n,a))}),iT=function(e){var t=qS(f(nT,uc(e),vr));return l(aT,dl,h(wS,HS,f(sf,0,t),f(sf,1,t),f(sf,2,t),f(sf,3,t)),h(wS,HS,f(sf,4,t),f(sf,5,t),f(sf,6,t),f(sf,7,t)))},oT=r(function(e,t){if("Statement"===t.$){t.a;return l(ha,"New Message from Trade",li,li)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(ha,n,li,li)}),uT={$:"Aborted"},sT={$:"Burned"},cT={$:"Claimed"},fT=function(e){return{$:"Committed",a:e}},lT=function(e){return{$:"Encrypted",a:e}},dT={$:"FailedDecode"},hT={$:"Initiated"},pT={$:"Recalled"},gT={$:"Released"},vT=function(e){return{$:"StateChange",a:e}},yT=function(e){return{$:"Statement",a:e}},mT=cr,bT=sr,CT=r(function(e,t){var r=ii(e),n=32-ii(t.tail)-r,a=l(mT,32,t.tail,e);return n<0?{nodeList:f(Ra,Ya(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(bT,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Ra,Ya(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:za}}),ET=ir,ST=y,TT=a(function(e,t,r,n){var a=nf&t>>>e;if(x(a,ii(n))>-1){if(5===e)return f(ET,Ya(r),n);var i=Ja(d(TT,e-Ga,t,r,za));return f(ET,i,n)}var o=f(af,a,n);if("SubTree"===o.$){var u=o.a,i=Ja(d(TT,e-Ga,t,r,u));return l(lf,a,i,n)}var i=Ja(d(TT,e-Ga,t,r,ST(o)));return l(lf,a,i,n)}),wT=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ii(i),u=ii(e),s=r+(u-o);if($(u,32)){if(x(s>>>Ga,1<0){var c=n+Ga,f=d(TT,c,r,e,ST(Ja(a)));return d(Ka,s,c,f,za)}return d(Ka,s,n,d(TT,n,r,e,a),za)}return d(Ka,s,n,a,e)}),IT=r(function(e,t){var r=(t.a,t.c,t.d),n=ii(e),a=32-ii(r)-n,i=l(mT,32,r,e),o=f(wT,i,t);if(a<0){var u=l(bT,a,n,e);return f(wT,u,o)}return o}),AT=or,BT=function(e){var t=e.a,n=e.c,a=e.d,i=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,i,t,r)}return f(Ra,e,t)});return{nodeList:l(AT,i,vr,n),nodeListSize:t/32|0,tail:a}},kT=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(x(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,o,t,r)}var n=e.a;return f(IT,n,t)});return f(IT,i,l(AT,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,o,t,r)}var n=e.a;return f(CT,n,t)});return f(oi,!0,f(CT,i,l(AT,o,BT(e),a)))}),NT=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Ra,r,t)}),$T=f(Da,NT,vr),RT=n(function(e,t,r){var n=rT(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return fi(vT(hT));case"CommittedEvent":var r=t.a;return fi(vT(fT(r.responder)));case"RecalledEvent":return fi(vT(pT));case"ClaimedEvent":return fi(vT(cT));case"AbortedEvent":return fi(vT(uT));case"ReleasedEvent":return fi(vT(gT));case"BurnedEvent":return fi(vT(sT));case"InitiatorStatementLogEvent":var r=t.a;return fi(yT({blocknum:e,message:function(){var e=iT(r.statement);if("Just"===e.$){var t=e.a;return lT(t)}return dT}(),who:n(ko)}));case"ResponderStatementLogEvent":var r=t.a;return fi(yT({blocknum:e,message:function(){var e=iT(r.statement);if("Just"===e.$){var t=e.a;return lT(t)}return dT}(),who:n(No)}));default:return li}}(),i=f(xo,function(t){return{blocknum:e,eventInfo:t,time:li}},a),o=f(kT,r.history,qS($T(M([i])))),u=x(e,r.lastNotificationBlocknum)>0?_(f(xo,oT($(r.userRole,r.trade.parameters.initiatorRole)),a),e):_(li,r.lastNotificationBlocknum),s=u.a;return L(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),$T(M([s])))}),xT=Gr,_T=function(e){var t=l(Vi,dl,f(hl,"id",xT),f(hl,"message",Su));return f(hh,Oi,f(nv,t,e))},LT=function(e){return{$:"Decrypted",a:e}},PT=a(function(e,t,r,n){return{cmdUps:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),DT=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(RT,n,a,t),o=i.a,u=i.b,s=i.c;return d(PT,o,u,li,s);case"MessageInputChanged":var c=e.a;return d(PT,D(t,{messageInput:c}),!1,li,vr);case"MessageSubmit":return d(PT,D(t,{messageInput:""}),!1,fi(t.messageInput),vr);default:var h=e.a,p=_T(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(sf,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:LT(y)}),T=D(b,{eventInfo:yT(S)}),w=l(hf,v,T,t.history);return d(PT,D(t,{history:w}),!1,li,vr)}return d(PT,t,!1,li,M([ya(f(up,"got a decryption result, but for an event that is not a message!",b))]))}return d(PT,t,!1,li,M([ya(f(up,"got a decryption result, but for an id out of bounds!",_(v,t.history)))]))}var I=p.a;return d(PT,t,!1,li,M([ya(f(up,"Error decoding decryption result",I))]))}}),UT=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),OT=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),MT=function(e){return{onBroadcast:li,onMined:fi(_(UT(e),li)),onSign:fi(OT(e))}},FT=Ge("encryptToPubkeys",Fa),VT=n(function(e,t,r){return{data:fi(f(el,"commit(address,string)",M([ag(t),Fv(r)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),KT=n(function(e,t,r){return{data:fi(f(el,"commit(address,string)",M([ag(t),Fv(r)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),HT=function(e){return{$:"CommitMined",a:e}},jT={$:"CommitNeedsSig"},qT=function(e){return{$:"CommitSigned",a:e}},GT=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?KT:VT}(),a=rp(function(){return"Token"===e.factory.$?Fa:Yv(cg(rS(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return _(fi(jT),f(Zo,{onBroadcast:li,onMined:fi(_(HT,li)),onSign:fi(qT)},a))}),zT=r(function(e,t){return vp(M([_("id",Cp(e)),_("encapsulation",cp(t.encapsulatedKey)),_("iv",cp(t.iv)),_("tag",cp(t.tag)),_("encrypted",cp(t.message))]))}),WT=Ge("decryptMessage",Fa),YT=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return _(r-1,f(Ra,_(r,e),n))});return l(wa,n,_(t-1,vr),e).b},JT=r(function(e,t){return Fo(f(Ua,function(e){var r=e.a,n=e.b,a=n.eventInfo;if("Statement"===a.$){var i=a.a,o=i.message;if("Encrypted"===o.$){var u=o.a,s=function(){return"Initiator"===t.$?u.a:u.b}();return WT(f(zT,r,s))}return Vo}return Vo},YT(e.history)))}),QT=function(e){if("Just"===e.$){return e.a}return li},XT=function(e){var t=QT(l(aT,Ro,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return fi(r)}return li}(),f(xo,function(e){return e.address},Sm(e.wallet)))),r=_(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(JT,n,a)}return Vo},ZT=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return L(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(RT,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=L(d,n||h,f(co,a,p));e=g,t=v}}),e,L(t,!1,vr))}),ew=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),tw=i(function(e,t,r,n,a){return f(ZT,n,p(ew,e,r,t,Wa,a,""))}),rw=function(e){return{$:"ChatHistoryMsg",a:e}},nw=a(function(e,t,r,n){var a=L(t,Sm(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(_o,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return L(fi(t),r,f(Ua,Xi(rw),n))}(h(tw,e,c,i,n,u))}return L(li,!1,vr)}return L(li,!1,vr)}),aw={$:"Abort"},iw=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),ow=function(e){return{$:"ActionNeedsSig",a:e}},uw=function(e){return{$:"ApproveMining",a:e}},sw={$:"ApproveNeedsSig"},cw=function(e){return{$:"ApproveSigned",a:e}},fw={$:"Burn"},lw={$:"Claim"},dw=function(e){return{$:"CommitMining",a:e}},hw=function(e){return{$:"ConfirmingAction",a:e}},pw=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),gw=function(e){return{$:"ParametersFetched",a:e}},vw=function(e){return{$:"PhaseInfoFetched",a:e}},yw={$:"Poke"},mw={$:"Recall"},bw={$:"Release"},Cw=function(e){return{$:"StartContractAction",a:e}},Ew=function(e){return{$:"StateFetched",a:e}},Sw=function(e){switch(e.$){case"Poke":return"poke";case"Recall":return"recall";case"Claim":return"claim";case"Abort":return"abort";case"Release":return"release";default:return"burn"}},Tw={align:Xh,label:"cantFindTradeWillRetry",mainParagraphs:M([M([ep("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:vm},ww=r(function(e,t){if("Err"===t.$){var r=t.a;return f(ym,e,r)}if("Nothing"===t.a.$){t.a;return f(up,"Couldn't decode the fetched \""+e+'" result.',li)}return f(up,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),Iw={align:Xh,label:"tradeParametersNotDefault",mainParagraphs:M([M([ep("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:vm},Aw=ro(eo),Bw=n(function(e,t,r){return l(th,e,xo(function(e){return D(e,{logCount:Ii(t)+e.logCount})}),r)}),kw=r(function(e,t){var r=t.a;return yC(f(eh,e,r))}),Nw=r(function(e,t){return xv(Iv(f(Bv,e,t)))}),$w=n(function(e,t,r){var n=e.a,a=f(Gd,t,n.requests);if("Nothing"===a.$)return _(vC(n),Vo);var i=a.a,o=_(i.watchOnce,ov(r));if("Nothing"===o.b.$){o.b;return _(vC(D(n,{requests:l(Bw,t,r,n.requests)})),Vo)}if(o.a){var u=o.b.a;return _(vC(D(n,{requests:l(Bw,t,r,n.requests),watching:f(kw,t,n.watching)})),f(Nw,i.tagger,wh(u)))}return _(vC(D(n,{requests:l(Bw,t,r,n.requests)})),Fo(f(Ua,function(e){return f(Nw,i.tagger,wh(e))},r)))}),Rw=Le,xw=r(function(e,t){return f(Lv,f(tu,gC,t),f(Bh,function(t){return nC(e)},Rw(2e3)))}),_w=n(function(e,t,r){var n=r.a,a=r.b;return f(ZC,e,D(t,{fromBlock:eE(n),toBlock:eE(a)}))}),Lw=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(Lw,e,t,i)),c=o;e=u,t=s,r=c}}),Pw=r(function(e,t){return l(Lw,Kd,t,e)}),Dw=r(function(e,t){var r=e.a,n=t.a;return yC(f(Pw,r,n))}),Uw=r(function(e,t){var r=t.a;if("BlockNumber"===e.$){if("Ok"===e.a.$){var a=e.a.a,i=n(function(e,t,n){return Fo(f(Ua,function(t){return f(Lv,f(tu,NC(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},$T(f(Ua,function(e){return f(Gd,e,r.requests)},$a(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?_(vC(D(r,{blockNumber:fi(a)})),Fo(M([f(xw,r.nodePath,r.tagger),l(i,_(u+1,a),r.watching,_w)]))):_(t,f(xw,r.nodePath,r.tagger))}return _(vC(D(r,{blockNumber:fi(a),pending:mC,watching:f(Dw,r.watching,r.pending)})),Fo(M([f(xw,r.nodePath,r.tagger),l(i,_(a,a),r.pending,tE),l(i,_(a,a),r.watching,_w)])))}var s=e.a.a;return _(vC(D(r,{errors:f(Ra,s,r.errors)})),f(xw,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l($w,t,c,d)}var s=e.b.a;return _(vC(D(r,{errors:f(Ra,s,r.errors)})),Vo)}),Ow=function(e){return M([e])},Mw=r(function(e,t){e:for(;;)switch(e.$){case"Refresh":var r=(e.a,function(){var e=t.trade;if("PartiallyLoadedTrade"===e.$){var r=e.a;return"Nothing"===r.creationInfo.$?f(hC,r.factory,r.id):Vo}}(),function(){var e=L(Sm(t.wallet),jp(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return $(jp(t.wallet),fi(a.factory))?d(Pv,n,r.address,a.creationInfo.address,oE):Vo}return Vo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(nw,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1,vr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?XT(t):Vo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(IC,u,Fo(M([l(FS,p.factory,p.creationInfo.address,Ew),s,r])),zo,o)}return uE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return uE(D(t,{blocknumOnInit:fi(v)}))}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:fi(m)}),b=L(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if($(f(cs,m,cg(rS(C.parameters))),Sa))return uE(u);var S=l(GT,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(IC,D(u,{txChainStatus:T}),Vo,w,vr)}return uE(u)}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:KS(I.blocknum)},B=l(aE,kC,t.eventSentry,{address:A.address,fromBlock:eE(A.blocknum),toBlock:Tv,topics:vr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(cS,A,t.trade)}),R=f(Kc,Aw,nS(u.trade)),x=Fo(M([N,h(VS,R,A.address,gw,Ew,vw)]));return d(IC,u,x,zo,vr)}if("BadBody"===g.a.$){g.a.a;return d(IC,t,Vo,zo,M([ya(Tw)]))}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(dS,P,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,t,Vo,zo,M([ya(f(ww,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(aS(F)){var u=D(t,{trade:f(fS,F,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,D(t,{trade:vE}),Vo,zo,M([ya(Iw)]))}var V=g.a.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(lS,H,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,t,Vo,zo,M([ya(f(ww,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(iv,tS,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error decoding contract event",z))]))}var W=G.a,Y=function(){switch(W.$){case"InitiatedEvent":var e=W.a;return f(eT,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=W.a;return f(tT,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===W.$){var e=W.a,r=BE(e.terms);if("Ok"===r.$){var n=r.a;return _(f(hS,n,t.trade),li)}var a=r.a;return _(t.trade,fi(f(up,"Couldn't decode payment methods!",a)))}return _(t.trade,li)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return L(fi(r),!1,vr)}return d(nw,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return _(function(e){var t=e.a,r=e.b,n=e.c;return L(fi(t),r||te,f(co,re,f(Ua,Xi(rw),n)))}(l(RT,q.blockNumber,W,e)),vr)}return _(L(li,!1,re),f(co,t.eventsWaitingForChatHistory,M([_(q.blockNumber,W)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=D(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:Y,trade:Q}),x=oe?XT(u):Vo;return d(IC,u,x,zo,f(co,f(Ua,ya,$T(M([X]))),ue));case"ExpandPhase":var ce=e.a;return uE(D(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return uE(D(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return uE(D(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var C=de.a;return d(IC,t,Vo,zo,M([ga(pb(C.parameters.initiatorAddress))]))}return d(IC,t,Vo,zo,M([ya(f(up,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,he=e.c;return uE(D(t,{txChainStatus:fi(f(pw,E,he))}));case"AbortAction":return uE(D(t,{txChainStatus:li}));case"ConfirmCommit":var C=e.a,E=e.b,he=e.c,pe=function(){var e=C.factory;if("Native"===e.$)return l(GT,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=rp(l(ug,rg(r),C.creationInfo.address,he)),t={onBroadcast:li,onMined:li,onSign:fi(cw)};return f(Zo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(cs,i,cg(rS(C.parameters))),Sa)?_(fi(sw),n):l(GT,C,E.address,E.commPubkey)}return _(fi(sw),n)}(),T=pe.a,w=pe.b;return d(IC,D(t,{txChainStatus:T}),Vo,w,vr);case"ContractActionClicked":var ge=e.a;if($(ge,yw)||$(ge,mw)){var ve=Cw(ge),ye=t;e=ve,t=ye;continue e}return uE(D(t,{txChainStatus:fi(hw(ge))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return L(t.txChainStatus,zo,M([ya(f(up,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=rp(hE(n.creationInfo.address));return L(fi(ow(mw)),f(Zo,MT(mw),a),vr);case"Claim":var a=rp(lE(n.creationInfo.address));return L(fi(ow(lw)),f(Zo,MT(lw),a),vr);case"Abort":var a=rp(cE(n.creationInfo.address));return L(fi(ow(aw)),f(Zo,MT(aw),a),vr);case"Release":var a=rp(pE(n.creationInfo.address));return L(fi(ow(bw)),f(Zo,MT(bw),a),vr);case"Burn":var a=rp(fE(n.creationInfo.address));return L(fi(ow(fw)),f(Zo,MT(fw),a),vr);default:var a=rp(tl(n.creationInfo.address));return L(fi(ow(yw)),f(Zo,MT(yw),a),vr)}}(),T=be.a,w=be.b,o=be.c;return d(IC,D(t,{txChainStatus:T}),Vo,w,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(uw(Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(dw(Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"commit",V))]));case"CommitMined":return uE(D(t,{txChainStatus:li}));case"ActionSigned":var ge=e.a,Ce=e.b;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(f(iw,ge,Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,Sw(ge),V))]));case"ActionMined":var ge=e.a;return uE(D(t,{txChainStatus:li}));case"EventSentryMsg":var Se=e.a,Te=f(Uw,Se,t.eventSentry),we=Te.a,x=Te.b;return d(IC,D(t,{eventSentry:we}),x,zo,vr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(DT,Ie,Be),Ne=D(t,{chatHistoryModel:fi(ke.model)}),s=ke.shouldCallDecrypt?XT(t):Vo,$e=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return _(FT(f(JS,r,a)),li)}return _(Vo,fi(f(up,"Trying to encrypt, but commInfo is not loaded",n)))}return _(Vo,li)}(),Re=$e.a,xe=$e.b;return d(IC,Ne,Fo(M([s,Re])),zo,U(f(Zi,rw,ke.cmdUps),f(Kc,vr,f(xo,Ow,f(xo,ya,xe)))))}return d(IC,t,Vo,zo,M([ya(f(up,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var _e=e.a,Le=f(uv,YS,zS(_e)),Pe=L(t.wallet,t.trade,Le);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var E=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(Ro,p,E.address);if("Nothing"===Ue.$)return d(IC,t,Vo,zo,M([ya(f(up,"Trying to encrypt, but the user is not involved in this trade.",li))]));var Oe=Ue.a,Me=function(){return rp("Initiator"===Oe.$?f(dE,p.creationInfo.address,De):f(gE,p.creationInfo.address,De))}();return d(IC,t,Vo,f(Zo,{onBroadcast:li,onMined:li,onSign:li},Me),vr)}var Fe=Pe.a,Ve=Pe.b;return d(IC,t,Vo,zo,M([ya(f(up,"Encryption successful, but the user or trade is no longer valid.",_(Fe,Ve)))]))}var Ke=Pe.c.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return uE(t)}var V=e.a.a;return d(IC,t,Vo,zo,M([ya(f(mm,"message",V))]));case"Web3Connect":return d(IC,t,Vo,zo,M([ma]));default:return uE(t)}}),Fw=r(function(e,t){return{address:e,blocknum:t}}),Vw=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return fi(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return li}},Kw=n(function(e,t,r){return function(e){return _(e.a,e.b)}(d(nE,!0,e,t,r))}),Hw=n(function(e,t,r){var n=function(e){return r(f(iv,OE,e).returnData)},a={address:t.address,fromBlock:eE(t.blocknum),toBlock:eE(t.blocknum),topics:M([fi(eS("Initiated(string,string)"))])};return l(Kw,n,e,a)}),jw=function(e){return{data:fi(f(el,"numTrades()",vr)),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},qw=r(function(e,t){return f(Lv,t,f(wv,fv(e),jw(tg(e))))}),Gw=function(e){return{data:fi(f(el,"phase()",vr)),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},zw=n(function(e,t,r){return f(Lv,r,f(Bv,DS,f(wv,fv(e),Gw(t))))}),Ww=function(e){return f(_h,function(e){if("LoadedTrade"===e.$){var t=e.a;return fi(t)}return li},Ia(e.trades))},Yw=function(e){return f(_a,r(function(t,r){return e(t)?r+1:r}),0)},Jw=function(e){return f(Yw,Za(vE),Ia(e.trades))},Qw=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:Jw(e),loaded:Ii(Ww(e))})})},Xw=n(function(e,t,r){return{cmd:t,cmdUps:r,tradeCache:e}}),Zw=r(function(e,t){var r=f(sf,e,t.trades);if("Just"===r.$){var n=(r.a,l(hf,e,vE,t.trades));return l(Xw,Qw(D(t,{trades:n})),Vo,vr)}return l(Xw,t,Vo,M([ya(f(up,"markTradeInvalid ran into an out-of-range error",_(e,t.trades)))]))}),eI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(cS,t,a),o=l(hf,e,i,r.trades);return _(Qw(D(r,{trades:o})),vr)}return _(r,M([f(up,"updateTradeAddress ran into an out-of-range error",_(e,r.trades))]))}),tI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(fS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradeParameters ran into an out-of-range error",_(e,r.trades)))]))}),rI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(hf,e,BC(D(a,{state:D(i,{phase:t})})),r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhase is trying to update a partially loaded trade",_(e,r.trades)))]))}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhase ran into an out-of-range error",_(e,r.trades)))]))}),nI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(lS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhaseTimeInfo ran into an out-of-range error",_(e,r.trades)))]))}),aI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(dS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradeState ran into an out-of-range error",_(e,r.trades)))]))}),iI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(hS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTTPaymentMethods ran into an out-of-range error",_(e,r.trades)))]))}),oI=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),uI=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),sI=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),cI=function(e){return{$:"NumTradesFetchedAgain",a:e}},fI=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),lI=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),dI=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),hI=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),pI=function(e){return l(Xw,e,Vo,vr)},gI=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=KS(n),i=qS(f(Ua,eC(t.factory),f(ki,0,a-1))),o=Fo(f(Ua,function(e){return l(lC,t.factory,Zu(e),oI(e))},f(ki,0,a-1)));return l(Xw,D(t,{dataFetchState:l(uI,fi(a),0,0),trades:i}),o,vr)}var u=r.a;return l(Xw,t,Vo,M([ya(f(ym,"Factory numTrades",u))]));case"CheckForNewTrades":return l(Xw,t,f(qw,t.factory,cI),vr);case"UpdateTradePhases":var s=Fo($T(f(Ua,function(e){return"Closed"===e.state.phase.$?li:fi(l(zw,e.factory,e.creationInfo.address,f(lI,e.factory,e.id)))},Ww(t))));return l(Xw,t,s,vr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(rI,d,p,t),v=function(){var e=_(p,f(sf,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=Vw(r);if("Just"===n.$){var a=n.a;return _(l(FS,c,a.address,hI(d)),vr)}return _(Vo,M([ya(f(up,"Phase fetched for a trade that has no creationInfo",r))]))}return _(Vo,vr)}e.b;return _(Vo,M([ya(f(up,"Phase fetched for a trade, but then ran into an out-of-range error",li))]))}(),y=v.a,m=v.b;return l(Xw,g.tradeCache,Fo(M([g.cmd,y])),f(co,g.cmdUps,m))};return l(Xw,t,Vo,M([ya(f(ww,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=_(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=KS(n);if(x(C,E)<0){var S=t.dataFetchState,o=Fo(f(Ua,function(e){return l(lC,t.factory,Zu(e),oI(e))},f(ki,C,E-1))),T=qS(f(Ua,eC(t.factory),f(ki,C,E-1)));return l(Xw,D(t,{dataFetchState:D(S,{total:fi(E)}),trades:f(kT,t.trades,T)}),o,vr)}return pI(t)}b.b;return l(Xw,t,Vo,M([ya(f(up,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(Xw,t,Vo,M([ya(f(ym,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(Fw,w.address_,KS(w.blocknum)),A=l(Hw,t.eventSentry,I,sI(d)),B=A.a,k=A.b,y=Fo(M([h(VS,t.factory,I.address,fI(d),hI(d),dI(d)),k])),N=l(eI,d,I,t),$=N.a,R=N.b;return l(Xw,Qw(D($,{eventSentry:B})),y,f(Ua,ya,R))}var u=r.a;return l(Xw,t,Vo,M([ya(f(ym,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var L=r.a;return l(Xw,t,Vo,M([ya(f(ym,"parameters",L))]))}if("Ok"===r.a.$){var P=r.a.a;return l(tI,d,P,t)}var U=r.a.a;return l(Xw,t,Vo,M([ya(f(up,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(aI,d,O,t)}return l(Xw,t,Vo,M([ya(f(ww,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(nI,d,F,t)}return l(Xw,t,Vo,M([ya(f(ww,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=BE(V.terms);if("Ok"===K.$){var H=K.a;return l(iI,d,H,t)}var j=K.a;return f(Zw,d,t)}var j=r.a;return l(Xw,t,Vo,M([ya(f(up,"Error decoding initiated event",j))]));default:var q=e.a,G=f(Uw,q,t.eventSentry),z=G.a,y=G.b;return l(Xw,D(t,{eventSentry:z}),y,vr)}}),vI=function(e){return{$:"AgentHistoryModel",a:e}},yI=function(e){return{$:"AgentHistoryMsg",a:e}},mI=function(e){return{$:"CmdUp",a:e}},bI={$:"ConnectToWeb3"},CI=function(e){return{$:"CreateModel",a:e}},EI=function(e){return{$:"CreateMsg",a:e}},SI=function(e){return{$:"GotoRoute",a:e}},TI=function(e){return{$:"MarketplaceModel",a:e}},wI=function(e){return{$:"MarketplaceMsg",a:e}},II=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),AI=function(e){return{$:"TradeModel",a:e}},BI=function(e){return{$:"TradeMsg",a:e}},kI=r(function(e,t){return f(Nn,e,cp(t))}),NI=function(e){return f(kI,"href",nt(e))},$I=$n("rel"),RI=kI("target"),xI=function(e){return{$:"Height",a:e}},_I=xI,LI={$:"Content"},PI=LI,DI=function(e){return{$:"Width",a:e}},UI=DI,OI=function(e){return{$:"Attr",a:e}},MI=function(e){return{$:"NodeName",a:e}},FI=function(e){return{$:"Unkeyed",a:e}},VI={$:"AsEl"},KI=VI,HI=r(function(e,t){return{$:"Field",a:e,b:t}}),jI=f(HI,0,0),qI={$:"NoNearbyChildren"},GI={above:"a",active:"atv",alignBottom:"ab",alignCenterX:"cx",alignCenterY:"cy",alignContainerBottom:"acb",alignContainerCenterX:"accx",alignContainerCenterY:"accy",alignContainerRight:"acr",alignLeft:"al",alignRight:"ar",alignTop:"at",alignedHorizontally:"ah",alignedVertically:"av",any:"s",behind:"bh",below:"b",bold:"w7",borderDashed:"bd",borderDotted:"bdt",borderNone:"bn",borderSolid:"bs",capturePointerEvents:"cpe",clip:"cp",clipX:"cpx",clipY:"cpy",column:"c",container:"ctr",contentBottom:"cb",contentCenterX:"ccx",contentCenterY:"ccy",contentLeft:"cl",contentRight:"cr",contentTop:"ct",cursorPointer:"cptr",cursorText:"ctxt",focus:"fcs",focusedWithin:"focus-within",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightExact:"he",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputMultilineFiller:"imlf",inputMultilineParent:"imlp",inputMultilineWrapper:"implw",inputText:"it",italic:"i",link:"lnk",nearby:"nb",noTextSelection:"notxt",onLeft:"ol",onRight:"or",opaque:"oq",overflowHidden:"oh",page:"pg",paragraph:"p",passPointerEvents:"ppe",root:"ui",row:"r",scrollbars:"sb",scrollbarsX:"sbx",scrollbarsY:"sby",seButton:"sbt",single:"e",sizeByCapital:"cap",spaceEvenly:"sev",strike:"sk",text:"t",textCenter:"tc",textExtraBold:"w8",textExtraLight:"w2",textHeavy:"w9",textJustify:"tj",textJustifyAll:"tja",textLeft:"tl",textLight:"w3",textMedium:"w5",textNormalWeight:"w4",textRight:"tr",textSemiBold:"w6",textThin:"w1",textUnitalicized:"tun",transition:"ts",transparent:"clr",underline:"u",widthContent:"wc",widthExact:"we",widthFill:"wf",widthFillPortion:"wfp",wrapped:"wrp"},zI=GI.any+" "+GI.column,WI=GI.any+" "+GI.grid,YI=GI.any+" "+GI.page,JI=GI.any+" "+GI.paragraph,QI=GI.any+" "+GI.row,XI=GI.any+" "+GI.single,ZI=function(e){switch(e.$){case"AsRow":return QI;case"AsColumn":return zI;case"AsEl":return XI;case"AsGrid":return WI;case"AsParagraph":return JI;default:return YI}},eA=function(e){return{$:"Keyed",a:e}},tA={$:"NoStyleSheet"},rA=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),nA=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(Ua,function(t){return _(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(Ua,function(t){return _(e,t)},a));default:var n=r.a,a=r.b;return U(f(Ua,function(t){return _(e,t)},n),U(t,f(Ua,function(t){return _(e,t)},a)))}}),aA={$:"AsParagraph"},iA=aA,oA=Tn("div"),uA=Tn("p"),sA=Tn("s"),cA=Tn("u"),fA=kI("className"),lA=function(e){return In(et(e))},dA=function(e){return Tn(et(e))},hA=function(e){return{$:"Flag",a:e}},pA=function(e){return{$:"Second",a:e}},gA=function(e){return e>31?pA(1< .ctr > ."+GI.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",vB="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+DA(GI.any)+DA(GI.row)+" > "+DA(GI.any)+" { flex-basis: auto !important; } "+DA(GI.any)+DA(GI.row)+" > "+DA(GI.any)+DA(GI.container)+' { flex-basis: auto !important; }}\ninput[type="search"],\ninput[type="search"]::-webkit-search-decoration,\ninput[type="search"]::-webkit-search-cancel-button,\ninput[type="search"]::-webkit-search-results-button,\ninput[type="search"]::-webkit-search-results-decoration {\n -webkit-appearance:none;\n}\n\ninput[type=range] {\n -webkit-appearance: none; \n background: transparent;\n position:absolute;\n left:0;\n top:0;\n z-index:10;\n width: 100%;\n outline: dashed 1px;\n height: 100%;\n opacity: 0;\n}\n\ninput[type=range]::-moz-range-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-ms-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-webkit-slider-runnable-track {\n background: transparent;\n cursor: pointer;\n}\n\ninput[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-moz-range-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-ms-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range][orient=vertical]{\n writing-mode: bt-lr; /* IE */\n -webkit-appearance: slider-vertical; /* WebKit */\n}\n'+gB,yB=function(e){return{$:"Intermediate",a:e}},mB=r(function(e,t){return yB({closing:t,others:vr,props:vr,selector:e})}),bB=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(Ra,_(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(Ra,yB({closing:"\n}",others:vr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(Ra,f(bB,f(mB,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(Ra,f(bB,f(mB,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(Ra,f(bB,f(mB,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(Ra,f(bB,f(mB,n.selector,""),v),t.others)})}});return yB(l(Da,a,n,t))}),CB=U(vB,function(e){var t=function(e){return qy(f(Ua,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),qy(f(Ua,a,t.others)))};return qy(f(Ua,a,l(Da,r(function(e,t){var r=e.a,n=e.b;return f(Ra,f(bB,f(mB,r,""),n),t)}),vr,e)))}(U(dB,pB))),EB=function(e){switch(e.mode.$){case"Layout":return l(dA,"div",vr,M([l(dA,"style",vr,M([MA(CB)]))]));case"NoStaticStyleSheet":return MA("");default:return l(dA,"elm-ui-static-rules",M([f(OA,"rules",cp(CB))]),vr)}},SB=function(e){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return'"'+t+'"';case"ImportFont":var t=e.a;e.b;return'"'+t+'"';default:var t=e.a.name;return'"'+t+'"'}},TB=function(e){switch(e.$){case"VariantActive":var t=e.a;return"smcp"===t;case"VariantOff":var t=e.a;return!1;default:var t=e.a,r=e.b;return"smcp"===t&&1===r}},wB=function(e){if("FontWith"===e.$){var t=e.a;return f(fo,TB,t.variants)}return!1},IB=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),AB=a(function(e,t,r,n){if("Nothing"===t.$)return M([r+"{"+l(_a,IB(!1),"",n)+"\n}"]);switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return vr;case"ForceHover":return M([r+"-hv {"+l(_a,IB(!0),"",n)+"\n}"]);default:return M([r+"-hv:hover {"+l(_a,IB(!1),"",n)+"\n}"])}case"Focus":var a=l(_a,IB(!1),"",n);return M([r+"-fs:focus {"+a+"\n}","."+GI.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+GI.any+":focus "+r+"-fs {"+a+"\n}",r+"-fs:focus-within {"+a+"\n}",".focusable-parent:focus ~ ."+GI.any+" "+r+"-fs {"+a+"\n}"]);default:return M([r+"-act:active {"+l(_a,IB(!1),"",n)+"\n}"])}}),BB=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+Ri(r)}},kB=function(e){if("FontWith"===e.$){var t=e.a;return fi(f(xi,", ",f(Ua,BB,t.variants)))}return li},NB=function(e){switch(e.$){case"Untransformed":return li;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return fi("translate3d("+uy(r)+"px, "+uy(n)+"px, "+uy(a)+"px)");default:var i=e.a,o=i.a,u=i.b,s=i.c,c=e.b,f=c.a,l=c.b,d=c.c,h=e.c,p=h.a,g=h.b,v=h.c,y=e.d,m="translate3d("+uy(o)+"px, "+uy(u)+"px, "+uy(s)+"px)",b="scale3d("+uy(f)+", "+uy(l)+", "+uy(d)+")",C="rotate3d("+uy(p)+", "+uy(g)+", "+uy(v)+", "+uy(y)+"rad)";return fi(m+" "+b+" "+C)}},$B=n(function(e,t,r){switch(t.$){case"Style":var a=t.a,i=t.b;return d(AB,e,r,a,i);case"Shadows":var o=t.a,u=t.b;return d(AB,e,r,"."+o,M([f(xA,"box-shadow",u)]));case"Transparency":var o=t.a,s=t.b,c=f(ni,0,f(Rc,1,1-s));return d(AB,e,r,"."+o,M([f(xA,"opacity",uy(c))]));case"FontSize":var h=t.a;return d(AB,e,r,".font-size-"+Ri(h),M([f(xA,"font-size",Ri(h)+"px")]));case"FontFamily":var o=t.a,p=t.b,g=f(xi,", ",f(_h,kB,p)),v=M([f(xA,"font-family",f(xi,", ",f(Ua,SB,p))),f(xA,"font-feature-settings",g),f(xA,"font-variant",f(fo,wB,p)?"small-caps":"normal")]);return d(AB,e,r,"."+o,v);case"Single":var y=t.a,u=t.b,m=t.c;return d(AB,e,r,"."+y,M([f(xA,u,m)]));case"Colored":var y=t.a,u=t.b,b=t.c;return d(AB,e,r,"."+y,M([f(xA,u,LA(b))]));case"SpacingStyle":var C=t.a,E=t.b,S=t.c,T=Ri(S)+"px",w=Ri(E)+"px",I="."+GI.row,A="."+(GI.wrapped+I),B="."+GI.alignRight,k="."+GI.paragraph,N="."+GI.page,$="."+GI.alignLeft,R=uy(S/2)+"px",x=uy(E/2)+"px",L="."+GI.column,y="."+C,P="."+GI.any;return kb(M([d(AB,e,r,y+(I+" > ")+P+" + "+P,M([f(xA,"margin-left",w)])),d(AB,e,r,y+(A+" > ")+P,M([f(xA,"margin",R+" "+x)])),d(AB,e,r,y+(L+" > ")+P+" + "+P,M([f(xA,"margin-top",T)])),d(AB,e,r,y+(N+" > ")+P+" + "+P,M([f(xA,"margin-top",T)])),d(AB,e,r,y+(N+" > ")+$,M([f(xA,"margin-right",w)])),d(AB,e,r,y+(N+" > ")+B,M([f(xA,"margin-left",w)])),d(AB,e,r,U(y,k),M([f(xA,"line-height","calc(1em + "+Ri(S)+"px)")])),d(AB,e,r,"textarea"+(P+y),M([f(xA,"line-height","calc(1em + "+Ri(S)+"px)"),f(xA,"height","calc(100% + "+Ri(S)+"px)")])),d(AB,e,r,y+(k+" > ")+$,M([f(xA,"margin-right",w)])),d(AB,e,r,y+(k+" > ")+B,M([f(xA,"margin-left",w)])),d(AB,e,r,y+(k+"::after"),M([f(xA,"content","''"),f(xA,"display","block"),f(xA,"height","0"),f(xA,"width","0"),f(xA,"margin-top",Ri(-1*(S/2|0))+"px")])),d(AB,e,r,y+(k+"::before"),M([f(xA,"content","''"),f(xA,"display","block"),f(xA,"height","0"),f(xA,"width","0"),f(xA,"margin-bottom",Ri(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=t.a,D=t.b,B=t.c,O=t.d,$=t.e,y="."+C;return d(AB,e,r,y,M([f(xA,"padding",Ri(D)+"px "+Ri(B)+"px "+Ri(O)+"px "+Ri($)+"px")]));case"BorderWidth":var C=t.a,D=t.b,B=t.c,O=t.d,$=t.e,y="."+C;return d(AB,e,r,y,M([f(xA,"border-width",Ri(D)+"px "+Ri(B)+"px "+Ri(O)+"px "+Ri($)+"px")]));case"GridTemplateStyle":var F=t.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ri(n)+"px";case"Content":var a=_(e,t);if("Nothing"===a.a.$){if("Nothing"===a.b.$){a.a,a.b;return"max-content"}var i=(a.a,a.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ri(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Fill":var u=r.a,s=_(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Ri(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ri(o)+"px, "+Ri(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Min":var c=r.a,f=r.b,l=fi(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=fi(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,li,li,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(xi," ",f(Ua,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(xi,H,f(Ua,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(xi,H,f(Ua,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",W="grid-column-gap:"+K(F.spacing.a)+";",Y=function(e){return"grid-template-columns: "+e+";"}(f(xi," ",f(Ua,K,F.columns))),y=".grid-rows-"+f(xi,"-",f(Ua,BA,F.rows))+"-cols-"+f(xi,"-",f(Ua,BA,F.columns))+"-space-x-"+BA(F.spacing.a)+"-space-y-"+BA(F.spacing.b),J=y+"{"+Y+j+W+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return M([X,Q]);case"GridPosition":var Z=t.a,ee=f(xi," ",M(["-ms-grid-row: "+Ri(Z.row)+";","-ms-grid-row-span: "+Ri(Z.height)+";","-ms-grid-column: "+Ri(Z.col)+";","-ms-grid-column-span: "+Ri(Z.width)+";"])),te=f(xi," ",M(["grid-row: "+Ri(Z.row)+" / "+Ri(Z.row+Z.height)+";","grid-column: "+Ri(Z.col)+" / "+Ri(Z.col+Z.width)+";"])),y=".grid-pos-"+Ri(Z.row)+"-"+Ri(Z.col)+"-"+Ri(Z.width)+"-"+Ri(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return M([X,Q]);case"PseudoSelector":var y=t.a,re=t.b;return f(Nb,function(t){return l($B,e,t,fi(y))},re);default:var ne=t.a,m=NB(ne),y=NA(ne),ae=_(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return d(AB,e,r,"."+C,M([f(xA,"transform",ie)]))}return vr}}),RB=r(function(e,t){return vp(f(Ua,function(t){var r=l($B,e,t,li);return _($A(t),f(av,cp,r))},t))}),xB=r(function(e,t){return e+" {"+f(xi,"",f(Ua,function(e){return e.a+": "+e.b+";"},t))+"}"}),_B=n(function(e,t,r){var n=r.a,a=r.b;return M([f(xB,"."+e+"."+t+", ."+e+" ."+t,n),f(xB,"."+e+"."+t+"> ."+GI.text+", ."+e+" ."+t+" > ."+GI.text,a)])}),LB=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(xi," ",U(l(_B,i,GI.sizeByCapital,a),l(_B,i,GI.fullSize,n)))}),PB=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(xi," ",M([f(xB,"."+r+"."+GI.sizeByCapital+", ."+r+" ."+GI.sizeByCapital,M([_("line-height","1")])),f(xB,"."+r+"."+GI.sizeByCapital+"> ."+GI.text+", ."+r+" ."+GI.sizeByCapital+" > ."+GI.text,M([_("vertical-align","0"),_("line-height","1")]))]))}),DB=function(e){if(e.b){var t=e.a,r=e.b;return fi(l(_a,ni,t,r))}return li},UB=function(e){if(e.b){var t=e.a,r=e.b;return fi(l(_a,Rc,t,r))}return li},OB=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),MB=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(Kc,e.descender,UB(t)),n=f(Kc,e.baseline,UB(f(pp,function(e){return!$(e,r)},t))),a=f(Kc,e.capital,DB(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(OB,i,a-n,o),full:l(OB,u,a-r,s)}},FB=function(e){return _(M([_("display","block")]),M([_("display","inline-block"),_("line-height",uy(e.height)),_("vertical-align",uy(e.vertical)+"em"),_("font-size",uy(e.size)+"em")]))},VB=function(e){return l(_a,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return fi(_(FB(function(e){return e.full}(MB(a))),FB(function(e){return e.capital}(MB(a)))))}return t}return t}),li,e)},KB=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return fi("@import url('"+t+"');")}return li},r=function(e){var r=(e.a,e.b);return f(xi,"\n",f(_h,t,r))},n=f(Ua,ei,e),a=function(e){var t=e.a,r=e.b,a=VB(r);if("Nothing"===a.$)return f(xi,"",f(Ua,PB(t),n));var i=a.a;return f(xi,"",f(Ua,f(LB,t,i),n))};return U(f(xi,"\n",f(Ua,r,e)),f(xi,"\n",f(Ua,a,e)))},HB=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return fi(_(t,r))}return li},jB=r(function(e,t){var n=r(function(t,r){return{rules:U(r.rules,l($B,e,t,li)),topLevel:function(){var e=HB(t);if("Nothing"===e.$)return r.topLevel;var n=e.a;return f(Ra,n,r.topLevel)}()}}),a=l(_a,n,{rules:vr,topLevel:vr},t),i=a.topLevel,o=a.rules;return U(KB(i),qy(o))}),qB=r(function(e,t){switch(e.mode.$){case"Layout":case"NoStaticStyleSheet":return l(dA,"div",vr,M([l(dA,"style",vr,M([MA(f(jB,e,t))]))]));default:return l(dA,"elm-ui-rules",M([f(OA,"rules",f(RB,e,t))]),vr)}}),GB=a(function(e,t,r,n){var a=f(qB,t,l(_a,RA,_(mC,UA(t.focus)),r).b);return e?f(Ra,_("static-stylesheet",EB(t)),f(Ra,_("dynamic-stylesheet",a),n)):f(Ra,_("dynamic-stylesheet",a),n)}),zB=a(function(e,t,r,n){var a=f(qB,t,l(_a,RA,_(mC,UA(t.focus)),r).b);return e?f(Ra,EB(t),f(Ra,a,n)):f(Ra,a,n)}),WB=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(lA,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(GB,!1,e,t,r);default:var e=i.a,t=i.b;return d(GB,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return oA;case"p":return uA;default:return dA(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(zB,!1,e,t,n);default:var e=i.a,t=i.b;return d(zB,!0,e,t,n)}}())}),s=function(){switch(t.$){case"Generic":return f(u,"div",n);case"NodeName":var e=t.a;return f(u,e,n);default:var e=t.a,r=t.b;return l(dA,e,n,M([f(u,r,M([fA(GI.any+" "+GI.single)]))]))}}();switch(o.$){case"AsRow":return f(SA,wA,e)&&!f(SA,TA,e)?s:f(SA,yA,e)?f(cA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.contentCenterY,GI.alignContainerRight])))]),M([s])):f(SA,mA,e)?f(sA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.contentCenterY,GI.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(SA,EA,e)&&!f(SA,CA,e)?s:f(SA,bA,e)?f(sA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.alignContainerCenterY])))]),M([s])):f(SA,vA,e)?f(cA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.alignContainerBottom])))]),M([s])):s;default:return s}}),YB=MA,JB=GI.any+" "+GI.text+" "+GI.widthContent+" "+GI.heightContent,QB=function(e){return f(oA,M([fA(JB)]),M([YB(e)]))},XB=GI.any+" "+GI.text+" "+GI.widthFill+" "+GI.heightFill,ZB=function(e){return f(oA,M([fA(XB)]),M([YB(e)]))},ek=n(function(e,t,n){var a=r(function(t,r){var n=t.a,a=t.b,i=r.a,o=r.b;switch(a.$){case"Unstyled":var u=a.a;return $(e,iA),_(f(Ra,_(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,iA),_(f(Ra,_(n,f(s.html,tA,e)),i),_u(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return _(f(Ra,_(n,$(e,KI)?ZB(c):QB(c)),i),o);default:return _(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,iA),_(f(Ra,i(e),n),a);case"Styled":var o=t.a;return $(e,iA),_(f(Ra,f(o.html,tA,e),n),_u(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return _(f(Ra,$(e,KI)?ZB(u):QB(u),n),a);default:return _(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Da,a,_(vr,vr),o),s=u.a,c=u.b,p=_u(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return Gi({html:d(WB,n.has,n.node,n.attributes,eA(l(nA,"nearby-element-pls",s,n.children))),styles:g})}return Wi(h(WB,n.has,n.node,n.attributes,eA(l(nA,"nearby-element-pls",s,n.children)),tA))}var v=t.a,y=l(Da,i,_(vr,vr),v),m=y.a,c=y.b,p=_u(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return Gi({html:d(WB,n.has,n.node,n.attributes,FI(f(rA,m,n.children))),styles:g})}return Wi(h(WB,n.has,n.node,n.attributes,FI(f(rA,m,n.children)),tA))}),tk=r(function(e,t){return f($n,tt(e),at(t))}),rk=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(HI,a|r,n)}var i=e.a;return f(HI,r,i|n)}),nk=gA(7),ak=gA(36),ik=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(HI,r|a,n|i)}),ok=gA(6),uk=gA(38),sk=gA(30),ck=gA(29),fk=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),lk=function(e){return{$:"Transform",a:e}},dk=function(e){return{$:"ChildrenBehind",a:e}},hk=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),pk=function(e){return{$:"ChildrenInFront",a:e}},gk=r(function(e,t){return f(oA,M([fA(function(){switch(e.$){case"Above":return f(xi," ",M([GI.nearby,GI.single,GI.above]));case"Below":return f(xi," ",M([GI.nearby,GI.single,GI.below]));case"OnRight":return f(xi," ",M([GI.nearby,GI.single,GI.onRight]));case"OnLeft":return f(xi," ",M([GI.nearby,GI.single,GI.onLeft]));case"InFront":return f(xi," ",M([GI.nearby,GI.single,GI.inFront]));default:return f(xi," ",M([GI.nearby,GI.single,GI.behind]))}}())]),M([function(){switch(t.$){case"Empty":return MA("");case"Text":var e=t.a;return QB(e);case"Unstyled":return(0,t.a)(KI);default:return f(t.a.html,tA,KI)}}()]))}),vk=n(function(e,t,r){var n=f(gk,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?dk(M([n])):pk(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?dk(f(Ra,n,a)):f(hk,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(hk,M([n]),i):pk(f(Ra,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(hk,f(Ra,n,a),i):f(hk,a,f(Ra,n,i))}}),yk=r(function(e,t){return{$:"Embedded",a:e,b:t}}),mk=r(function(e,t){switch(t.$){case"Generic":return MI(e);case"NodeName":var r=t.a;return f(yk,r,e);default:var n=t.a,a=t.b;return f(yk,n,a)}}),bk=function(e){switch(e.$){case"Left":return GI.alignedHorizontally+" "+GI.alignLeft;case"Right":return GI.alignedHorizontally+" "+GI.alignRight;default:return GI.alignedHorizontally+" "+GI.alignCenterX}},Ck=function(e){switch(e.$){case"Top":return GI.alignedVertically+" "+GI.alignTop;case"Bottom":return GI.alignedVertically+" "+GI.alignBottom;default:return GI.alignedVertically+" "+GI.alignCenterY}},Ek=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),Sk=function(e){return{$:"Moved",a:e}},Tk=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return Sk(L(r,0,0));case"MoveY":var n=t.a;return Sk(L(0,n,0));case"MoveZ":var a=t.a;return Sk(L(0,0,a));case"MoveXYZ":var i=t.a;return Sk(i);case"Rotate":var i=t.a,o=t.b;return d(Ek,L(0,0,0),L(1,1,1),i,o);default:var i=t.a;return d(Ek,L(0,0,0),i,L(0,0,1),0)}case"Moved":var u=e.a,r=u.a,n=u.b,a=u.c;switch(t.$){case"MoveX":var s=t.a;return Sk(L(s,n,a));case"MoveY":var c=t.a;return Sk(L(r,c,a));case"MoveZ":var f=t.a;return Sk(L(r,n,f));case"MoveXYZ":var i=t.a;return Sk(i);case"Rotate":var i=t.a,o=t.b;return d(Ek,u,L(1,1,1),i,o);default:var l=t.a;return d(Ek,u,l,L(0,0,1),0)}default:var u=e.a,r=u.a,n=u.b,a=u.c,h=e.b,p=e.c,o=e.d;switch(t.$){case"MoveX":var s=t.a;return d(Ek,L(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(Ek,L(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(Ek,L(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(Ek,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(Ek,u,h,v,y);default:var m=t.a;return d(Ek,u,m,p,o)}}}),wk=function(e){switch(e.$){case"Px":var t=e.a,r=Ri(t),n="height-px-"+r;return L(jI,GI.heightExact+" "+n,M([l(fk,n,"height",r+"px")]));case"Content":return L(f(rk,ak,jI),GI.heightContent,vr);case"Fill":var a=e.a;return 1===a?L(f(rk,EA,jI),GI.heightFill,vr):L(f(rk,EA,jI),GI.heightFillPortion+" height-fill-"+Ri(a),M([l(fk,GI.any+"."+GI.column+" > "+DA("height-fill-"+Ri(a)),"flex-grow",Ri(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ri(i),s=l(fk,u,"min-height",Ri(i)+"px"),c=wk(o),d=c.a,h=c.b,p=c.c;return L(f(rk,CA,d),u+" "+h,f(Ra,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ri(g),s=l(fk,u,"max-height",Ri(g)+"px"),v=wk(o),d=v.a,h=v.b,p=v.c;return L(f(rk,CA,d),u+" "+h,f(Ra,s,p))}},Ik=function(e){switch(e.$){case"Px":var t=e.a;return L(jI,GI.widthExact+" width-px-"+Ri(t),M([l(fk,"width-px-"+Ri(t),"width",Ri(t)+"px")]));case"Content":return L(f(rk,uk,jI),GI.widthContent,vr);case"Fill":var r=e.a;return 1===r?L(f(rk,wA,jI),GI.widthFill,vr):L(f(rk,wA,jI),GI.widthFillPortion+" width-fill-"+Ri(r),M([l(fk,GI.any+"."+GI.row+" > "+DA("width-fill-"+Ri(r)),"flex-grow",Ri(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ri(n),o=l(fk,i,"min-width",Ri(n)+"px"),u=Ik(a),s=u.a,c=u.b,d=u.c;return L(f(rk,TA,s),i+" "+c,f(Ra,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ri(h),o=l(fk,i,"max-width",Ri(h)+"px"),p=Ik(a),s=p.a,c=p.b,d=p.c;return L(f(rk,TA,s),i+" "+c,f(Ra,o,d))}},Ak=gA(27),Bk=r(function(e,t){if($(e,Ak)){if("Single"!==t.$)return!1;switch(t.c){case"0px":case"1px":case"2px":case"3px":case"4px":case"5px":case"6px":return!0;default:return!1}}else switch(t.$){case"FontSize":var r=t.a;return r>=8&&r<=32;case"PaddingStyle":var n=(t.a,t.b),a=t.c,i=t.d,o=t.e;return $(n,i)&&$(n,a)&&$(n,o)&&n>=0&&n<=24;default:return!1}}),kk=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=NA(n);if("Nothing"===s.$)return{attributes:f(Ra,fA(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Ra,fA(e+" "+c),i),children:o,has:r,node:t,styles:f(Ra,lk(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(SA,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(rk,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(Ra,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(SA,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(Bk,S,I)){var p=$A(I)+" "+e,g=t,v=f(rk,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=$A(I)+" "+e,g=t,v=f(rk,S,r),y=n,m=f(Ra,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(rk,S,r),y=f(Tk,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(SA,ok,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=GI.widthExact+" width-px-"+Ri(k)+" "+e,g=t,v=f(rk,ok,r),y=n,m=f(Ra,l(fk,"width-px-"+Ri(k),"width",Ri(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+GI.widthContent,g=t,v=f(rk,uk,f(rk,ok,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+GI.widthFill,g=t,v=f(rk,wA,f(rk,ok,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+GI.widthFillPortion+" width-fill-"+Ri(N),g=t,v=f(rk,wA,f(rk,ok,r)),y=n,m=f(Ra,l(fk,GI.any+"."+GI.row+" > "+DA("width-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var $=Ik(B),R=$.a,x=$.b,_=$.c,p=e+" "+x,g=t,v=f(ik,R,f(rk,ok,r)),y=n,m=U(_,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var L=d.a;if(f(SA,nk,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(L.$){case"Px":var k=L.a,P=Ri(k)+"px",D="height-px-"+P,p=GI.heightExact+" "+D+" "+e,g=t,v=f(rk,nk,r),y=n,m=f(Ra,l(fk,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=GI.heightContent+" "+e,g=t,v=f(rk,ak,f(rk,nk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=L.a;if(1===N){var p=GI.heightFill+" "+e,g=t,v=f(rk,EA,f(rk,nk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+GI.heightFillPortion+" height-fill-"+Ri(N),g=t,v=f(rk,EA,f(rk,nk,r)),y=n,m=f(Ra,l(fk,GI.any+"."+GI.column+" > "+DA("height-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=wk(L),R=O.a,x=O.b,_=O.c,p=e+" "+x,g=t,v=f(ik,R,f(rk,nk,r)),y=n,m=U(_,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(mk,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(mk,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(mk,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(mk,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(mk,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(mk,"h"+Ri(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(mk,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var V=M.a,p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-label",V),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var K=d.a,H=d.b,_=function(){switch(H.$){case"Empty":return a;case"Text":H.a;return a;case"Unstyled":H.a;return a;default:var e=H.a;return U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(vk,K,H,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var j=d.a;if(f(SA,sk,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=bk(j)+" "+e,g=t,v=function(e){switch(j.$){case"CenterX":return f(rk,mA,e);case"Right":return f(rk,yA,e);default:return e}}(f(rk,sk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var q=d.a;if(f(SA,ck,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=Ck(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterY":return f(rk,bA,e);case"Bottom":return f(rk,vA,e);default:return e}}(f(rk,ck,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),Nk={$:"Untransformed"},$k=Nk,Rk=a(function(e,t,r,n){return l(ek,e,n,v(kk,ZI(e),t,jI,$k,vr,vr,qI,La(r)))}),xk=function(e){return OI(fA(e))},_k=r(function(e,t){var r=t.url,n=t.label;return d(Rk,KI,MI("a"),f(Ra,OI(NI(r)),f(Ra,OI($I("noopener noreferrer")),f(Ra,OI(RI("_blank")),f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.link),e)))))),FI(M([n])))}),Lk=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),Pk=n(function(e,t,r){return d(Lk,e,t,r,1)}),Dk=gA(14),Uk=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),Ok=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),Mk=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return kA(t)+"-"+kA(r)+"-"+kA(n)+"-"+kA(a)},Fk=function(e){return f(Ok,Dk,l(Uk,"fc-"+Mk(e),"color",e))},Vk={align:Xh,label:"cantConnectNoWeb3",mainParagraphs:M([M([ep("You need a web3 provider (such as "),f(_k,M([Fk(l(Pk,0,0,1))]),{label:ep("Metamask"),url:"https://metamask.io/"}),ep(") to Connect.")]),M([ep("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:Zh},Kk={align:Xh,label:"invalidUrl",mainParagraphs:M([M([ep("I don't understand that URL...")]),M([ep("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:vm},Hk=function(e){return{$:"Active",a:e}},jk=function(e){return{$:"OnlyNetwork",a:e}},qk=Tu(f(tu,Xf,f(tu,Zg,ev("Error decoding hex to BigInt")))),Gk=function(){return Tu(function(e){switch(e){case"0x0":return hi(!1);case"0x1":return hi(!0);default:return di("Error decoding "+e+"as bool.")}})}(),zk=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,contractAddress:o,cumulativeGasUsed:i,gasUsed:a,hash:e,index:t,logs:u,logsBloom:s,root:c,status:f}}}}}}}}}}}},Wk=function(e){return RC(M([f(Fi,fi,e),Ki(li)]))},Yk=f(bg,Wk(f(hl,"status",Gk)),f(bg,Wk(f(hl,"root",Su)),l(PC,"logsBloom",Su,l(PC,"logs",YC(JC),f(bg,Wk(f(hl,"contractAddress",DC)),l(PC,"cumulativeGasUsed",qk,l(PC,"gasUsed",qk,l(PC,"blockNumber",rC,l(PC,"blockHash",FC,l(PC,"transactionIndex",rC,l(PC,"transactionHash",GC,Ki(zk)))))))))))),Jk=function(e){var t=e.a;return Xf(t)},Qk=f(tu,Jk,cp),Xk=r(function(e,t){return Ev({decoder:Yk,method:"eth_getTransactionReceipt",params:M([Qk(t)]),url:e})}),Zk=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),eN=r(function(e,t){return{$:"TxMined",a:e,b:t}}),tN=r(function(e,t){return{$:"TxSent",a:e,b:t}}),rN=r(function(e,t){return f(xo,function(e){return e.toMsg},f($o,function(e){return e.b},f($o,function(e){return e.onMinedTagger},f(Gd,t,e))))}),nN=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},aN=function(e){return RC(M([$C(li),f(Fi,fi,e)]))},iN=l(PC,"input",Su,l(PC,"gas",rC,l(PC,"gasPrice",qk,l(PC,"value",qk,l(PC,"to",aN(DC),l(PC,"from",DC,l(PC,"transactionIndex",rC,l(PC,"blockNumber",aN(rC),l(PC,"blockHash",function(e){return f(Cu,function(t){return"0x"===t||"0x0"===t?Ki(li):f($i,function(e){return $(e,P("0"))},yu(t))?Ki(li):f(Fi,fi,e)},Su)}(FC),l(PC,"nonce",rC,l(PC,"hash",GC,Ki(nN)))))))))))),oN=r(function(e,t){return Ev({decoder:iN,method:"eth_getTransactionByHash",params:M([Qk(t)]),url:e})}),uN=r(function(e,t){return{attempts:e,sleep:t}}),sN=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(_v,function(e){return a>0?f(Bh,function(e){return f(sN,f(uN,a,n),t)},Rw(1e3*n)):mv(e)},t)}),cN=r(function(e,t){return f(Bh,function(r){return f(sN,{attempts:30,sleep:1},f(oN,e,t))},Rw(250))}),fN=r(function(e,t){return f(sN,{attempts:60,sleep:5},f(Xk,e,t))}),lN=function(e){return{$:"Mined",a:e}},dN=function(e){return xo(function(t){return D(t,{status:lN(e)})})},hN=function(e){return{$:"Sent",a:e}},pN=function(e){return xo(function(t){return D(t,{status:hN(e)})})},gN=function(e){return{$:"Signed",a:e}},vN=function(e){return xo(function(t){return D(t,{status:gN(e)})})},yN=function(e){return"Nothing"!==e.$},mN=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return _(bp(r),Vo);case"TxSigned":var n=e.a,a=e.b,i=f(Gd,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(Nw,t,wh(a))}return Vo}(),s=function(e){var t=L(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Vo;if("Just"===t.b.$){var r=t.b.a;return f(Nw,r,wh(di(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Nw,a,wh(di(e)))}t.a,t.b,t.c;return Vo};if("Ok"===a.$){var c=a.a,d=yN(o.onBroadcastTagger)||yN(o.onMinedTagger)?f(np,r.tagger,f(Lv,tN(n),f(cN,r.nodePath,c))):Vo;return _(bp(D(r,{txs:l(th,n,vN(c),r.txs)})),Fo(M([u,d])))}var h=a.a;return _(bp(r),Fo(M([u,s(h)])))}return _(bp(r),Vo);case"TxSent":var n=e.a,p=e.b,g=f(Gd,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(np,r.tagger,f(Lv,eN(n),f(fN,r.nodePath,v.hash))):Vo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Nw,t,wh(hi(v)))}return Vo}();return _(bp(D(r,{txs:l(th,n,pN(v),r.txs)})),Fo(M([d,y])))}var h=p.a,s=function(){var e=_(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Nw,t,wh(di("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Nw,n,wh(di("Error with TxSent stuff")))}e.a,e.b;return Vo}();return _(bp(r),s)}return _(bp(r),Vo);case"TxMined":var n=e.a,m=e.b,b=f(Gd,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Nw,a,wh(hi(C)))}var i=e.a,a=i.a,u=i.b.a,s={currentDepth:1,doneWatching:!1,lastCheckedBlock:C.blockNumber,minedInBlock:C.blockNumber,reOrg:!1,stopWatchingAtBlock:C.blockNumber+(u.confirmations-1),txHash:C.hash};return Fo(M([f(np,r.tagger,f(Lv,f(Zk,n,s),nC(r.nodePath))),f(Nw,a,wh(hi(C))),f(Nw,u.toMsg,wh(s))]))}return Vo}();return _(bp(D(r,{txs:l(th,n,dN(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Nw,r,wh(di("TxReceipt decoding failure")))}return Vo}();return _(bp(r),S)}return _(bp(r),Vo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(rN,r.txs,n);if("Just"===A.$){var B=A.a;return _(bp(r),f(Nw,B,f(_v,function(e){return wh(D(I,{doneWatching:!0,reOrg:!0}))},f(Bh,function(e){return wh(D(I,{doneWatching:!0}))},f(Xk,r.nodePath,T.txHash)))))}return _(bp(r),Vo)}if($(w,T.lastCheckedBlock))return _(bp(r),f(np,r.tagger,f(Lv,f(Zk,n,T),f(Bh,function(e){return nC(r.nodePath)},Rw(2e3)))));var k=f(rN,r.txs,n);if("Just"===k.$){var B=k.a;return _(bp(r),Fo(M([f(np,r.tagger,f(Lv,f(Zk,n,I),f(Bh,function(e){return nC(r.nodePath)},Rw(2e3)))),f(Nw,B,wh(I))])))}return _(bp(r),Vo)}var n=e.a,h=e.c.a;return _(bp(r),Vo);default:var h=e.a;return _(bp(r),Vo)}}),bN=function(e){return{$:"External",a:e}},CN=function(e){return{$:"Internal",a:e}},EN=function(e){return{$:"NotFound",a:e}},SN=function(e){for(;;){e=e.a}},TN={$:"Http"},wN={$:"Https"},IN=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),AN=i(function(e,t,r,n,a){if(jl(a)||f(Om,"@",a))return li;var i=f(Jy,":",a);if(i.b){if(i.b.b)return li;var o=i.a,u=cd(f(uu,o+1,a));if("Nothing"===u.$)return li;var s=u;return fi(p(IN,e,f(fu,o,a),s,t,r,n))}return fi(p(IN,e,a,li,t,r,n))}),BN=a(function(e,t,r,n){if(jl(n))return li;var a=f(Jy,"/",n);if(a.b){var i=a.a;return h(AN,e,f(uu,i,n),t,r,f(fu,i,n))}return h(AN,e,"/",t,r,n)}),kN=n(function(e,t,r){if(jl(r))return li;var n=f(Jy,"?",r);if(n.b){var a=n.a;return d(BN,e,fi(f(uu,a+1,r)),t,f(fu,a,r))}return d(BN,e,li,t,r)}),NN=r(function(e,t){if(jl(t))return li;var r=f(Jy,"#",t);if(r.b){var n=r.a;return l(kN,e,fi(f(uu,n+1,t)),f(fu,n,t))}return l(kN,e,li,t)}),$N=function(e){return f(vu,"http://",e)?f(NN,TN,f(uu,7,e)):f(vu,"https://",e)?f(NN,wN,f(uu,8,e)):li},RN=Jt,xN=ca,_N=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ri(r)}),LN=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),PN=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(LN,"#",e.fragment,l(LN,"?",e.query,U(f(_N,e.port_,U(t,e.host)),e.path)))},DN=r(function(e,t){return e<0?li:ov(f(Wg,e,t))}),UN=r(function(e,t){if(e<0)return t;var r=_g(f(Wg,e,t)),n=f(bc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(co,n,a)}),ON=n(function(e,t,r){if(e<0)return r;var n=f(Wg,e,r),a=f(bc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(Ra,t(i),o))}return r}),MN=r(function(e,t){return f(ON,e,As(t))}),FN=r(function(e,t){var r=function(e){var r=f(Bm,t.wallet,e),n=f(Ap,t.txSentry,f(ru,EI,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(HN,U(f(Zi,EI,r.cmdUps),f(Ua,ya,o)),_(D(t,{submodel:CI(r.model),txSentry:a}),Fo(M([f(np,EI,r.cmd),i]))))};return f(Fu,function(t){return D(t,{currentRoute:e})},function(){switch(e.$){case"InitialBlank":return _(t,Vo);case"CreateFiat":return r(Mp);case"CreateCrypto":return r(Dp(yo));case"Trade":var n=e.a,a=e.b,i=function(){var e=l(Yb,n,a,t.tradeCaches);if("Just"===e.$&&"LoadedTrade"===e.a.$){var r=e.a.a;return f(iE,t.wallet,r)}return l(AC,t.wallet,n,a)}(),o=f(Ap,t.txSentry,f(ru,BI,i.chainCmd)),u=o.a,s=o.b,c=o.c;return f(HN,U(f(Zi,BI,i.cmdUps),f(Ua,ya,c)),_(D(t,{submodel:AI(i.model),txSentry:u}),Fo(M([f(np,BI,i.cmd),s]))));case"Marketplace":var d=Wm(t.wallet),h=d.a,p=d.b;return _(D(t,{submodel:TI(h)}),Fo(M([f(np,wI,p)])));case"AgentHistory":var g=e.a,v=f(jo,t.wallet,g),y=v.a,m=v.b;return _(D(t,{submodel:vI(y)}),Fo(M([f(np,yI,m)])));default:return _(f(ho,Kk,t),Vo)}}())}),VN=r(function(e,t){var r=t.submodel;switch(r.$){case"InitialBlank":return _(t,Vo);case"CreateModel":var n=r.a,a=f(Nm,e,n),i=f(Ap,t.txSentry,f(ru,EI,a.chainCmd)),o=i.a,u=i.b,s=i.c;return f(HN,U(f(Zi,EI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:CI(a.model),txSentry:o}),Fo(M([f(np,EI,a.cmd),u]))));case"TradeModel":var c=r.a,a=f(sE,e,c),l=f(Ap,t.txSentry,f(ru,BI,a.chainCmd)),o=l.a,u=l.b,s=l.c;return f(HN,U(f(Zi,BI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:AI(a.model),txSentry:o}),Fo(M([f(np,BI,a.cmd),u]))));case"MarketplaceModel":var d=r.a,a=f(ob,e,d),h=f(Ap,t.txSentry,f(ru,wI,a.chainCmd)),o=h.a,u=h.b,s=h.c;return f(HN,U(f(Zi,wI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:TI(a.model),txSentry:o}),Fo(M([f(np,wI,a.cmd),u]))));default:var p=r.a,a=f(Yo,e,p),g=f(Ap,t.txSentry,f(ru,yI,a.chainCmd)),o=g.a,u=g.b,s=g.c;return f(HN,U(f(Zi,yI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:vI(a.model),txSentry:o}),Fo(M([f(np,yI,a.cmd),u]))))}}),KN=r(function(e,t){var r=t.a,n=t.b,a=f(jN,mI(e),r),i=a.a,o=a.b;return _(i,Fo(M([n,o])))}),HN=r(function(e,t){var r=t.a,n=t.b;return l(_a,KN,_(r,n),e)}),jN=r(function(e,t){switch(e.$){case"CmdUp":var r=e.a;switch(r.$){case"Web3Connect":return f(jN,bI,t);case"GotoRoute":var n=r.a;return f(jN,SI(n),t);case"GTag":var a=r.a;return _(t,Gb(jb(a)));case"UserNotice":var i=r.a;return _(f(ho,i,t),Gb(jb(d(Np,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return _(t,d(ub,Jb,o,u,s));default:return _(t,Qb(pr))}case"DismissNotice":var c=e.a;return _(D(t,{userNotices:f(UN,c,t.userNotices)}),Vo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(xN,t.key,PN(e))}var r=h.a;return RN(r)}();return _(t,p);case"UrlChanged":var g=e.a;return f(qN,g,t);case"GotoRoute":var v=e.a;return f(Jh,function(e){return Fo(M([e,Gb(jb(d(Np,"GotoRoute","navigation",db(v),0))),f(xN,t.key,db(v))]))},f(FN,v,t));case"Tick":var y=e.a;return _(D(t,{time:y}),Vo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?_(f(ho,Vk,t),Vo):_(t,Hb(pr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Vo;var t=e.a;return zb(f(qb,t,"Deriving keypair for encrypted communication on the DAIHard exchange. ONLY SIGN THIS on https://burnable-tech.github.io/DAIHard/. If you sign this elsewhere, you risk revealing any of your encrypted communication on DAIHard to an attacker."))}();return _(D(t,{userAddress:m.account,wallet:jk(m.networkId)}),b);case"UserPubkeySet":var C=e.a,E=f(nv,Su,C);if("Ok"===E.$){var S=E.a,T=_(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=Hk(l($p,I,w,S));return f(VN,kp(A),D(t,{wallet:A}))}return _(f(ho,f(up,"Unexpected wallet state encounted when setting commPubkey!",_(t.userAddress,t.wallet)),t),Vo)}T.a;return _(f(ho,f(up,"User pubkey set, but I can no longer find the user address!",li),t),Vo)}var B=E.a;return _(l(Oa,ho,f(up,"error decoding commPubkey from JS",B),t),Vo);case"CreateMsg":var k=e.a,N=t.submodel;if("CreateModel"===N.$){var $=N.a,R=f(Tm,k,$),x=f(Ap,t.txSentry,f(ru,EI,R.chainCmd)),L=x.a,P=x.b,O=x.c;return f(HN,U(f(Zi,EI,R.cmdUps),f(Ua,ya,O)),_(D(t,{submodel:CI(R.model),txSentry:L}),Fo(M([f(np,EI,R.cmd),P]))))}return _(t,Vo);case"TradeMsg":var F=e.a,V=t.submodel;if("TradeModel"===V.$){var K=V.a,R=f(Mw,F,K),H=f(Ap,t.txSentry,f(ru,BI,R.chainCmd)),L=H.a,P=H.b,O=H.c;return f(HN,U(f(Zi,BI,R.cmdUps),f(Ua,ya,O)),_(D(t,{submodel:AI(R.model),txSentry:L}),Fo(M([f(np,BI,R.cmd),P]))))}return _(t,Vo);case"MarketplaceMsg":var j=e.a,q=t.submodel;if("MarketplaceModel"===q.$){var G=q.a,R=f(ab,j,G);return f(HN,f(Zi,wI,R.cmdUps),_(D(t,{submodel:TI(R.model)}),f(np,wI,R.cmd)))}return _(t,Vo);case"AgentHistoryMsg":var z=e.a,W=t.submodel;if("AgentHistoryModel"===W.$){var Y=W.a,R=f(ap,z,Y),J=f(Ap,t.txSentry,f(ru,yI,R.chainCmd)),L=J.a,P=J.b,O=J.c;return f(HN,U(f(Zi,yI,R.cmdUps),f(Ua,ya,O)),_(D(t,{submodel:vI(R.model),txSentry:L}),Fo(M([f(np,yI,R.cmd),P]))))}return _(t,Vo);case"TxSentryMsg":var Q=e.a,X=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Fu,fi,f(mN,Q,r))}return _(li,Vo)}(),L=X.a,Z=X.b;return _(D(t,{txSentry:L}),Z);case"TradeCacheMsg":var ee=e.a,te=e.b,re=f(DN,ee,t.tradeCaches);if("Nothing"===re.$)return f(KN,ya(f(up,"Encountered an out-of-range error when trying to route a TradeCacheMsg",li)),_(t,Vo));var ne=re.a,R=f(gI,te,ne);return _(D(t,{tradeCaches:l(MN,ee,R.tradeCache,t.tradeCaches)}),f(np,II(ee),R.cmd));case"ClickHappened":return f(VN,Bp,t);case"NoOp":return _(t,Vo);default:var B=e.a;f(op,"test",B);return _(t,Vo)}}),qN=r(function(e,t){return $(db(t.currentRoute),e.path)?_(t,Vo):f(FN,Kb(e),t)}),GN=We("txIn",xC),zN=Ge("txOut",Fa),WN=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},YN=function(e){return{$:"EventSentryMsg",a:e}},JN=function(e){var t=f(bC,YN,fv(e)),r=t.a,n=t.b;return L({dataFetchState:l(uI,li,0,0),eventSentry:r,factory:e,trades:Wa},n,M([d(Yp,"tradeCache init","processing",WN(e),0)]))},QN=function(e){return{$:"InitialNumTradesFetched",a:e}},XN=function(e){return f(qw,e.factory,QN)},ZN=function(e){var t=JN(e),r=t.a,n=t.b,a=t.c;return L(r,Fo(M([n,XN(r)])),a)},e$={$:"InitialBlank"},t$=function(e){return{$:"TxSentryMsg",a:e}},r$={align:Xh,label:"noWeb3Provider",mainParagraphs:M([M([ep("No web3 provider detected. Is "),f(_k,M([Fk(l(Pk,0,0,1))]),{label:ep("Metamask"),url:"https://metamask.io/"}),ep(" or some other web3 provider installed and unlocked?")])]),noticeType:Zh},n$={$:"TopLeft"},a$={align:n$,label:"screenToSmall",mainParagraphs:M([M([ep("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:Zh},i$={align:Xh,label:"wrongWeb3Network",mainParagraphs:M([M([ep("Make sure your wallet is set to a compatible network.")]),M([ep(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:vm},o$={$:"NoneDetected"},u$=function(e){return f(xo,fv,jp(e))},s$={$:"ETCMain"},c$={$:"ETCTest"},f$={$:"Expanse"},l$={$:"Kovan"},d$={$:"Mainnet"},h$=function(e){return{$:"Private",a:e}},p$={$:"Rinkeby"},g$={$:"Ropsten"},v$={$:"RskMain"},y$={$:"RskTest"},m$=function(e){switch(e){case 1:return d$;case 2:return f$;case 3:return g$;case 4:return p$;case 30:return v$;case 31:return y$;case 42:return l$;case 41:return s$;case 62:return c$;default:return h$(e)}},b$=n(function(e,t,r){var n=e.a,a=e.b;return bp({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Dd})}),C$=n(function(e,t,n){var a=e.networkId?jk(m$(e.networkId)):o$,i=f(xo,function(e){return l(b$,_(zN,GN),t$,e)},u$(a)),o=e.width<1024?fi(a$):li,u=f(Ua,ZN,ao),s=function(){return $(a,o$)?fi(r$):"Nothing"===jp(a).$?fi(i$):li}(),c=$T(M([o,s])),d=L(f(Ua,io,u),f(Ua,oo,u),f(Ua,uo,u)),h=d.a,p=d.b,g=d.c,v=kb(f(Ni,r(function(e,t){return f(Zi,II(e),t)}),g)),y=Fo(f(Ni,r(function(e,t){return f(np,II(e),t)}),p)),m=f(HN,v,f(qN,t,{currentRoute:so,key:n,screenWidth:e.width,submodel:e$,time:Ho(0),tradeCaches:h,txSentry:i,userAddress:li,userNotices:vr,wallet:a})),b=m.a,C=m.b;return _(f(po,c,b),Fo(M([y,C])))}),E$={$:"Refresh"},S$=function(e){return{$:"UpdateNow",a:e}},T$=Fe,w$=r(function(e,t){return{$:"Every",a:e,b:t}}),I$=r(function(e,t){return{processes:t,taggers:e}}),A$=wh(f(I$,Dd,Dd)),B$=o(function(e,t,a,i,o,u){var s=n(function(r,n,i){e:for(;;){var o=i.a,u=i.b;if(o.b){var s=o.a,c=s.a,f=s.b,h=o.b;if(x(c,r)<0){var p=r,g=n,v=_(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return x(c,r)>0?_(o,l(a,r,n,u)):_(h,d(t,c,f,n,u))}return _(o,l(a,r,n,u))}}),c=l(Lw,s,_(ka(i),u),o),f=c.a,h=c.b;return l(_a,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),k$=r(function(e,t){var r=e.a,n=e.b,a=f(Gd,r,t);if("Nothing"===a.$)return l(Kd,r,M([n]),t);var i=a.a;return l(Kd,r,f(Ra,n,i),t)}),N$=r(function(e,t){return{$:"Zone",a:e,b:t}}),$$=da,R$=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=Nh(f($$,n,f(ah,e,n)));return f(Bh,function(t){return l(R$,e,a,l(Kd,n,t,r))},i)}return wh(r)}),x$=n(function(e,t,r){var i=r.processes,o=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return L(n,a,f(Bh,function(e){return i},kh(t)))}),u=l(_a,k$,Dd,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return L(f(Ra,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return L(a,l(Kd,e,r,i),o)}),d=p(B$,s,c,o,u,i,L(vr,Dd,wh(pr))),h=d.a,g=d.b,v=d.c;return f(Bh,function(e){return wh(f(I$,u,e))},f(Bh,function(t){return l(R$,e,h,g)},v))}),_$=function(e){return Ae(function(t){t(we(e(Date.now())))})}(Ho),L$=n(function(e,t,r){var n=f(Gd,t,r.taggers);if("Nothing"===n.$)return wh(r);var a=n.a,i=function(t){return Ph(f(Ua,function(r){return f(nh,e,r(t))},a))};return f(Bh,function(e){return wh(r)},f(Bh,i,_$))}),P$=r(function(e,t){var r=t.a,n=t.b;return f(w$,r,f(Ma,e,n))});gn.Time=Ue(A$,x$,L$,0,P$);var D$=Me("Time"),U$=r(function(e,t){return D$(f(w$,e,t))}),O$=function(e){return T$(M([f(U$,500,S$),f(U$,5e3,As(E$))]))},M$=function(e){return{$:"UpdateNow",a:e}},F$=function(e){return T$(M([f(U$,2e3,As(wm)),f(U$,500,M$)]))},V$={$:"Refresh"},K$=function(e){return{$:"UpdateNow",a:e}},H$=function(e){return T$(M([f(U$,500,K$),f(U$,5e3,As(V$))]))},j$=function(e){return{$:"DecryptionFinished",a:e}},q$=We("decryptionFinished",xC),G$=We("encryptionFinished",xC),z$=function(e){return{$:"EncryptionFinished",a:e}},W$=function(e){return{$:"Refresh",a:e}},Y$=function(e){return T$(M([f(U$,3e3,W$),G$(z$),q$(function(e){return rw(j$(e))})]))},J$=mn,Q$=T$(vr),X$=function(e){var t=e.submodel;switch(t.$){case"InitialBlank":return Q$;case"CreateModel":t.a;return f(J$,EI,F$());case"TradeModel":t.a;return f(J$,BI,Y$());case"MarketplaceModel":t.a;return f(J$,wI,H$());default:t.a;return f(J$,yI,O$())}},Z$=We("userPubkeyResult",xC),eR=We("walletSentryPort",xC),tR={$:"CheckForNewTrades"},rR={$:"UpdateTradePhases"},nR=function(e){return T$(M([f(U$,5e3,function(e){return tR}),f(U$,3e3,function(e){return rR})]))},aR=function(e){return{$:"Tick",a:e}},iR=function(e){return{$:"UserPubkeySet",a:e}},oR=function(e){return{$:"WalletStatus",a:e}},uR=function(e){return f(up,"Error decoding JS walletSentry: "+e,li)},sR=function(e){return{$:"ErrorDecoding",a:e}},cR=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),fR=l(Vi,r(function(e,t){return{ref:e,txHash:t}}),f(hl,"ref",xT),f(hl,"txHash",Wk(GC))),lR=function(e){var t=f(nv,fR,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(cR,r.ref,hi(a))}return f(cR,r.ref,di("Problem signing/broadcasting Tx. Ref #"+Ri(r.ref)))}t.a;return sR("Error decoding tx data")},dR=function(e){var t=e.a;return f(J$,t.tagger,t.inPort(lR))},hR=f(Fi,m$,xT),pR=Tu(f(tu,cd,f(tu,ev("Failure decoding stringy int"),du(m$)))),gR=RC(M([pR,hR])),vR=r(function(e,t){return{account:e,networkId:t}}),yR=l(Vi,vR,f(hl,"account",Wk(DC)),f(hl,"networkId",gR)),mR=n(function(e,t,r){var n=f(nv,yR,r);if("Err"===n.$){var a=n.a;return e(Oi(a))}return t(n.a)}),bR=function(e){var t=f(tu,uR,f(tu,ya,mI));return T$(U(M([f(U$,1e3,aR),eR(f(mR,t,oR)),f(Kc,Q$,f(xo,dR,e.txSentry)),Z$(iR),T$(f(Ni,r(function(e,t){return f(J$,II(e),t)}),f(Ua,nR,e.tradeCaches)))]),M([X$(e)])))},CR=function(e){return{$:"LinkClicked",a:e}},ER=function(e){return{$:"UrlChanged",a:e}},SR={$:"ClickHappened"},TR={$:"Generic"},wR=TR,IR=r(function(e,t){return d(Rk,KI,wR,f(Ra,UI(PI),f(Ra,_I(PI),e)),FI(M([t])))}),AR=function(e){return{$:"Fill",a:e}},BR=AR(1),kR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),NR={$:"NoAttribute"},$R=r(function(e,t){return"Empty"===t.$?NR:f(kR,e,t)}),RR={$:"InFront"},xR=function(e){return f($R,RR,e)},_R=qi,LR=function(e){return{$:"Px",a:e}},PR=LR,DR=n(function(e,t,r){return d(Lk,e/255,t/255,r/255,1)}),UR=gA(8),OR=function(e){return f(Ok,UR,l(Uk,"bg-"+Mk(e),"background-color",e))},MR=function(){var e=l(DR,7,27,92),t=l(DR,10,33,108);return f(IR,M([UI(BR),_I(PR(600)),OR(t),xR(f(IR,M([UI(BR),_I(PR(80)),OR(e)]),_R))]),_R)}(),FR=function(e){return{$:"JustImage",a:e}},VR=FR({description:"marketplace",src:"/DAIHard/static/img/farmer-s-market-kiosk-1.svg"}),KR=FR({description:"myTrades",src:"/DAIHard/static/img/diamond.svg"}),HR=FR({description:"newTrade",src:"/DAIHard/static/img/add-circle-bold.svg"}),jR={$:"Active"},qR={$:"Important"},GR={$:"Normal"},zR=l(DR,255,0,110),WR=l(Pk,1,1,1),YR=kI("alt"),JR=function(e){return f(kI,"src",at(e))},QR=r(function(e,t){var r=t.src,n=t.description,a=f(pp,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(Rk,KI,wR,f(Ra,xk(GI.imageContainer),e),FI(M([d(Rk,KI,MI("img"),U(M([OI(JR(r)),OI(YR(n))]),a),FI(vr))])))}),XR=r(function(e,t){if("None"===t.$)return f(IR,e,_R);var r=t.a;return f(QR,e,r)}),ZR=function(e){return{$:"AlignY",a:e}},ex={$:"CenterY"},tx=ZR(ex),rx=gA(2),nx=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),ax=r(function(e,t){return $(e,t)?f(Ok,rx,h(nx,"p-"+Ri(e),e,e,e,e)):f(Ok,rx,h(nx,"p-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),ix=gA(21),ox=r(function(e,t){return{$:"Class",a:e,b:t}}),ux=f(ox,ix,GI.cursorPointer),sx={$:"AsRow"},cx=sx,fx=r(function(e,t){return d(Rk,cx,wR,f(Ra,xk(GI.contentLeft+" "+GI.contentCenterY),f(Ra,UI(PI),f(Ra,_I(PI),e))),FI(t))}),lx=gA(3),dx=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),hx=r(function(e,t){return"spacing-"+Ri(e)+"-"+Ri(t)}),px=function(e){return f(Ok,lx,l(dx,f(hx,e,e),e,e))},gx=gA(17),vx=function(e){return f(Ok,gx,l(fk,"br-"+Ri(e),"border-radius",Ri(e)+"px"))},yx=function(e){return{$:"Normal",a:e}},mx=Bn,bx=r(function(e,t){return f(mx,e,yx(t))}),Cx=function(e){return f(bx,"click",Ki(e))},Ex=f(Ma,OI,Cx),Sx=gA(13),Tx=f(ox,Sx,GI.textSemiBold),wx=gA(4),Ix=function(e){return{$:"FontSize",a:e}},Ax=function(e){return f(Ok,wx,Ix(e))},Bx=a(function(e,t,r,n){var a=function(){switch(n.$){case"Normal":return vr;case"Active":return M([vx(4),OR(l(DR,2,172,214))]);default:return M([vx(4),OR(zR)])}}();return f(fx,U(M([f(ax,23,12),Ax(21),Tx,Fk(WR),ux,Ex(r),px(13)]),a),M([f(Kc,_R,f(xo,XR(M([_I(PR(26))])),e)),f(IR,M([tx,_I(PR(26))]),ep(t))]))}),kx=function(e){return{$:"AlignX",a:e}},Nx={$:"CenterX"},$x=kx(Nx),Rx=function(e){return{$:"Describe",a:e}},xx={$:"Paragraph"},_x=r(function(e,t){return d(Rk,iA,wR,f(Ra,Rx(xx),f(Ra,UI(BR),f(Ra,px(5),e))),FI(t))}),Lx=f(ox,Sx,GI.bold),Px=f(IR,M([Ax(29),Fk(WR),Lx,$x,ux,Ex(SI(vb))]),f(_x,vr,M([ep("DAI"),f(IR,M([Fk(zR)]),ep("Hard"))]))),Dx={$:"Right"},Ux=kx(Dx),Ox={$:"AsColumn"},Mx=Ox,Fx=r(function(e,t){return d(Rk,Mx,wR,f(Ra,xk(GI.contentTop+" "+GI.contentLeft),f(Ra,_I(PI),f(Ra,UI(PI),e))),FI(t))}),Vx=function(e){return f(fx,M([UI(BR),px(30),f(ax,30,17)]),M([d(Bx,fi(VR),"Marketplace",SI(yb),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return jR}return GR}()),function(){var t=Sm(e.wallet);if("Just"===t.$){var r=t.a;return d(Bx,fi(KR),"My Trades",SI(pb(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?jR:GR}return GR}())}return d(Bx,li,"Connect to Wallet",bI,qR)}(),d(Bx,fi(HR),"Create New Trade",SI(vb),function(){return"CreateModel"===e.submodel.$?jR:GR}()),f(Fx,M([Ux,px(0),f(ax,8,0)]),M([Px]))]))},Kx=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,fi(e.agentAddress))}},Hx=function(e){return pp(e)},jx=r(function(e,t){return f(pp,$m(e),t)}),qx=function(e){return f(pp,function(e){return aS(e.parameters)},Ww(e))},Gx={$:"BurnWindow"},zx={$:"Offer"},Wx={$:"PaymentWindow"},Yx={$:"Price"},Jx={$:"ResponderProfit"},Qx=gA(20),Xx=f(ox,Qx,GI.clip),Zx=AR,e_=function(e){return f(Ok,rx,h(nx,"p-"+Ri(e),e,e,e,e))},t_=r(function(e,t){return f(IR,M([UI(Zx(e)),_I(PR(60)),Xx]),f(IR,M([e_(12),tx,UI(BR)]),t))}),r_=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"Price":return 2;case"ResponderProfit":return 1;case"PaymentWindow":default:return 2}},n_=FR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),a_=FR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),i_=function(e){return{$:"ChangeSort",a:e}},o_=f(ox,Sx,GI.textMedium),u_=function(e){return f(IR,M([o_,Ax(17)]),ep(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"Price":return"For";case"ResponderProfit":return"Responder Profit";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},s_=r(function(e,t){return f(fx,M([px(5),ux,Ex(i_(e))]),M([u_(e),function(){if("Just"===t.$){var e=t.a;return f(IR,M([tx]),f(XR,M([UI(PR(8))]),function(){return"Ascending"===e.$?n_:a_}()))}return _R}()]))}),c_=r(function(e,t){return f(t_,r_(t),f(s_,t,e))}),f_=r(function(e,t){return f(fx,M([UI(BR)]),f(Ua,function(t){var r=$(e.a,t)?fi(e.b):li;return f(c_,r,t)},t))}),l_=l(DR,150,150,150),d_=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},h_=r(function(e,t){return $(e.symbol,t.symbol)?f(Ju,e.amount,t.amount):f(Ju,e.symbol,t.symbol)}),p_=function(e){if("Ok"===e.$){var t=e.a;return fi(t)}return li},g_=r(function(e,t){return f(xo,function(e){var r=t.terms.price.amount*e,n=gm(t.parameters.tradeAmount),a=function(){return"Buyer"===t.parameters.initiatorRole.$?_(n,r):_(r,n)}(),i=a.a;return(a.b-i)/i},f($o,p_,f(cy,t.terms.price.symbol,e)))}),v_=n(function(e,t,r){return f(e,r,t)}),y_=r(function(e,t){var n=t.a;return($(t.b,Oo)?Fa:v_)(function(){switch(n.$){case"Phase":return r(function(t,r){return $(t.state.phase,r.state.phase)?d(y_,e,_(zm,zh),t,r):f(Ju,d_(t.state.phase),d_(r.state.phase))});case"Expires":return r(function(e,t){return f(ol,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Km,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"Price":return r(function(e,t){return f(h_,e.terms.price,t.terms.price)});case"ResponderProfit":return r(function(t,r){return f(Kc,Ea,l(aT,Ju,f(g_,e,t),f(g_,e,r)))});case"PaymentWindow":return r(function(e,t){return f(ol,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(ol,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())}),m_=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),b_=function(e){return f(IR,M([UI(BR),_I(BR),Xx]),f(_x,M([Ax(12)]),M([ep(e.info)])))},C_=function(e){return f(Kc,_R,f(xo,b_,ov(e)))},E_=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"(k)Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"(k)ETH";default:e.a;return"xDai"}},S_=function(e){return{$:"TimeLeft",a:e}},T_=function(e){return{$:"TimeUp",a:e}},w_=r(function(e,t){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ho(0)}}),I_=r(function(e,t){var r=f(w_,t.state.phase,t),n=f(ul,e,t.state.phaseStartTime),a=f(ul,r,n);return il(a)>0?S_(_(a,r)):T_(r)}),A_=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},B_=l(Pk,0,0,0),k_=l(DR,51,183,2),N_=function(e){return U(e>0?"+":"",function(e){return e+"%"}(e<.1?uy(function(e){return e/10}(Yl(1e3*e))):Ri(Yl(100*e))))},$_=r(function(e,t){var r=N_(t);if("0%"===r)return f(IR,M([Ax(16)]),ep("0%"));var n=r;return f(IR,M([Fk(t>=0===e?k_:zR),Ax(16)]),ep(n))}),R_=function(e){return il(e)<0},x_=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),__=function(e){var t=Qv(e);return function(e){var t=e.a,r=e.b;return function(e){var r=e.a,n=e.b;return function(e){var n=e.a,a=e.b;return d(x_,KS(t),KS(r),KS(n),KS(a))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,n,Zu(60))))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,r,Zu(3600))))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,t,Zu(86400))))},L_=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!R_(a)){var u=r(function(e,t){return U(l(Os,2,P("0"),Ri(e)),t)}),s=il(a)>0?i:o,c=__(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(fx,U(M([px(5)]),e),M([f(IR,U(M([Fk(h)]),t),ep(f(u,c.days,"d"))),f(IR,U(M([Fk(d)]),t),ep(f(u,c.hours,"h"))),f(IR,U(M([Fk(s)]),t),ep(f(u,c.min,"m")))]))}var p=e,g=t,v=_(i,o),y=Ho(0);e=p,t=g,n=v,a=y}}),P_=l(DR,233,237,242),D_={$:"Behind"},U_=function(e){return f($R,D_,e)},O_=r(function(e,t){var r=Yl(200*e),n=200-r,a=f(IR,M([UI(Zx(n))]),_R),i=M([_I(PR(3)),vx(20)]),o=f(IR,U(i,M([UI(Zx(r)),OR(t)])),_R),u=f(IR,U(i,M([UI(BR),OR(P_)])),_R);return f(fx,M([UI(BR),U_(u)]),M([o,a]))}),M_=l(Pk,1,1,0),F_=r(function(e,t){return il(e)/il(t)}),V_=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(F_,o,u),c=(f(IR,M([$x]),d(L_,vr,vr,_(a,i),o)),s<.1?zR:s<.2?M_:k_);return f(Fx,U(M([px(5)]),e),M([d(L_,M([$x]),t,_(a,i),o),f(O_,1-s,c)]))}),K_=M(["BTC","ZEC","XMR","DASH"]),H_=FR,j_=Hd(f(Ua,function(e){return _(e,H_({description:e,src:"/DAIHard/static/img/currencies/crypto/"+e+".png"}))},U(K_,M(["DAI","XDAI"])))),q_=Hd(f(Ua,function(e){var t=e.a;return _(t,_(e.b,H_({description:t,src:"/DAIHard/static/img/currencies/fiat/"+t+".svg"})))},M([_("AUD","$"),_("CLP","$"),_("EUR","€"),_("IDR","Rp"),_("KRW","₩"),_("NZD","$"),_("RUB","₽"),_("TRY","₺"),_("BRL","R$"),_("CNY","¥"),_("GBP","£"),_("ILS","₪"),_("MXN","$"),_("PHP","₱"),_("SEK","kr"),_("TWD","NT$"),_("CAD","$"),_("CZK","Kč"),_("HKD","$"),_("INR","₹"),_("MYR","RM"),_("PKR","₨"),_("SGD","$"),_("USD","$"),_("CHF","Fr"),_("DKK","kr"),_("HUF","Ft"),_("JPY","¥"),_("NOK","kr"),_("PLN","zł"),_("THB","฿"),_("ZAR","R"),_("VND","₫")]))),G_=FR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),z_=r(function(e,t){return"Nothing"===e.$?t:e}),W_=function(e){return"DAI"===e?fi(G_):f(z_,f(Gd,e,j_),f(xo,mu,f(Gd,e,q_)))},Y_=function(e){return f(xo,XR(M([_I(PR(26))])),W_(e))},J_=function(e){return f(xo,ei,f(Gd,e,q_))},Q_=i(function(e,t,r,n,a){return{decimals:r,integers:t,original:e,prefix:n,suffix:a}}),X_={$:"Negative"},Z_={$:"Positive"},eL={$:"Zero"},tL=function(e){return f($i,function(e){return $(e,P("0"))},qy(f(co,e.integers,Ow(e.decimals))))?eL:e.original<0?X_:Z_},rL=function(e){var t=function(e){return iu(e)>3?f(Ra,f(pu,3,e),t(f(um,3,e))):M([e])};return La(t(e))},nL=K,aL=xr,iL=n(function(e,t,r){return U(r,f(Us,e-iu(r),Ls(t)))}),oL=Y,uL=r(function(e,t){var r=f(fo,function(e){return!$(e,P("0"))&&!$(e,P("."))},uc(t));return U(e&&r?"-":"",t)}),sL=function(e){var t=e.a,r=e.b;if($(t,P("9"))){var n=_i(r);if("Nothing"===n.$)return"01";var a=n.a;return f(_s,P("0"),sL(a))}var i=bi(t);return i>=48&&i<57?f(_s,xE(i+1),r):"0"},cL=function(e){var t=f(Li,".",e);if(t.b){if(t.b.b){var r=t.a;return _(r,t.b.a)}var r=t.a;return _(r,"0")}return _("0","0")},fL=function(e){var t=f(Li,"e",uy(Xu(e)));if(t.b){if(t.b.b){var r=t.a,n=t.b,a=n.a,i=f(Kc,0,cd(f(vu,"+",a)?f(uu,1,a):a)),o=cL(r),u=o.a,s=o.b,c=U(u,s),d=i<0?f(Kc,"0",f(xo,function(e){return e.a+"."+e.b},f(xo,Fu(Ls),_i(U(f(Us,Xu(i),"0"),c))))):l(iL,i+1,P("0"),c);return U(e<0?"-":"",d)}var r=t.a;return U(e<0?"-":"",r)}return""},lL=n(function(e,t,r){if(nL(r)||aL(r))return uy(r);var n=r<0,a=cL(fL(Xu(r))),i=a.a,o=a.b,u=iu(i)+t,s=U(f(Us,1-u,"0"),l(iL,u,P("0"),U(i,o))),c=iu(s),d=f(ni,1,u),h=f(e,n,l(ou,d,c,s)),p=l(ou,0,d,s),g=h?oL(f(Kc,"1",f(xo,sL,_i(oL(p))))):p,v=iu(g),y="0"===g?g:t<=0?U(g,f(Us,Xu(t),"0")):x(t,iu(o))<0?l(ou,0,v-t,g)+"."+l(ou,v-t,v,g):U(i+".",l(iL,t,P("0"),o));return f(uL,n,y)}),dL=lL(r(function(e,t){var r=_i(t);if("Nothing"===r.$)return!1;if("5"===r.a.a.valueOf()){if(""===r.a.b){r.a;return!e}r.a;return!0}var n=r.a,a=n.a;return function(t){return t>53&&e||t>=53&&!e}(bi(a))})),hL=r(function(e,t){var r=f(Li,".",f(dL,e.decimals,t)),n=rL(f(Cm,Ti,f(Kc,"0",ov(r)))),a=f(Kc,"",ov(f(Wg,1,r))),i=h(Q_,t,n,a,"","");switch(tL(i).$){case"Negative":return D(i,{prefix:e.negativePrefix,suffix:e.negativeSuffix});case"Positive":return D(i,{prefix:e.positivePrefix,suffix:e.positiveSuffix});default:return i}}),pL=r(function(e,t){return""===t?"":U(e.decimalSeparator,t)}),gL=function(e){return"0"!==f(pu,1,e)?e:gL(f(um,1,e))},vL=n(function(e,t,r){return""===r||$(f(Us,e.decimals,"0"),r)?"":"KeepZeros"===t.$?U(e.decimalSeparator,r):f(pL,e,gL(r))}),yL=n(function(e,t,r){var n=function(){if("Just"===t.$){var r=t.a;return f(vL,e,r)}return pL(e)}(),a=f(xi,e.thousandSeparator,r.integers),i=n(r.decimals);return qy(M([r.prefix,a,i,r.suffix]))}),mL=n(function(e,t,r){return l(yL,e,fi(t),f(hL,e,r))}),bL={$:"RemoveZeros"},CL=u(function(e,t,r,n,a,i,o){return{decimalSeparator:r,decimals:e,negativePrefix:n,negativeSuffix:a,positivePrefix:i,positiveSuffix:o,thousandSeparator:t}}),EL=g(CL,2,",",".","−","","",""),SL=function(e){return f(mL,D(EL,{decimals:e}),bL)},TL=function(e){return f(Kc,"",J_(e.symbol))+(f(SL,8,e.amount)+" ")+e.symbol},wL=Lk,IL=function(e){return f(fx,M([px(4)]),M([f(Kc,_R,Y_(e.symbol)),f(IR,M([Fk(d(wL,0,0,0,.5)),o_,UI(PR(50))]),ep(e.symbol)),ep(TL(e))]))},AL=function(e){var t=ri(f(ja,10,e)+1),r=f(ni,3-t,0);return f(SL,r,e)},BL=function(e){return AL(gm(e))},kL=a(function(e,t,r,n){return f(t_,r_(r),function(){switch(r.$){case"Phase":var a=A_(n.state.phase),i=_(f(I_,e,n),n.state.phase);e:for(;;){if("TimeLeft"===i.a.$){if("Closed"===i.b.$)break e;var o=i.a.a,u=f(F_,o.a,o.b)<.05?zR:B_;return f(Fx,M([px(3)]),M([ep(a),d(V_,M([UI(BR)]),M([Ax(16)]),_(u,P_),o)]))}if("Closed"===i.b.$)break e;var s=i.a.a;return f(fx,M([px(6),Fk(l_)]),M([ep(a),f(IR,M([Ax(16)]),ep("(stale)"))]))}i.b;return ep(a);case"Expires":if("Open"===n.state.phase.$){var c=f(I_,e,n);if("TimeLeft"===c.$){var o=c.a,u=f(F_,o.a,o.b)<.05?zR:B_;return d(V_,M([UI(BR)]),M([Ax(16)]),_(u,P_),o)}var s=c.a;return d(V_,M([UI(BR)]),M([Ax(16)]),_(zR,P_),_(Ho(0),s))}return _R;case"Offer":return f(fx,M([px(5)]),M([ep(function(){return"Buyer"===n.parameters.initiatorRole.$?"Buying ":"Selling "}()+(BL(n.parameters.tradeAmount)+" ")+E_(n.factory))]));case"Price":return IL(n.terms.price);case"ResponderProfit":return f(Kc,_R,f(xo,$_(!0),f(g_,t,n)));case"PaymentWindow":var l=function(){return"Seller"===n.parameters.initiatorRole.$?zR:k_}(),h=x(il(n.parameters.autoabortInterval),216e5)<0?l:B_;return d(L_,vr,vr,_(h,P_),n.parameters.autoabortInterval);default:var l=function(){return"Seller"===n.parameters.initiatorRole.$?k_:zR}(),h=x(il(n.parameters.autoabortInterval),216e5)<0?l:B_;return d(L_,vr,vr,_(h,P_),n.parameters.autoreleaseInterval)}}())}),NL=a(function(e,t,r,n){return f(Fx,M([UI(BR),px(1),OR(WR),ux,Ex(f(m_,n.factory,n.id))]),M([f(fx,M([UI(BR),px(1)]),f(Ua,function(r){return d(kL,e,t,r,n)},r)),f(t_,1,C_(n.terms.paymentMethods))]))}),$L=Cr,RL=gA(28),xL=function(e){return f(Ok,RL,l(Uk,"bc-"+Mk(e),"border-color",e))},_L=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),LL=function(e){return f(Ok,Ak,h(_L,"b-"+Ri(e),e,e,e,e))},PL=i(function(e,t,r,n,a){return f(Fx,M([UI(BR),LL(2),vx(8),xL(l_),px(2),OR(l_),Xx]),f(Ua,l(NL,e,r,n),f($L,f(y_,r,t.orderBy),a)))}),DL=i(function(e,t,r,n,a){return f(Fx,M([UI(BR),_I(BR),px(5)]),M([f(f_,t.orderBy,n),h(PL,e,t,r,n,a)]))}),UL=a(function(e,t,r,n){return"pad-"+Ri(e)+"-"+Ri(t)+"-"+Ri(r)+"-"+Ri(n)}),OL=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(Ok,rx,h(nx,"p-"+Ri(t),t,t,t,t)):f(Ok,rx,h(nx,d(UL,t,r,n,a),t,r,n,a))},ML=xk(GI.italic),FL=a(function(e,t,r,n){var a=f(jx,n.filters,kb(f(Ua,function(e){return f(Hx,Kx(n),qx(e))},r)));return $(a,vr)?f(IR,M([$x,Ax(24),OL({bottom:0,left:0,right:0,top:30}),ML]),ep(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Ji,Qo,h(DL,e,n.tradeTable,n.prices,M([Mo,zx,Yx,Jx,Wx,Gx]),a))}),VL=function(e){return{$:"FiltersMsg",a:e}},KL=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},HL=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),jL=tk,qL={$:"Left"},GL=kx(qL),zL=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(Rk,Mx,MI("label"),e,FI(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(Rk,KI,wR,a,FI(M([i])));switch(n.$){case"Above":return d(Rk,Mx,MI("label"),e,FI(M([o,r])));case"Below":return d(Rk,Mx,MI("label"),e,FI(M([r,o])));case"OnRight":return d(Rk,cx,MI("label"),e,FI(M([r,o])));default:return d(Rk,cx,MI("label"),e,FI(M([o,r])))}}),WL=function(e){return{$:"Label",a:e}},YL=function(e){if("HiddenLabel"===e.$){var t=e.a;return Rx(WL(t))}return NR},JL=function(e){return"HiddenLabel"===e.$},QL=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return Eu("No key matched");var n=r.a;return Ki(n)},r=f(Cu,t,f(hl,"key",Su));return OI(f(bx,"keyup",r))},XL=function(e){return f($n,"tabIndex",Ri(e))},ZL=f(Ma,OI,XL),eP={$:"LivePolite"},tP=Rx(eP),rP=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([JL(r)?NR:px(6),OI(Cx(i(!a))),tP,QL(function(e){return $(e,"Enter")?fi(i(!a)):$(e," ")?fi(i(!a)):li}),ZL(0),ux,GL,UI(BR)]),e);return l(zL,o,r,d(Rk,KI,wR,M([OI(f(jL,"role","checkbox")),OI(f(jL,"aria-checked",a?"true":"false")),YL(r),tx,_I(BR),UI(PI)]),FI(M([n(a)]))))}),nP=Ir,aP=function(e){return e*nP/180},iP=gA(26),oP=function(e){return{$:"MoveY",a:e}},uP=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),sP=function(e){return f(uP,iP,oP(-e))},cP=gA(24),fP=r(function(e,t){return{$:"Rotate",a:e,b:t}}),lP=function(e){return f(uP,cP,f(fP,L(0,0,1),e))},dP=gA(19),hP=function(e){return qy(M([e.inset?"box-inset":"box-",kA(e.offset.a)+"px",kA(e.offset.b)+"px",kA(e.blur)+"px",kA(e.size)+"px",Mk(e.color)]))},pP=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(Ok,dP,l(fk,hP(t),"box-shadow",PA(t)))},gP=r(function(e,t){return f(Ok,Ak,h(_L,"b-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),vP=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?LL(r):f(gP,n,r):f(Ok,Ak,h(_L,"b-"+Ri(r)+"-"+Ri(a)+"-"+Ri(t)+"-"+Ri(n),r,a,t,n))},yP=gA(12),mP=f(ox,yP,GI.textCenter),bP=l(Pk,1,1,1),CP=function(e){return f(IR,M([xk("focusable"),UI(PR(14)),_I(PR(14)),Fk(bP),tx,Ax(9),mP,vx(3),xL(e?l(Pk,59/255,.6,252/255):l(Pk,211/255,211/255,211/255)),pP({blur:1,color:e?d(wL,238/255,238/255,238/255,0):l(Pk,238/255,238/255,238/255),offset:_(0,0),size:1}),OR(e?l(Pk,59/255,.6,252/255):bP),LL(e?0:1)]),e?f(IR,M([xL(bP),_I(PR(6)),UI(PR(9)),lP(aP(-45)),$x,tx,sP(1),vP({bottom:2,left:2,right:0,top:0})]),_R):_R)},EP=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),SP={$:"OnRight"},TP=EP(SP),wP=r(function(e,t){return f(rP,vr,{checked:t.checked,icon:CP,label:f(TP,vr,ep(t.label)),onChange:f(HL,e,t.label)})}),IP={$:"Top"},AP=ZR(IP),BP=function(e){return f(Fx,M([px(15),AP]),M([f(IR,M([Ax(28),o_]),ep(KL(e.type_))),f(Fx,M([px(5)]),f(Ua,wP(e.type_),e.options))]))},kP=function(e){return f(fx,M([px(20)]),f(Ua,BP,e))},NP={$:"NoneFound"},$P={$:"AllFetched"},RP={$:"FetchingTrades"},xP={$:"QueryingNumTrades"},_P=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return xP;if(t.a){var r=t.a;return x(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?RP:$P}return NP},LP=r(function(e,t){var r=function(e){return f(IR,M([Ax(20),Tx,Fk(l_),$x]),ep(e))},n=f(Bg,Za(NP),f(Ua,_P,e))?M([r("No trades found.")]):f(Ua,r,$T(f(Ua,function(e){switch(_P(e).$){case"QueryingNumTrades":return fi("Querying "+WN(e.factory)+" Factory...");case"NoneFound":return li;case"FetchingTrades":return fi("Fetching "+WN(e.factory)+" Trades...");default:return li}},e)));return f(IR,M([UI(BR),xR(f(Fx,M([px(5),GL]),n))]),f(IR,M([$x]),f(Ji,VL,kP(t.filters))))}),PP=r(function(e,t){return f(IR,M([vx(4),OR(d(wL,0,0,1,.1)),Fk(l(DR,16,7,234)),Ax(e),Tx,f(ax,15,13)]),ep(sp(t)))}),DP=function(e){return function(){var t=Sm(e.wallet);return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?_R:f(fx,M([px(10),$x,OL({bottom:20,left:20,right:20,top:10})]),M([f(IR,M([Ax(24),Tx]),ep("Trade History for User")),f(PP,18,e.agentAddress)]))},UP=r(function(e,t){return{$:"Max",a:e,b:t}}),OP=r(function(e,t){return f(UP,e,t)}),MP=r(function(e,t){return f(IR,M([OL({bottom:40,left:0,right:0,top:60}),UI(BR)]),f(IR,M([OR(WR),vx(8),$x,UI(f(OP,e,BR)),pP({blur:20,color:d(wL,0,0,0,.06),offset:_(0,3),size:0})]),t))}),FP=n(function(e,t,r){return f(MP,1800,f(Fx,M([UI(BR),e_(30)]),M([DP(r),f(LP,t,r),function(){var n=f(Bg,f(tu,_P,Za($P)),t);return d(FL,e,n,t,r)}()])))}),VP=function(e){return{$:"AmountInChanged",a:e}},KP={$:"InTypeClicked"},HP=function(e){return{$:"InTypeSelected",a:e}},jP=function(e){return{$:"SearchInputChanged",a:e}},qP={$:"NoOp"},GP=function(e){return{$:"MayStopPropagation",a:e}},zP=r(function(e,t){return f(mx,e,GP(t))}),WP=OI,YP=function(e){return WP(f(zP,"click",Ki(_(e,!0))))},JP=kn,QP=JP,XP=a(function(e,t,r,n){return f(IR,M([U_(f(IR,M([OR(e),WP(f(QP,"position","fixed")),WP(f(QP,"z-index","1000")),WP(f(QP,"top","0")),WP(f(QP,"left","0")),WP(f(QP,"width","100%")),WP(f(QP,"height","100%")),Ex(r)]),_R)),UI(BR),_I(BR),YP(t)]),n)}),ZP=gA(33),eD={$:"Hover"},tD=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),rD=xn,nD=r(function(e,t){switch(t.$){case"NoAttribute":return NR;case"Describe":var r=t.a;return Rx(r);case"AlignX":var n=t.a;return kx(n);case"AlignY":var a=t.a;return ZR(a);case"Width":var n=t.a;return DI(n);case"Height":var n=t.a;return xI(n);case"Class":var n=t.a,a=t.b;return f(ox,n,a);case"StyleClass":var i=t.a,o=t.b;return f(Ok,i,o);case"Nearby":var u=t.a,s=t.b;return f(kR,u,f(Yi,e,s));case"Attr":var c=t.a;return OI(f(rD,e,c));default:var l=t.a,d=t.b;return f(uP,l,d)}}),aD=function(e){return f(nD,SN,e)},iD=r(function(e,t){var r=t.a,n=t.b,a=aD(e);switch(a.$){case"StyleClass":var i=a.b;return _(f(Ra,i,r),n);case"TransformComponent":var o=(a.a,a.b);return _(r,f(Tk,n,o));default:return _(r,n)}}),oD=function(e){var t=l(_a,iD,_(vr,Nk),e),r=t.a,n=t.b;return f(Ra,lk(n),r)},uD=function(e){return f(Ok,ZP,f(tD,eD,oD(e)))},sD=f(ox,Qx,GI.scrollbarsY),cD=n(function(e,t,r){return f(IR,U(e,M([OR(WR),vx(6),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0})])),f(Fx,M([OR(P_),px(1),UI(BR),_I(f(OP,340,PI))]),M([f(Kc,_R,t),f(Fx,M([sD,UI(BR),_I(BR),OR(P_),px(1)]),f(Ua,function(e){var t=e.a,r=e.b;return f(IR,M([f(ax,14,10),OR(WR),UI(BR),Ex(r),ux,uD(M([OR(d(wL,0,0,1,.15))]))]),t)},r))])))}),fD=l(DR,213,217,222),lD=FR({description:"search",src:"/DAIHard/static/img/search.svg"}),dD=function(e){return{$:"HiddenLabel",a:e}},hD=dD,pD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),gD=pD,vD=Tn("span"),yD=kI("type"),mD=function(e){return _(e,!0)},bD=r(function(e,t){return l(Da,hl,t,e)}),CD=f(bD,M(["target","value"]),Su),ED=function(e){return f(zP,"input",f(Fi,mD,f(Fi,e,CD)))},SD={$:"TextArea"},TD=f(Ma,OI,jL("autocomplete")),wD=function(e){var t=r(function(e,t){if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,n=(r.b,r.c);return"Nothing"===t.$?fi(n):t}return t}),n=l(Da,t,li,e);if("Nothing"===n.$)return NR;var a=n.a;return sP(ri(a/2))},ID=l(Pk,186/255,189/255,182/255),AD=f(ax,12,12),BD=M([AD,vx(3),xL(ID),OR(bP),LL(1),px(5),UI(BR),_I(PI)]),kD=function(e){if("Height"===e.$){var t=e.a;return fi(t)}return li},ND=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},$D=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":case"Fill":return!0;case"Min":var t=e.b,r=t;e=r;continue e;default:var t=e.b;return!0}},RD=function(e){if("Label"!==e.$)return!0;switch(e.a.$){case"OnRight":case"OnLeft":return!1;case"Above":default:return!0}},xD=function(e){return{bottom:-e.bottom,left:-e.left,right:-e.right,top:-e.top}},_D=function(e){e:for(;;)switch(e.$){case"Fill":return!0;case"Content":case"Px":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},LD=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":return!0;case"Fill":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},PD=a(function(e,t,r,n){switch(r.$){case"Nearby":return D(n,{parent:f(Ra,r,n.parent)});case"Width":var a=r.a;return _D(a)?D(n,{fullParent:f(Ra,r,n.fullParent),input:f(Ra,r,n.input),parent:f(Ra,r,n.parent)}):t?D(n,{fullParent:f(Ra,r,n.fullParent)}):D(n,{parent:f(Ra,r,n.parent)});case"Height":var i=r.a;return t?_D(i)?D(n,{fullParent:f(Ra,r,n.fullParent),parent:f(Ra,r,n.parent)}):(LD(i),D(n,{parent:f(Ra,r,n.parent)})):D(n,{fullParent:f(Ra,r,n.fullParent),parent:f(Ra,r,n.parent)});case"AlignX":case"AlignY":return D(n,{fullParent:f(Ra,r,n.fullParent)});case"StyleClass":switch(r.b.$){case"SpacingStyle":r.b;return D(n,{fullParent:f(Ra,r,n.fullParent),input:f(Ra,r,n.input),parent:f(Ra,r,n.parent),wrapper:f(Ra,r,n.wrapper)});case"PaddingStyle":var o=(r.a,r.b),u=(o.a,o.b),s=o.c,c=o.d,l=o.e;if(e)return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});var d=OL({bottom:c-f(Rc,u,c),left:l,right:s,top:u-f(Rc,u,c)}),h=WP(f(QP,"line-height","calc(1.0em + "+Ri(2*f(Rc,u,c))+"px)")),p=WP(f(QP,"height","calc(1.0em + "+Ri(2*f(Rc,u,c))+"px)"));return D(n,{cover:f(Ra,r,n.cover),input:f(Ra,p,f(Ra,h,n.input)),parent:f(Ra,d,n.parent)});case"BorderWidth":r.b;return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});case"Transform":return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});case"FontSize":return D(n,{fullParent:f(Ra,r,n.fullParent)});case"FontFamily":r.b;return D(n,{fullParent:f(Ra,r,n.fullParent)});default:r.a,r.b;return D(n,{parent:f(Ra,r,n.parent)})}case"NoAttribute":return n;case"Attr":r.a;return D(n,{input:f(Ra,r,n.input)});case"Describe":return D(n,{input:f(Ra,r,n.input)});case"Class":return D(n,{parent:f(Ra,r,n.parent)});default:return D(n,{input:f(Ra,r,n.input)})}}),DD=n(function(e,t,r){return function(e){return{cover:La(e.cover),fullParent:La(e.fullParent),input:La(e.input),parent:La(e.parent),wrapper:La(e.wrapper)}}(l(_a,f(PD,e,t),{cover:vr,fullParent:vr,input:vr,parent:vr,wrapper:vr},r))}),UD=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return Ri(t)+"px "+Ri(r)+"px "+Ri(n)+"px "+Ri(a)+"px"},OD=gA(0),MD=r(function(e,t){return{$:"Transparency",a:e,b:t}}),FD=function(e){var t=function(e){return 1-e}(f(Rc,1,f(ni,0,e)));return f(Ok,OD,f(MD,"transparency-"+kA(t),t))},VD=l(Pk,136/255,138/255,133/255),KD=n(function(e,t,r){var n=e.a,a=e.b;return f(IR,U(t,U(M([Fk(VD),xk(GI.noTextSelection+" "+GI.passPointerEvents),Xx,xL(d(wL,0,0,0,0)),OR(d(wL,0,0,0,0)),_I(BR),UI(BR),FD(r?1:0)]),n)),a)}),HD=be,jD=r(function(e,t){return f(Nn,e,HD(t))}),qD=jD("spellcheck"),GD=f(Ma,OI,qD),zD=kI("value"),WD=f(Ma,OI,zD),YD=f(Ma,Wi,As),JD=n(function(e,t,r){var n=U(BD,t),a=l(DD,$(e.type_,SD),RD(r.label),n),i=function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return!1}return f(Kc,!1,f(xo,$D,ov(La(f(_h,kD,n)))))}(),o=function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=(e.a,e.b),r=(t.a,t.b),n=t.c,a=t.d,i=t.e;return fi({bottom:f(ni,0,ri(a-3)),left:f(ni,0,ri(i-3)),right:f(ni,0,ri(n-3)),top:f(ni,0,ri(r-3))})}return li},u=f(Kc,{bottom:0,left:0,right:0,top:0},ov(La(f(_h,o,n)))),s=d(Rk,KI,function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return MI("input")}return MI("textarea")}(),U(function(){var t=e.type_;if("TextInputNode"===t.$){var r=t.a;return M([OI(yD(r)),xk(GI.inputText)])}return M([Xx,_I(BR),xk(GI.inputMultiline),wD(n),OL(u),OI(f(QP,"margin",UD(xD(u)))),OI(f(QP,"box-sizing","content-box"))])}(),U(M([WD(r.text),OI(ED(r.onChange)),YL(r.label),GD(e.spellchecked),f(Kc,NR,f(xo,TD,e.autofill))]),a.input)),FI(vr)),c=function(){var t=e.type_;if("TextArea"===t.$)return d(Rk,KI,wR,U((i?Ra(sD):Fa)(M([UI(BR),f(fo,ND,n)?NR:xk(GI.focusedWithin),xk(GI.inputMultilineWrapper)])),a.parent),FI(M([d(Rk,iA,wR,f(Ra,UI(BR),f(Ra,_I(BR),f(Ra,xR(s),f(Ra,xk(GI.inputMultilineParent),a.wrapper)))),FI(function(){if(""===r.text){var e=r.placeholder;if("Nothing"===e.$)return M([ep(" ")]);var t=e.a;return M([l(KD,t,vr,""===r.text)])}return M([YD(f(vD,M([fA(GI.inputMultilineFiller)]),M([YB(r.text+" ")])))])}()))])));t.a;return d(Rk,KI,wR,f(Ra,UI(BR),f(Ra,f(fo,ND,n)?NR:xk(GI.focusedWithin),kb(M([a.parent,function(){var e=r.placeholder;if("Nothing"===e.$)return vr;var t=e.a;return M([U_(l(KD,t,a.cover,""===r.text))])}()])))),FI(M([s])))}();return l(zL,f(Ra,f(ox,ix,GI.cursorText),f(Ra,JL(r.label)?NR:px(5),f(Ra,tP,a.fullParent))),r.label,c)}),QD=JD({autofill:li,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),XD=i(function(e,t,r,n,a){var i=""===n?f(Ua,function(e){var t=e.a;e.b;return _(t,e.c)},r):f(_h,function(e){var t=e.a,r=e.b,a=e.c;return f(fo,Om(Zp(n)),f(Ua,Zp,r))?fi(_(t,a)):li},r);return l(cD,e,fi(f(IR,M([UI(BR),f(ax,9,15),OR(WR)]),f(fx,M([UI(BR),OR(l(Pk,.98,.98,.98)),f(ax,13,0),px(13),vx(4)]),M([f(XR,M([UI(PR(21))]),lD),f(QD,M([LL(0),UI(BR),OR(l(Pk,.98,.98,.98))]),{label:hD("search"),onChange:a,placeholder:fi(f(gD,M([Fk(fD)]),ep(t))),text:n})])))),i)}),ZD=function(e){return f(uP,iP,oP(e))},eU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,h(XD,M([UI(PR(300)),ZD(18),Ux]),"search cryptocurrencies",f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),M([e]),r(e))},K_),e,t))}),tU=M([to(no),ro(eo)]),rU=function(e){return d(XP,d(wL,0,0,0,.1),qP,km,l(cD,M([UI(PR(300)),ZD(10),Ux]),li,f(Ua,function(t){return _(f(fx,M([UI(BR),px(18)]),$T(M([Y_($y(t)),fi(ep(E_(t)))]))),e(t))},tU)))},nU=Na(q_),aU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,h(XD,M([UI(PR(300)),ZD(18),Ux]),"search currencies",f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),$T(M([fi(e),J_(e)])),r(e))},nU),e,t))}),iU=function(e){var t=e.mode;switch(t.$){case"OffRamp":return rU(f(Ma,HP,Up));case"CryptoSwap":if("Seller"===t.a.$){t.a;return rU(f(Ma,HP,Up))}t.a;return l(eU,e.inputs.currencySearch,jP,f(Ma,HP,Op));default:return l(aU,e.inputs.currencySearch,jP,f(Ma,HP,Op))}},oU=function(e){return fx(U(M([OR(P_),_I(PR(55)),vx(4),LL(1),xL(P_),px(1)]),e))},uU=n(function(e,t,r){return f(fx,M([OR(l(Pk,.98,.98,.98)),_I(BR),e_(13),px(13),ux,YP(r)]),M([f(Kc,_R,Y_(Ry(t))),ep(Ry(t)),f(XR,M([UI(PR(12))]),e?a_:n_)]))}),sU=a(function(e,t,r,n){return f(Fx,U(e,M([px(10)])),M([f(fx,M([px(20)]),M([f(IR,M([Ax(18),Tx,Fk(l(DR,1,31,52)),GL]),ep(t)),function(){if("Just"===r.$){var e=r.a;return f(IR,M([Ax(12),Fk(zR)]),ep(e))}return _R}()])),n]))}),cU={$:"Below"},fU=function(e){return f($R,cU,e)},lU=function(e){return d(sU,M([UI(BR)]),"I want to Sell",e.errors.amountIn,f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("amount in"),onChange:VP,placeholder:fi(f(gD,M([Fk(fD)]),ep("0"))),text:e.inputs.amountIn}),f(IR,U(M([_I(BR)]),e.showInTypeDropdown?M([fU(iU(e))]):vr),l(uU,e.showInTypeDropdown,e.inputs.inType,KP))])))},dU=function(e){return{$:"AmountOutChanged",a:e}},hU={$:"OutTypeClicked"},pU=function(e){return{$:"OutTypeSelected",a:e}},gU=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Seller"===t.a.$){t.a;return l(eU,e.inputs.currencySearch,jP,f(Ma,pU,Op))}t.a;return rU(f(Ma,pU,Up));case"OffRamp":return l(aU,e.inputs.currencySearch,jP,f(Ma,pU,Op));default:return rU(f(Ma,pU,Up))}},vU=function(e){return d(sU,M([UI(BR)]),"In Exchange for",e.errors.amountOut,f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("amount out"),onChange:dU,placeholder:fi(f(gD,M([Fk(fD)]),ep("0"))),text:e.inputs.amountOut}),f(IR,U(M([_I(BR)]),e.showOutTypeDropdown?M([fU(gU(e))]):vr),l(uU,e.showOutTypeDropdown,e.inputs.outType,hU))])))},yU={$:"MarginBoxClicked"},mU=function(e){return f(IR,M([Ax(20),Tx]),ep(f(SL,2,Xu(100*e))+"%"))},bU=function(e){return f(IR,M([Ux,_I(BR),OR(l(Pk,.98,.98,.98)),e_(13)]),f(XR,M([tx]),e?a_:n_))},CU=function(e){return d(Lk,e.red,e.green,e.blue,e.alpha)},EU=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},SU=r(function(e,t){var r=EU(t);return CU(D(r,{alpha:e}))}),TU=d(wL,1,0,0,.2),wU=a(function(e,t,r,n){return d(Lk,e/255,t/255,r/255,n)}),IU=function(e){var t=e?e>0?L("Profit",d(wU,0,188,137,.05),l(DR,0,188,137)):L("Loss",f(SU,.5,TU),TU):L("Even",d(wU,16,7,234,.05),l(DR,16,7,234)),r=t.a,n=t.b,a=t.c;return f(IR,M([e_(7)]),f(IR,M([f(ax,15,9),OR(n),vx(4),Fk(a),Ax(20),Tx]),ep(r)))},AU=n(function(e,t,r){return d(sU,e,t,li,r)}),BU=function(e){return l(AU,M([UI(BR)]),"Margin",f(oU,M([UI(BR),ux,YP(yU)]),M([f(fx,M([_I(BR),UI(BR),OR(WR),px(13)]),M([IU(e.margin),mU(e.margin)])),bU(e.showMarginModal)])))},kU=function(e){return{$:"MarginButtonClicked",a:e}},NU=function(e){return{$:"MarginInputChanged",a:e}},$U={$:"Profit"},RU=a(function(e,t,r,n){return f(IR,U(M([OR(e),vx(4),f(ax,22,16),Fk(t),Ax(20)]),function(){if("Just"===n.$){var e=n.a;return M([ux,Ex(e)])}return vr}()),ep(r))}),xU={$:"Above"},_U=function(e){return f($R,xU,e)},LU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,f(Fx,M([Ux,sP(10),vx(8),OR(P_),Xx,px(1),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0})]),M([f(IR,M([f(ax,23,18),OR(WR)]),f(Fx,M([UI(BR),px(10)]),M([f(IR,M([Ax(20),Tx,Fk(l(DR,16,7,234))]),ep("Margin")),f(_x,M([Ax(16),Fk(d(wL,0,0,0,.75))]),M([ep("This is how much you want to either make as a profit or loss from this trade. Trading at a loss can help to find a buyer fast, but it's possible to trade at a profit if your payment method is highly convenient to the other party.")]))]))),function(){var n=l(DR,10,33,108),a=d(wU,10,33,108,.04);return f(fx,M([UI(PI),OR(WR),f(ax,23,18),px(12)]),M([f(oU,M([UI(PR(140)),_U(function(){if("Just"===r.$){var e=r.a;return f(IR,M([Ax(12),Fk(zR),sP(16),GL,OR(WR),vP({bottom:0,left:1,right:1,top:0}),f(ax,5,0),xL(P_)]),ep(e))}return _R}())]),M([f(QD,M([LL(0),UI(BR),_I(BR)]),{label:hD("margin"),onChange:NU,placeholder:li,text:t+"%"})])),e<0?d(RU,TU,WR,"Loss",li):d(RU,a,n,"Loss",fi(kU(iy))),e?d(RU,a,n,"Even",fi(kU(Gp))):d(RU,l(DR,16,7,234),WR,"Even",li),e>0?d(RU,l(DR,0,188,137),WR,"Profit",li):d(RU,a,n,"Profit",fi(kU($U)))]))}()])))}),PU={$:"Bottom"},DU=ZR(PU),UU=function(e){return f(fx,M([UI(BR),px(25)]),U(M([f(IR,M([UI(Zx(2))]),vU(e))]),function(){return"CryptoSwap"===e.mode.$?M([f(IR,M([Ax(28),Fk(d(wL,.05,.1,.3,.25)),Tx,DU,OL({bottom:14,left:0,right:0,top:0})]),ep("@")),f(IR,M([UI(Zx(1)),_U(e.showMarginModal?l(LU,e.margin,e.inputs.margin,e.errors.margin):_R)]),BU(e))]):vr}()))},OU={$:"Expiry"},MU={$:"Judgment"},FU={$:"Payment"},VU=function(e){return{$:"IntervalInputChanged",a:e}},KU=function(e){return{$:"IntervalUnitChanged",a:e}},HU={$:"Minute"},jU={$:"Week"},qU=i(function(e,t,n,a,i){var o=function(){switch(e.$){case"Expiry":return _("Offer Expiry","This is how long your offer remains valid and visible in the marketplace. Note that you can manually recall the trade at any time, as long as no one has yet committed to it.");case"Payment":return _("Payment Due",function(){return"Buyer"===t.$?'Once a Seller commits, this is how long you to work with the Seller to complete the payment, and click "confirm payment". We recommend setting this to about 2X or 3X more than you expect you\'ll need!':'Once a Buyer commits, this is how long they have to work with you to complete the payment and click "confirm payment". We recommend setting this to about 2X or 3X more than you expect you\'ll need!'}());default:return _("Burn Window",function(){return"Buyer"===t.$?"Once you confirm payment, this is how long the Seller will have the option to burn the entire Dai/xDai balance (or manually release early). If the Seller makes no decision before this timer expires, the Dai/xDai balance is yours to claim.":"Once the Buyer confirms payment, this is how long you will have the option to burn the entire Dai/xDai balance (or manually release early). If you don't make a decision before this timer expires, the Buyer can then claim the Dai/xDai balance."}())}}(),u=o.a,s=o.b;return d(XP,d(wL,0,0,0,.1),qP,km,f(Fx,M([sP(10),vx(8),OR(P_),px(1),Xx,pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0}),$(e,MU)?Ux:GL]),M([f(IR,M([f(ax,23,18),OR(WR),UI(BR)]),f(Fx,M([UI(BR),px(10)]),M([f(IR,M([Ax(20),Tx,Fk(l(DR,16,7,234))]),ep(u)),f(_x,M([Ax(16),Fk(d(wL,0,0,0,.75))]),M([ep(s)]))]))),function(){var e=r(function(e,t){return d(RU,t?l(DR,16,7,234):d(wU,10,33,108,.04),t?WR:l(DR,10,33,108),Zp(_y(e)+"s"),t?li:fi(KU(e)))});return f(fx,M([f(ax,23,18),OR(WR),px(12)]),M([f(oU,M([UI(PR(140)),_U(function(){if("Just"===i.$){var e=i.a;return f(IR,M([Ax(12),Fk(zR),sP(16),GL,OR(WR),vP({bottom:0,left:1,right:1,top:0}),f(ax,5,0),xL(P_)]),ep(e))}return _R}())]),M([f(QD,M([LL(0),UI(BR),_I(BR)]),{label:hD(u+" input"),onChange:VU,placeholder:li,text:a})])),f(e,HU,$(n.unit,HU)),f(e,_p,$(n.unit,_p)),f(e,xp,$(n.unit,xp)),f(e,jU,$(n.unit,jU))]))}()])))}),GU=function(e){return{$:"WindowBoxClicked",a:e}},zU=function(e){return f(IR,M([Ax(20),o_]),ep(Ri(e.num)+" "+_y(e.unit)+(1===e.num?"":"s")))},WU=n(function(e,t,r){return l(AU,M([UI(BR)]),function(){switch(e.$){case"Expiry":return"Offer Expiry";case"Payment":return"Payment Due";default:return"Burn Window"}}(),f(oU,M([UI(BR),ux,YP(GU(e))]),M([f(IR,M([_I(BR),UI(BR),OR(WR),f(ax,15,17)]),zU(t)),bU(r)])))}),YU=r(function(e,t){var r=$(t.showIntervalModal,fi(e));return f(IR,M([UI(BR),_U(r?h(qU,e,ly(t.mode),f(xy,e,t),t.inputs.interval,t.errors.interval):_R)]),l(WU,e,f(xy,e,t),r))}),JU=function(e){return f(fx,M([UI(BR),px(23)]),M([f(YU,OU,e),f(YU,FU,e),f(YU,MU,e)]))},QU=function(e){return{$:"ReceiveAddressChanged",a:e}},XU=r(function(e,t){return l(AU,M([UI(BR)]),e+" Receive Address",f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("receive address"),onChange:QU,placeholder:li,text:t})])))}),ZU=function(e){return{$:"PaymentMethodChanged",a:e}},eO=r(function(e,t){return l(JD,{autofill:li,spellchecked:t.spellcheck,type_:SD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),tO=r(function(e,t){return l(AU,M([UI(BR)]),function(){return"Buyer"===e.$?"Making the Payment":"Accepting the Payment"}(),f(oU,M([_I(PR(134)),UI(BR)]),M([f(eO,M([UI(BR),_I(BR),LL(0),sD]),{label:hD("payment method"),onChange:ZU,placeholder:fi(f(gD,M([Fk(fD)]),f(Fx,M([px(5)]),function(){return M("Buyer"===e.$?[ep("Indicate here how you will send payment to the Seller. Some examples:"),ep('"I can send to any EU bank"'),ep('"I\'ll reveal a hidden cash drop within 10 km of Grand Central Station"'),ep('"Can send via ecocash"')]:[ep("Indicate here how you will send payment to the Buyer. Some examples:"),ep('"I have TransferWise"'),ep('"I can pick up a cash drop within 10 km of Grand Central Station"'),ep('"I can pick up a WorldRemit payment to Zimbabwe"')])}()))),spellcheck:!0,text:t})])))}),rO=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Seller"===t.a.$){var r=(t.a,e.inputs.outType);if("External"===r.$){var n=r.a;return f(XU,n,e.inputs.receiveAddress)}f(op,"Unexpected currency type for outType!",e.inputs.outType);return _R}t.a;return _R;case"OffRamp":return f(tO,yo,e.inputs.paymentMethod);default:return f(tO,vo,e.inputs.paymentMethod)}},nO=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Ethereum"}e.a;return"Kovan"}switch(e.a.$){case"Eth":e.a;return"Ethereum";case"Kovan":e.a;return"Kovan";default:e.a;return"xDai"}},aO=function(e){return{$:"CmdUp",a:e}},iO=n(function(e,t,r){return{$:"PlaceOrderClicked",a:e,b:t,c:r}}),oO=function(e){return f(xo,cm,f(xo,function(){return"Seller"===ly(e.mode).$?function(e){return e/1.01}:Fa}(),e.dhTokenAmount))},uO=function(e){return f(xo,yE(e.foreignCurrencyType),e.foreignCurrencyAmount)},sO=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Buyer"===t.a.$){t.a;return fi(M([f(CE,TE,"Provide your "+e.foreignCurrencyType+" address immediately upon commitment, via chat.")]))}t.a;return""===e.inputs.receiveAddress?li:fi(M([f(CE,TE,"Pay to "+e.inputs.receiveAddress+" immediately upon commitment.")]));case"OffRamp":default:return""===e.inputs.paymentMethod?li:fi(M([f(CE,TE,e.inputs.paymentMethod)]))}},cO=function(e){return Ho(e.num*function(){switch(e.unit.$){case"Minute":return 60;case"Hour":return 3600;case"Day":return 86400;default:return 604800}}()*1e3)},fO=function(e){return d(OS,n(function(t,r,n){return{autoabortInterval:cO(oo(e.intervals)),autorecallInterval:cO(io(e.intervals)),autoreleaseInterval:cO(uo(e.intervals)),initiatorRole:ly(e.mode),paymentMethods:n,price:r,tradeAmount:t}}),oO(e),uO(e),sO(e))},lO=function(e){var t=i(function(e,t,r,n,a){return f(IR,U(M([UI(BR),e_(17),vx(4),Ax(20),Tx,mP,OR(e),Fk(t),_U(function(){if("Just"===a.$){var e=a.a;return f(IR,M([Ax(12),Fk(zR),sP(16),$x]),ep(e))}return _R}())]),function(){if("Just"===n.$){var e=n.a;return M([ux,Ex(e)])}return vr}()),ep(r))}),r=Sm(e.wallet);if("Just"===r.$){var n=r.a;if($(jp(e.wallet),fi(e.dhTokenType))){var a=fO(e);if("Just"===a.$){var o=a.a;return h(t,l(DR,255,0,110),WR,"Review Terms and Place Order",fi(l(iO,e.dhTokenType,n,o)),li)}return h(t,P_,B_,"Review Terms and Place Order",li,li)}return f(_x,M([Ax(18),ML,Fk(l_),$x]),M([ep("You must switch your wallet to the "+nO(e.dhTokenType)+" network to create a trade with "+E_(e.dhTokenType)+".")]))}return h(t,zR,WR,"Connect to Wallet",fi(aO(ma)),li)},dO={$:"SwapClicked"},hO=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),pO=a(function(e,t,r,n){return d(hO,e,t,r,n)}),gO=function(e){return function(e){return d(pO,e.red,e.green,e.blue,e.alpha)}(EU(e))},vO=YD,yO=function(e){return{$:"Circle",a:e}},mO=yO,bO=d(hO,0,0,0,1),CO={$:"Flat"},EO={$:"Sharp"},SO=function(e){return{$:"Uniform",a:e}},TO=SO,wO={cap:CO,dashPattern:vr,dashPhase:0,fill:TO(bO),join:EO,thickness:2},IO=n(function(e,t,r){return D(wO,{dashPattern:e,fill:r,thickness:t})}),AO=IO(vr),BO={$:"Transparent"},kO=BO,NO=f(AO,0,kO),$O=r(function(e,t){return{$:"Shape",a:e,b:t}}),RO=function(e){return{basic:e,handlers:vr,name:li,opacity:1,rotation:0,scale:_(1,1),shift:_(0,0)}},xO=function(e){return f(Ma,RO,$O(e))},_O=function(e){return xO(_(e,NO))},LO=function(e){return _(-e.a,-e.b)},PO=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:_(a.a+r,a.b+n)})}),DO=r(function(e,t){return f(PO,LO(e(t)),t)}),UO=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return _(f(Ra,r,a),f(Ra,n,i))});return l(Da,t,_(vr,vr),e)},OO=r(function(e,t){return{$:"Path",a:e,b:t}}),MO=Ar,FO=Br,VO=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=FO(n),i=MO(n);return _(i*t-a*r,a*t+i*r)},i=r,o=i.a,u=i.b,s=function(e){var t=e.a,r=e.b;return _(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Ma,f(Ma,function(e){var t=e.a,r=e.b;return _(t+l,r+d)},s),a)},KO=function(e){return Ua(function(t){var r=t.a,n=t.b,a=e/2;return _(r<0?r-a:r+a,n<0?n-a:n+a)})},HO=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(KO,e,M([_(-i,-a),_(i,-a),_(i,a),_(-i,a)]))}),jO=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([_(-a,-r),_(n,-r),_(n,t),_(-a,t)])},qO=function(e){var t=GO(e.basic),r=UO(f(Ua,VO(e),t)),n=r.a,a=r.b;return{toBottom:-f(Kc,0,UB(a)),toLeft:-f(Kc,0,UB(n)),toRight:f(Kc,0,DB(n)),toTop:f(Kc,0,DB(a))}},GO=function(e){e:for(;;)switch(e.$){case"Shape":switch(e.b.$){case"Circle":var t=e.a,r=t.b.thickness,n=e.b.a,a=2*n;return f(HO,r,_(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(HO,r,_(2*u,2*s));case"Rectangle":var c=e.a,r=c.b.thickness,l=e.b,d=l.a,h=l.b;return f(HO,r,_(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(KO,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(OO,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(KO,$(C,CO)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(HO,0,E);case"Group":var S=e.a;return f(KO,0,kb(f(Ua,f(tu,qO,jO),S)));default:var T=e.b;return f(KO,0,jO(qO(T)))}},zO=function(e){var t=qO(e);return t.toTop+t.toBottom},WO=function(e){var t=qO(e);return _(-t.toLeft,t.toTop)},YO=function(e){var t=qO(e);return t.toLeft+t.toRight},JO=Sn("http://www.w3.org/2000/svg"),QO=JO("svg"),XO=$n("height"),ZO=$n("version"),eM=$n("width"),tM=JO("circle"),rM=JO("ellipse"),nM=JO("foreignObject"),aM=JO("g"),iM=JO("image"),oM=JO("polygon"),uM=JO("polyline"),sM=JO("rect"),cM=MA,fM=JO("text"),lM=$n("id"),dM=$n("points"),hM=$n("r"),pM=$n("rx"),gM=$n("ry"),vM=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",nt(e))},yM=function(e){return{$:"Group",a:e}},mM=$n("dominant-baseline"),bM=$n("fill"),CM=$n("fill-opacity"),EM=$n("font-family"),SM=$n("font-size"),TM=$n("font-style"),wM=$n("font-variant"),IM=$n("font-weight"),AM=$n("opacity"),BM=$n("stroke"),kM=$n("stroke-dasharray"),NM=$n("stroke-dashoffset"),$M=$n("stroke-linecap"),RM=$n("stroke-linejoin"),xM=$n("stroke-opacity"),_M=$n("stroke-width"),LM=$n("text-anchor"),PM=$n("text-decoration"),DM=$n("transform"),UM=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},OM=function(e){return f(xi," ",f(Ua,function(e){var t=e.a,r=e.b;return f(xi,",",M([Ri(t),Ri(r)]))},e))},MM=n(function(e,t,r){return d(hO,e,t,r,1)}),FM=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Yl(1e4*e)/100};return qy(M(["rgba(",uy(i(t)),"%,",uy(i(r)),"%,",uy(i(n)),"%,",uy(function(e){return Yl(1e3*e)/1e3}(a)),")"]))},VM=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},KM=function(e){var t=VM(e),r=t.red,n=t.green,a=t.blue;return FM(l(MM,r,n,a))},HM=function(e){if("Uniform"===e.$){var t=e.a;return KM(t)}return"none"},jM=function(e){var t=VM(e),r=t.alpha;return uy(r)},qM=function(e){if("Uniform"===e.$){var t=e.a;return jM(t)}return"0"},GM=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},zM=function(e){var t=uy(e.scale.b),r=uy(e.scale.a),n=uy(-e.rotation/2/nP*360),a=uy(-e.shift.b),i=uy(e.shift.a);return qy(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},WM=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([BM(HM(r.fill)),xM(qM(r.fill)),_M(uy(r.thickness)),$M(UM(r.cap)),RM(GM(r.join)),bM("none"),AM(uy(e.opacity)),DM(zM(e)),NM(Ri(r.dashPhase)),kM(OM(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([bM(HM(a)),CM(qM(a)),BM(HM(r.fill)),xM(qM(r.fill)),_M(uy(r.thickness)),$M(UM(r.cap)),RM(GM(r.join)),AM(uy(e.opacity)),DM(zM(e)),NM(Ri(r.dashPhase)),kM(OM(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([bM(HM(SO(o.color))),EM(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),SM(Ri(o.size)),IM(function(){switch(o.weight.$){case"Thin":return"200";case"Light":return"300";case"Regular":return"normal";case"Medium":return"500";case"SemiBold":return"600";case"Bold":return"bold";default:return"800"}}()),TM(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),wM(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),PM(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),LM("middle"),mM("middle"),DM(zM(e))]);default:return M([DM(zM(e))])}},YM=$n("x"),JM=$n("y"),QM=r(function(e,t){return M([eM(uy(e)),XO(uy(t)),YM(uy(-e/2)),JM(uy(-t/2))])}),XM=function(e){return f(xi," ",f(Ua,function(e){var t=e.a,r=e.b;return f(xi,",",M([uy(t),uy(-r)]))},e))},ZM=bx,eF=r(function(e,t){return f(e,t.a,t.b)}),tF=function(e){return f(Ua,eF(ZM),e)},rF=function(e){e:for(;;){var t=f(Kc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(uM,U(M([lM(t),dM(XM(i))]),U(WM(e),tF(e.handlers))),vr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(oM,U(M([lM(t),dM(XM(i))]),U(WM(e),tF(e.handlers))),vr);case"Circle":var c=s.a;return f(tM,U(M([lM(t),hM(uy(c))]),U(WM(e),tF(e.handlers))),vr);case"Ellipse":var d=s.a,h=s.b;return f(rM,U(M([lM(t),pM(uy(d)),gM(uy(h))]),U(WM(e),tF(e.handlers))),vr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(sM,U(M([lM(t),pM(uy(c)),gM(uy(c))]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),vr);default:var a=s.a,v=D(e,{basic:f(OO,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(fM,U(M([lM(t)]),U(WM(e),tF(e.handlers))),M([cM(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(iM,U(M([lM(t),vM(C)]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),vr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(nM,U(M([lM(t)]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),M([S]));case"Group":var T=n.a;return f(aM,f(Ra,lM(t),U(WM(e),tF(e.handlers))),l(_a,r(function(e,t){return f(Ra,rF(e),t)}),vr,T));default:var w=n.a,I=n.b,v=D(e,{basic:yM(M([w,I]))});e=v;continue e}}},nF=r(function(e,t){var r=e.a,n=e.b,a=uy(r),i=uy(n);return f(oA,vr,M([f(QO,M([eM(a),XO(i),ZO("1.1")]),M([rF(t)]))]))}),aF=function(e){return f(nF,_(YO(e),zO(e)),f(DO,WO,e))},iF=a(function(e,t,r,n){var a=vO(aF(f(_O,TO(gO(r)),mO(t/2))));return f(IR,U(M([xR(f(IR,M([$x,tx]),n))]),e),a)}),oF=FR({description:"swap",src:"/DAIHard/static/img/vertical-swap.svg"}),uF=d(iF,M([ux,Ex(dO)]),52,d(wL,.05,.03,.92,.05),f(XR,M([_I(PR(30))]),oF)),sF=function(e){return f(Fx,M([UI(BR),e_(20),px(25)]),M([lU(e),function(){return"CryptoSwap"===e.mode.$?f(IR,M([$x]),uF):_R}(),UU(e),rO(e),JU(e),lO(e)]))},cF=function(e){return{$:"ChangeMode",a:e}},fF=r(function(e,t){var r=function(){switch(t.$){case"CryptoSwap":return"Crypto Portal";case"OffRamp":return"Get Fiat";default:return"Get More Dai"}}(),n=e?1:.15;return f(IR,M([Ax(28),Tx,Fk(d(wL,0,0,0,n)),ux,Ex(cF(t))]),ep(r))}),lF=function(e){var t=function(){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return"Trade Dai/xDai for another crypto. Choose the amounts and types of crypto, and fill in your crypto receive address. Advanced users may wish to change the three trade windows."}e.a;return"Trade another crypto for Dai/xDai. Choose the amounts and types of crypto, and advanced users may wish to change the three trade windows.";case"OffRamp":return"Turn your Dai/xDai into any local currency. Choose your amounts and fiat type, describe how you can accept the fiat payment from a Buyer, and if necessary edit the three trade windows.";default:return"Deposit Dai/xDai to begin a fiat purchase to get 3X more Dai/xDai than your deposit. Choose your amounts and fiat type, describe how you can make the fiat payment to a Seller, and if necessary edit the three trade windows."}}();return f(Fx,M([UI(BR),px(20),e_(30)]),M([f(fx,M([px(40),$x]),M([f(fF,$(e,Dp(yo))||$(e,Dp(vo)),Dp(yo)),f(fF,$(e,Mp),Mp),f(fF,$(e,Fp),Fp)])),f(_x,M([Ax(16)]),M([ep(t)]))]))},dF=l(Pk,0,0,1),hF=r(function(e,t){var r=t.url,n=t.label;return d(Rk,KI,MI("a"),f(Ra,OI(NI(r)),f(Ra,OI($I("noopener noreferrer")),f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.link),e))))),FI(M([n])))}),pF=f(hF,M([vx(4),UI(BR),ux,f(ax,22,15),OR(dF),Fk(WR),Tx,Ax(20),$x,UI(PI),_I(PI)]),{label:f(_x,M([mP]),M([ep("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"}),gF=function(e){return f(yg,vg(e.tradeAmount),f(lg,e.tradeAmount,200))},vF=function(e){return{abortPunishment:e.abortPunishment,autoabortInterval:e.autoabortInterval,autorecallInterval:e.autorecallInterval,autoreleaseInterval:e.autoreleaseInterval,buyerDeposit:e.buyerDeposit,initiatorAddress:e.initiatorAddress,initiatorRole:e.initiatorRole,pokeReward:e.pokeReward,tradeAmount:e.tradeAmount}},yF=function(e){return"Buyer"===e.initiatorRole.$?yo:vo},mF=function(e){return"Buyer"===yF(vF(e)).$?e.buyerDeposit:e.tradeAmount},bF={$:"AbortCreate"},CF=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),EF=function(e){return Ri(e.num)+" "+_y(e.unit)+(1!==e.num?"s":"")},SF=Ls(xE(8226)),TF=FR({description:"close",src:"/DAIHard/static/img/remove-circle.svg"}),wF=function(e){return f(IR,M([e_(10),Ex(e),ux]),f(XR,M([UI(PR(22))]),TF))},IF=a(function(e,t,r,n){return d(XP,d(wL,0,0,.3,.6),r,n,f(IR,U(M([$x,tx,UI(f(OP,700,BR)),OR(WR),vx(8),xR(f(IR,M([Ux,AP]),wF(n)))]),e),t))}),AF=r(function(e,t){if("Nothing"===t.$)return _R;var r=t.a;return f(IR,U(M([vx(5),xL(zR),LL(1),OR(l(Pk,1,.4,.4)),e_(5),$x,tx,UI(f(OP,200,PI)),Ax(14)]),e),f(_x,vr,M([ep(r)])))}),BF=r(function(e,t){return f(IR,M([vx(4),f(ax,25,17),Ax(18),Tx,OR(P_),_U(f(AF,M([sP(5)]),t))]),ep(e))}),kF=gA(32),NF={$:"Active"},$F=function(e){return f(Ok,kF,f(tD,NF,oD(e)))},RF=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(IR,M([vx(4),ux,Ex(n),f(ax,25,17),Fk(t),Ax(18),Tx,OR(a),$F(M([OR(o)])),uD(M([OR(i)]))]),ep(r))}),xF=r(function(e,t){return d(RF,L(d(wL,1,0,0,1),d(wL,1,0,0,.8),d(wL,1,0,0,.6)),WR,e,t)}),_F=n(function(e,t,r){return d(XP,d(wL,0,0,.3,.6),t,r,f(Fx,M([px(10),$x,tx,OR(d(wL,0,0,0,.5)),vx(8),e_(20)]),f(Ua,function(e){return f(_x,M([$x,tx,Ax(20),Tx,Fk(WR),mP]),M([e]))},e)))}),LF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+Jk(t)}e.a;return"https://kovan.etherscan.io/tx/"+Jk(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+Jk(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+Jk(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+Jk(t)}}),PF=xk(GI.underline),DF=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=f(IR,M([ux,Ex(bF),f(ax,25,17),Fk(WR),Ax(18),Tx]),ep("I'm not ready yet. Go back.")),i=f(Ma,IR(M([Lx,Fk(B_)])),ep),o=i(EF(f(xy,OU,t))),u=i(EF(f(xy,MU,t))),s=i(EF(f(xy,FU,t))),c=f(Ma,IR(M([Tx,Fk(dF)])),ep),h=c(BL(n.buyerDeposit)+" "+E_(r)),p=c(BL(gF(n))+" "+E_(r)),g=c(TL(n.price)),v=c(BL(f(yg,n.tradeAmount,n.buyerDeposit))+" "+E_(r)),y=c(BL(n.tradeAmount)+" "+E_(r)),m=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a,i=BL(f(yg,gF(n),f(yg,a,mF(n))))+" "+E_(r),o=BL(a)+" "+E_(r);return L(c(o),c(i),f(xF,"Understood. Deposit "+o+" and open this trade.",l(CF,r,n,a)))}return L(c("??"),c("??"),f(BF,"(loading exact fees...)",li))}(),b=m.a,C=m.b,E=m.c;return d(IF,M([UI(PR(1200))]),f(fx,M([UI(BR)]),M([f(Fx,M([e_(90),_I(BR),OR(l(DR,10,33,108))]),M([f(Fx,M([UI(BR),px(18),Fk(WR)]),M([f(IR,M([Ax(38),Tx]),ep("Are you Ready?")),f(_x,M([Ax(16),o_]),M([ep("DAIHard is different than other exchanges. If this is your first trade here, carefully read the details to the right before proceeding with opening this trade.")])),f(_x,M([Ax(16),o_]),M([ep("You can't edit a trade once it's live (but you can abort and re-deploy, as described in point 2).")]))])),f(Fx,M([$x,px(15),DU]),M([f(IR,M([$x]),E),f(IR,M([$x]),a)]))])),f(Fx,M([px(23),e_(40),UI(BR)]),f(Ua,function(e){return f(fx,M([UI(BR),_I(BR),LL(2),xL(P_),e_(16),px(20)]),M([f(IR,M([Ax(40),tx]),ep(SF)),f(_x,M([Ax(16)]),e)]))},function(){return"Buyer"===n.initiatorRole.$?U(M([M([ep("To open this offer, you must deposit "),b,ep(". Your offer to buy "),y,ep(" for "),g,ep(" will then be listed on the marketplace.")]),M([ep("You can abort the offer any time before a Seller commits for a full refund. If no Seller commits within "),o,ep(" your offer will automatically expire. In both these cases, the full "),b,ep(" is returned to you.")]),M([ep("A Seller can commit to the trade by depositing the full "),y,ep(" into the contract, and is expected to immediately post his "),c(n.price.symbol),ep(" address in the DAIHard chat.")]),function(){return M("CryptoSwap"===t.mode.$?[ep("You will then have "),s,ep(" to send "),g,ep(' to that address and click "Confirm Payment".')]:[ep("You are then expected to send "),g,ep(' and click "Confirm Payment" within '),s,ep(".")])}(),M([ep("Once you've confirmed payment, for "),u,ep(", the Seller has the option of burning the trade's full balance of "),C,ep(". He is expected to do this if and only if you failed to send the "),g,ep(" to the address he posted.")]),M([ep("If the Seller has not burned the "),ep(E_(r)),ep(" within the "),u,ep(", "),v,ep(" is yours to claim and we take a 1% fee ("),p,ep(").")])]),function(){return"Token"===r.$?M([M([ep("(Trade creation ususally requires two Metamask signatures. Your "+E_(r)+" will not be deposited until the final transaction has been mined.)")])]):vr}()):U(M([M([ep("Of your "),b,ep(", ~1% ("),p,ep(") will be set aside, and the remaining "),y,ep(" will be listed as selling for "),g,ep(".")]),M([ep("You can abort the offer at any time before a Buyer commits, and if no Buyer commits within "),o,ep(" your offer will automatically expire. In both these cases, the full "),b,ep(" is returned to you.")])]),U(function(){return M("CryptoSwap"===t.mode.$?[M([ep("A Buyer must deposit "),h,ep(" into this contract to commit. He is then expected to send the "),g,ep(" to your receive address "),c(t.inputs.receiveAddress),ep(", and mark the payment as complete, all within "),s,ep(".")]),M([i("Make sure the above address is correct! DAIHard does not do refunds!")])]:[M([ep("A Buyer must deposit "),h,ep(" into this contract to commit. He is then expected to pay the "),g,ep(" to you, via the method you've descried in your "),i("Payment Methods"),ep(", and mark the payment as complete, all within "),s,ep(".")])])}(),U(M([M([ep("When the Buyer marks the payment complete, for "),u,ep(" you will have the option to burn the trade's balance of "),C,ep(", which you are expected to do if and only if the Buyer has not sent the payment.")]),M([ep("If the trade has resolved successfully, DAIHard takes the 1% fee of "),p,ep(" set aside earlier.")])]),function(){return"Token"===r.$?M([M([ep("(Trade creation ususally requires two Metamask signatures. Your "+E_(r)+" will not be deposited until the final transaction has been mined.)")])]):vr}())))}()))])),qP,bF);case"ApproveNeedsSig":var S=e.a;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),l(_F,M([ep("Waiting for user signature for the approve call."),ep("(check Metamask!)"),ep("Note that there will be a second transaction to sign after this.")]),qP,qP));case"ApproveMining":var S=e.a,n=e.b,T=e.c;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","ApproveMining",0)))]),l(_F,M([ep("Mining the initial approve transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,ro(S),T)}),ep("Funds will not leave your wallet until you sign the next transaction.")]),qP,qP));case"CreateNeedsSig":return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),l(_F,M([ep("Waiting for user signature for the create call."),ep("(check Metamask!)")]),qP,qP));default:var r=e.a,T=e.b;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","CreateMining",0)))]),l(_F,M([ep("Mining the final create call..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,r,T)}),ep("You will be redirected when it's mined.")]),qP,qP))}}),UF=function(e){var t=e.txChainStatus;if("Just"===t.$){var r=t.a;return M([f(DF,r,e)])}return vr},OF=f(IR,M([_I(PR(1)),UI(BR),OR(d(wL,0,0,0,.2))]),_R),MF=function(e){return _(f(Fx,M([UI(BR),OL({bottom:40,left:0,right:0,top:0})]),M([f(MP,800,f(Fx,M([UI(BR),px(20)]),M([lF(e.mode),OF,sF(e)]))),pF])),UF(e))},FF=r(function(e,t){return f(Wb,f(tu,function(e){return e.type_},Za(e)),t)}),VF=r(function(e,t){return pp(t(e))}),KF=i(function(e,t,r,n,a){var i=l(VF,e,a.filterFunc,kb(f(Ua,qx,n)));return $(i,vr)?f(IR,M([$x,Ax(24),OL({bottom:0,left:0,right:0,top:30}),ML]),ep(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Ji,Qm,h(DL,e,a.tradeTable,a.prices,M([t?zm:Mo,zx,Yx,Jx,Wx,Gx]),i))}),HF=function(e){return{$:"FiltersMsg",a:e}},jF={$:"ApplyInputs"},qF=jD("disabled"),GF=function(e){return f(fo,ND,e)?NR:xk("focusable")},zF=function(e){return{$:"MayPreventDefault",a:e}},WF=r(function(e,t){return f(mx,e,zF(t))}),YF=r(function(e,t){var r=function(r){return $(r,e)?Ki(t):Eu("Not the enter key")},n=f(Cu,r,f(hl,"key",Su));return OI(f(WF,"keyup",f(Fi,function(e){return _(e,!0)},n)))}),JF=function(e){return f(YF,"Enter",e)},QF={$:"Button"},XF=r(function(e,t){var r=t.onPress,n=t.label;return d(Rk,KI,wR,f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.seButton+" "+GI.noTextSelection),f(Ra,ux,f(Ra,GF(e),f(Ra,Rx(QF),f(Ra,OI(XL(0)),function(){if("Nothing"===r.$)return f(Ra,OI(qF(!0)),e);var t=r.a;return f(Ra,Ex(t),f(Ra,JF(t),e))}()))))))),FI(M([n])))}),ZF=f(XF,M([OR(dF),e_(10),vx(5)]),{label:f(IR,M([Fk(WR),$x,tx]),ep("Apply")),onPress:fi(jF)}),eV=function(e){return f(XR,f(Ra,_I(PR(26)),e),G_)},tV=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(Ok,gx,l(fk,"br-"+Ri(t)+"-"+Ri(r)+Ri(n)+"-"+Ri(a),"border-radius",Ri(t)+"px "+Ri(r)+"px "+Ri(a)+"px "+Ri(n)+"px"))},rV=function(e){return f(bx,"focus",Ki(e))},nV=f(Ma,OI,rV),aV=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return vr;var e=o.a;return M([nV(e(!0)),YP(e(!0))])}();return f(fx,U(e,M([_I(PR(40)),pP({blur:20,color:d(wU,233,237,242,.05),offset:_(0,3),size:0})])),M([f(IR,M([OR(P_),_I(PR(40)),tV({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(IR,M([tx,f(ax,10,0)]),r)),f(QD,U(s,U(t,M([UI(PR(100)),_I(PR(40)),xL(P_),tV({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),vP({bottom:1,left:0,right:1,top:1})]))),{label:hD(n),onChange:u,placeholder:i,text:a})]))}),iV=function(e){return{$:"MaxDaiChanged",a:e}},oV=function(e){return{$:"MinDaiChanged",a:e}},uV=r(function(e,t){return f(Fx,M([UI(BR),px(8)]),M([f(IR,M([Ax(17),o_]),ep(e)),t]))}),sV=gA(25),cV=function(e){return{$:"MoveX",a:e}},fV=function(e){return f(uP,sV,cV(-e))},lV={$:"OnLeft"},dV=function(e){return f($R,lV,e)},hV=n(function(e,t,r){var n=eV(M([tx])),a=f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("max"))])),i=f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("min"))]));return f(uV,"Dai Range",f(Fx,M([px(5),UI(PR(200))]),M([v(aV,M([dV(f(AF,M([fV(5),UI(PR(200))]),r.minDai))]),M([nV(ib(!1))]),i,"min Dai",e,li,li,oV),v(aV,M([dV(f(AF,M([fV(5),UI(PR(200))]),r.maxDai))]),M([nV(ib(!1))]),a,"max Dai",t,li,li,iV)])))}),pV=function(e){return{$:"FiatTypeInputChanged",a:e}},gV=function(e){return{$:"FiatTypeSelected",a:e}},vV=n(function(e,t,r){return f(fx,M([OR(l(Pk,.98,.98,.98)),_I(BR),e_(13),px(13),ux,YP(r),LL(1),xL(P_)]),M([f(Kc,_R,Y_(t)),ep(function(e){return""===e?"[any]":e}(t)),f(XR,M([UI(PR(12))]),e?a_:n_)]))}),yV=WP(f(QP,"z-index","1000")),mV={$:"NoOp"},bV=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),mV,ib(!1),function(){var n=U(nU,K_);return h(XD,M([UI(PR(300)),ZD(18),Ux,yV]),"search currencies",U(M([L(f(IR,M([UI(BR)]),ep("[any]")),vr,r(""))]),U(f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),$T(M([fi(e),J_(e)])),r(e))},n),f(lo,e,n)?vr:M([L(f(IR,M([UI(BR)]),ep('"'+e+'"')),M([e]),r(e))]))),e,t)}())}),CV=n(function(e,t,r){var n=f(Kc,_R,Y_(t));f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("max"))])),f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("min"))]));return f(IR,M([AP,UI(PR(120)),fU(e?l(bV,t,pV,gV):_R)]),f(uV,"Currency Type",l(vV,e,t,ib(!0))))}),EV={$:"AddSearchTerm"},SV=function(e){return{$:"PaymentMethodInputChanged",a:e}},TV=f(hl,"keyCode",xT),wV=function(e){return f(bx,"keyup",f(Cu,function(t){return 13===t?Ki(e):Eu(Ri(t))},TV))},IV=function(e){return f(uV,"Search Payment Methods",f(QD,M([AP,UI(PR(250)),_I(PR(40)),xL(P_),pP({blur:20,color:d(wU,233,237,242,.05),offset:_(0,3),size:0}),WP(wV(EV))]),{label:hD("payment methods search"),onChange:SV,placeholder:li,text:e}))},AV={$:"ResetSearch"},BV=f(XF,M([OR(dF),e_(10),vx(5)]),{label:f(IR,M([Fk(WR),$x,tx]),ep("Reset")),onPress:fi(AV)}),kV=function(e){return{$:"RemoveTerm",a:e}},NV=function(e){return f(IR,M([e_(3),AP,ux,Ex(kV(e)),Ax(10),Fk(zR)]),ep("x"))},$V=function(e){if(e.b){var t=e;return f(fx,M([UI(BR),e_(10),px(10)]),f(Ua,function(e){return f(fx,M([OR(d(wU,16,7,234,.2)),vx(5),e_(4),px(3)]),M([ep(e),NV(e)]))},t))}return _R},RV=i(function(e,t,r,n,a){var i=function(e){return f(IR,M([Ax(20),Tx,Fk(l_),$x]),ep(e))},o=f(Bg,Za(NP),f(Ua,_P,e))?M([i("No trades found.")]):f(Ua,i,$T(f(Ua,function(e){switch(_P(e).$){case"QueryingNumTrades":return fi("Querying "+WN(e.factory)+" Factory...");case"NoneFound":return li;case"FetchingTrades":return fi("Fetching "+WN(e.factory)+" Trades...");default:return li}},e)));return f(IR,M([UI(BR),xR(f(Fx,M([px(5),GL]),o))]),f(fx,M([$x,px(50)]),M([f(Ji,HF,kP(t)),f(fx,M([UI(PI),px(10)]),M([f(IR,M([UI(PI),AP]),l(hV,r.minDai,r.maxDai,n)),f(IR,M([UI(PI),AP]),l(CV,a,r.fiatType,n)),f(Fx,M([UI(PI),AP,px(5)]),M([IV(r.paymentMethod),$V(r.paymentMethodTerms)])),f(uV," ",f(Fx,M([px(5),UI(PI)]),M([ZF,BV])))]))])))}),xV=n(function(e,t,r){var n=f(Bg,f(tu,_P,Za($P)),t),a=function(){return!f(Kc,0,f(xo,function(e){return f(Yw,function(e){return e.checked&&"Open"!==e.label},e.options)},f(FF,Ao,r.filters)))}();return _(f(MP,1800,f(Fx,M([UI(BR),_I(BR),e_(30)]),M([f(fx,M([UI(BR),px(10)]),M([h(RV,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(KF,e,a,n,t,r)]))),vr)}),_V=l(Pk,.95,.98,1),LV=a(function(e,t,r,n){return f(Fx,M([OL({bottom:40,left:0,right:0,top:60}),px(60),UI(BR)]),M([f(Kc,_R,f(xo,f(Ma,IR(M([Fk(WR),Ax(38),$x])),ep),t)),f(Fx,M([OR(_V),px(20),vx(8),Xx,$x,UI(f(OP,e,BR)),pP({blur:3,color:d(wL,0,0,0,.2),offset:_(0,0),size:1})]),M([f(IR,M([UI(BR),e_(15),OR(WR),pP({blur:30,color:d(wL,0,0,0,.15),offset:_(0,0),size:0})]),f(IR,M([Ax(16),Fk(zR),Lx,$x]),ep(r))),n]))]))}),PV=pP({blur:20,color:d(wU,0,0,0,.04),offset:_(0,3),size:0}),DV=function(e){return{$:"MessageInputChanged",a:e}},UV={$:"MessageSubmit"},OV=function(e){return f(Fx,M([UI(BR),px(10)]),M([f(eO,M([UI(BR),_I(PR(100))]),{label:hD("messageInput"),onChange:DV,placeholder:li,spellcheck:!1,text:e.messageInput}),f(XF,M([$x,Ax(24)]),{label:ep("Submit"),onPress:fi(UV)})]))},MV=r(function(e,t){return f(IR,M([_I(BR),UI(BR)]),f(IR,U(M([WP(f(QP,"position","absolute")),WP(f(QP,"top","0")),WP(f(QP,"right","0")),WP(f(QP,"bottom","0")),WP(f(QP,"left","0")),sD]),e),t))}),FV=l(DR,200,205,210),VV=n(function(e,t,r){var n=M([Ux,OR(dF),Fk(WR),tV({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([GL,OR(FV),Fk(B_),tV({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=$(o.who,t)?n:a;return f(IR,U(M([e_(7)]),u),f(_x,vr,M([ep(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return fi(L(l(Pk,0,0,1),WR,"Initiator opened the trade"));case"Recalled":return fi(L(l(Pk,0,0,1),WR,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(fu,8,sp(t))+"..";return fi(L(l(Pk,1,0,1),WR,r+" committed to the trade"));case"Aborted":return fi(L(l(Pk,1,0,0),WR,"Buyer aborted the trade"));case"Claimed":return fi(L(l(Pk,0,1,0),WR,"Buyer marked the external payment complete"));case"Released":return fi(L(l(Pk,0,0,1),WR,"Seller released the "+E_(e)+" and closed the contract"));default:return fi(L(l(Pk,0,0,1),WR,"Seller burned the "+E_(e)+" and closed the contract"))}}();if("Nothing"===c.$)return _R;var d=c.a,h=d.a,p=d.b,g=d.c;return f(IR,M([vx(3),LL(1),xL(l(Pk,1,0,1)),$x,OR(h)]),f(_x,M([Fk(p)]),M([ep(g)])))}),KV=n(function(e,t,r){if(r.b){var n=r;return f(MV,M([UI(BR),_I(BR),vx(5),LL(1),xL(B_),e_(10)]),f(Fx,M([UI(BR),_I(BR),px(10)]),f(Ua,f(VV,e,t),n)))}return f(IR,M([UI(BR),_I(BR),vx(5),LL(1),xL(B_),$x,Fk(l(Pk,.5,.5,.5)),ML]),ep("no messages found."))}),HV=br,jV=function(e){return f(Fx,M([UI(BR),_I(BR),px(10),LL(1),vx(5),e_(20)]),M([l(KV,e.trade.factory,e.userRole,f(HV,function(e){return e.blocknum},Ia(e.history))),OV(e)]))},qV=function(e){return f(IR,M([OR(WR),vx(8),PV,UI(BR),_I(BR)]),jV(e))},GV={$:"NoOp"},zV={$:"ToggleChat"},WV=function(e){if(e.showChatHistory){var t=f(Kc,_R,f(xo,qV,e.chatHistoryModel));return f(IR,M([_I(BR),UI(PR(500)),e_(20),Ux]),d(IF,M([_I(BR),UI(BR)]),f(Ji,rw,t),GV,zV))}return _R},YV=d(wU,1,31,52,.8),JV={$:"AbortAction"},QV=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),XV=function(e){var t=_(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return _R}if("LoadedTrade"!==t.b.$)return _R;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=TL(n.terms.price),u=BL(Yy(i)),s=BL(n.parameters.tradeAmount)+" "+E_(n.factory),c=function(){return"Buyer"===yF(n.parameters).$?_(f(IR,M([o_,Fk(B_)]),ep("buyer")),M([ep("pay the seller "),f(IR,M([Fk(dF)]),ep(o)),ep(" in exchange for the "),f(IR,M([Fk(dF)]),ep(s)),ep(" held in this contract.")])):_(f(IR,M([o_,Fk(B_)]),ep("seller")),M([ep("accept "),f(IR,M([Fk(dF)]),ep(o)),ep(" from the buyer in exchange for the "),f(IR,M([Fk(dF)]),ep(s)),ep(" held in this contract.")]))}(),h=c.a,p=c.b;return d(IF,vr,f(Fx,M([px(20),e_(20),$x,_I(BR),mP]),M([f(IR,M([Ax(26),Tx,$x,tx]),ep("Just to Confirm...")),f(Fx,M([px(20),$x,tx]),f(Ua,_x(M([$x,Ax(18),o_,Fk(YV)])),U(M([U(M([ep("You will deposit "),f(IR,M([Fk(dF)]),ep(u+" "+E_(n.factory))),ep(", thereby becoming the "),h,ep(" of this trade. By doing so, you are agreeing to ")]),p)]),function(){return"Token"===n.factory.$?M([M([ep("(This ususally requires two Metamask signatures. Your "+E_(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):vr}()))),f(IR,M([DU,$x]),f(xF,"Yes, I definitely want to commit to this trade.",l(QV,n,a,i)))])),GV,JV);case"ApproveNeedsSig":return l(_F,M([ep("Waiting for user signature for the approve call."),ep("(check Metamask!)"),ep("Note that there will be a second transaction to sign after this.")]),GV,GV);case"ApproveMining":var g=r.a;return l(_F,M([ep("Mining the initial approve transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,n.factory,g)}),ep("Funds will not leave your wallet until you sign the next transaction.")]),GV,GV);case"CommitNeedsSig":return l(_F,M([ep("Waiting for user signature for the final commit call."),ep("(check Metamask!)"),ep("This will make the deposit and commit you to the trade.")]),GV,GV);case"CommitMining":var g=r.a;return l(_F,M([ep("Mining the final commit transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction"),url:f(LF,n.factory,g)})]),GV,GV);case"ConfirmingAction":var v=r.a;return d(IF,vr,f(Fx,M([px(20),e_(20),$x,_I(BR),mP]),M([f(IR,M([Ax(26),Tx,$x,tx]),ep("Just to Confirm...")),f(Fx,M([px(20),$x,tx]),f(Ua,_x(M([$x,Ax(18),o_,Fk(YV)])),function(){switch(v.$){case"Poke":case"Recall":return vr;case"Claim":return M([M([ep('By clicking "Confirm Payment", you are claiming that you\'ve paid the Seller in a way they can verify. Only do this if you are sure the Seller will agree that they have the money--otherwise they may burn the '+E_(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([ep("Aborting will incur a small penalty on both parties, and refund the rest of the "+E_(n.factory)+".")])]);case"Release":return M([M([ep("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([ep("This will destroy the "+E_(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(IR,M([DU,$x]),function(e){return f(xF,e,Cw(v))}(function(){switch(v.$){case"Poke":return"Poke";case"Recall":return"Recall";case"Claim":return"I understand. Confirm Payment";case"Abort":return"I understand. Abort the trade.";case"Release":return"I understand. Release the "+E_(n.factory)+".";default:return"I understand. Burn the "+E_(n.factory)+"."}}()))])),GV,JV);case"ActionNeedsSig":var v=r.a;return l(_F,M([ep("Waiting for user signature for the "+Sw(v)+" call."),ep("(check Metamask!)")]),GV,GV);default:var v=r.a,g=r.b;return _R}},ZV=r(function(e,t){return f(Fx,M([px(10)]),M([f(IR,M([Ax(17),Tx]),ep(e)),t]))}),eK=function(e){return f(fx,M([px(8)]),M([f(XR,vr,G_),f(IR,M([Ax(24),o_]),ep(BL(e)))]))},tK=r(function(e,t){var r=f($o,Ro(e),f(xo,function(e){return e.address},Sm(t)));return f(ZV,function(){var t=_(e.parameters.initiatorRole,r);if("Buyer"===t.a.$){if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Buying"}t.a;return"Buying"}if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Selling"}t.a;return"Selling"}(),eK(e.parameters.tradeAmount))}),rK=function(e){return f(fx,M([px(5)]),M([f(Kc,_R,Y_(e.symbol)),f(IR,M([Ax(24),o_]),ep(TL(e)))]))},nK=function(e){return f(ZV,"For",rK(e.terms.price))},aK=l(DR,250,165,22),iK=l(DR,0,255,0),oK=FR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),uK=FR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),sK=FR({description:"released",src:"/DAIHard/static/img/released.svg"}),cK={$:"ToggleStatsModal"},fK=function(e){return f(HV,Fa,e)},lK=n(function(e,t,n){var a=kb(f(Ua,function(e){return f(pp,function(e){return $(f(_o,e,n),fi(t))},f(_h,function(e){if("LoadedTrade"===e.$){var t=e.a;return fi(t)}return li},Ia(e.trades)))},e)),i=Ii(a),o=l(_a,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(yg,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(yg,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:pg,amountReleased:pg,numAborts:0,numBurns:0,numReleases:0},a),u=f(xo,Ho,ov(fK(f(_h,function(e){return function(e){return e?fi(e):li}(il(e.phaseStartInfo.committedTime))},a))));return{amountBurned:o.amountBurned,amountReleased:o.amountReleased,asRole:t,firstTrade:u,numAborts:o.numAborts,numBurns:o.numBurns,numReleases:o.numReleases,numTrades:i}}),dK=r(function(e,t){return d(RF,L(d(wL,0,0,1,1),d(wL,0,0,1,.8),d(wL,0,0,1,.6)),WR,e,t)}),hK=function(e){return{$:"ViewUserHistory",a:e}},pK=f(N$,0,vr),gK=f(ox,Qx,GI.clipX),vK=f(ox,Qx,GI.clipY),yK=f(ox,Sx,GI.textNormalWeight),mK=r(function(e,t){return ri(e/t)}),bK=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(x(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),CK=r(function(e,t){var r=e.a,n=e.b;return l(bK,r,f(mK,il(t),6e4),n)}),EK=r(function(e,t){return f(Fs,24,f(mK,f(CK,e,t),60))}),SK=r(function(e,t){return f(Fs,1e3,il(t))}),TK=r(function(e,t){return f(Fs,60,f(CK,e,t))}),wK={$:"Apr"},IK={$:"Aug"},AK={$:"Dec"},BK={$:"Feb"},kK={$:"Jan"},NK={$:"Jul"},$K={$:"Jun"},RK={$:"Mar"},xK={$:"May"},_K={$:"Nov"},LK={$:"Oct"},PK={$:"Sep"},DK=function(e){var t=f(mK,e,1440)+719468,r=(t>=0?t:t-146096)/146097|0,n=t-146097*r,a=(n-(n/1460|0)+(n/36524|0)-(n/146096|0))/365|0,i=n-(365*a+(a/4|0)-(a/100|0)),o=(5*i+2)/153|0,u=o+(o<10?3:-9);return{day:i-((153*o+2)/5|0)+1,month:u,year:a+400*r+(u<=2?1:0)}},UK=r(function(e,t){switch(DK(f(CK,e,t)).month){case 1:return kK;case 2:return BK;case 3:return RK;case 4:return wK;case 5:return xK;case 6:return $K;case 7:return NK;case 8:return IK;case 9:return PK;case 10:return LK;case 11:return _K;default:return AK}}),OK=r(function(e,t){return f(Fs,60,f(mK,il(t),1e3))}),MK={$:"Fri"},FK={$:"Mon"},VK={$:"Sat"},KK={$:"Sun"},HK={$:"Thu"},jK={$:"Tue"},qK={$:"Wed"},GK=r(function(e,t){switch(f(Fs,7,f(mK,f(CK,e,t),1440))){case 0:return HK;case 1:return MK;case 2:return VK;case 3:return KK;case 4:return FK;case 5:return jK;default:return qK}}),zK=n(function(e,t,r){return e.toAmPm(f(EK,t,r))}),WK=r(function(e,t){return DK(f(CK,e,t)).day}),YK=WK,JK=M([KK,FK,jK,qK,HK,MK,VK]),QK=r(function(e,t){return function(e){return e.a}(f(Kc,_(0,KK),ov(f(pp,function(r){return $(r.b,f(GK,e,t))},f(Ni,r(function(e,t){return _(e,t)}),JK)))))}),XK=function(e){return l(_a,xa,0,e)},ZK=r(function(e,t){return DK(f(CK,e,t)).year}),eH=function(e){return!f(Fs,4,e)&&(!!f(Fs,100,e)||!f(Fs,400,e))},tH=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return eH(e)?29:28;case"Mar":return 31;case"Apr":return 30;case"May":return 31;case"Jun":return 30;case"Jul":case"Aug":return 31;case"Sep":return 30;case"Oct":return 31;case"Nov":return 30;default:return 31}}),rH=M([kK,BK,RK,wK,xK,$K,NK,IK,PK,LK,_K,AK]),nH=r(function(e,t){return f(Kc,_(0,kK),ov(f(pp,function(r){r.a;return $(r.b,f(UK,e,t))},f(Ni,r(function(e,t){return _(e,t)}),rH))))}),aH=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(nH,e,t))}),iH=r(function(e,t){var r=f(bc,f(aH,e,t)-1,rH);return XK(f(Ua,tH(f(ZK,e,t)),r))+f(YK,e,t)}),oH=r(function(e,t){return f(aH,e,t)/4|0}),uH=r(function(e,t){var r=Ri(t),n=e-iu(r);return U(f(xi,"",f(Ua,function(e){return"0"},f(ki,1,n))),r)}),sH=function(e){return e?e<=12?e:e-12:12},cH=Yl(315576e5),fH=r(function(e,t){return Ho(cH*f(ZK,e,t))}),lH=r(function(e,t){var r=f(fH,e,t),n=f(QK,e,r);return 1+((f(iH,e,t)+n)/7|0)}),dH=r(function(e,t){return Ri(f(ZK,e,t))}),hH=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ri(f(aH,t,r));case"MonthSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(aH,t,r));case"MonthFixed":return f(uH,2,f(aH,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(UK,t,r));case"MonthNameFull":return e.toMonthName(f(UK,t,r));case"QuarterNumber":return Ri(1+f(oH,t,r));case"QuarterSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(1+f(oH,t,r));case"DayOfMonthNumber":return Ri(f(YK,t,r));case"DayOfMonthSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(YK,t,r));case"DayOfMonthFixed":return f(uH,2,f(YK,t,r));case"DayOfYearNumber":return Ri(f(iH,t,r));case"DayOfYearSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(iH,t,r));case"DayOfYearFixed":return f(uH,3,f(iH,t,r));case"DayOfWeekNumber":return Ri(f(QK,t,r));case"DayOfWeekSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(QK,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(GK,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(GK,t,r));case"WeekOfYearNumber":return Ri(f(lH,t,r));case"WeekOfYearSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(lH,t,r));case"WeekOfYearFixed":return f(uH,2,f(lH,t,r));case"YearNumberLastTwo":return f(pu,2,f(dH,t,r));case"YearNumber":return f(dH,t,r);case"AmPmUppercase":return nb(l(zK,e,t,r));case"AmPmLowercase":return Zp(l(zK,e,t,r));case"HourMilitaryNumber":return Ri(f(EK,t,r));case"HourMilitaryFixed":return f(uH,2,f(EK,t,r));case"HourNumber":return Ri(sH(f(EK,t,r)));case"HourFixed":return f(uH,2,sH(f(EK,t,r)));case"HourMilitaryFromOneNumber":return Ri(1+f(EK,t,r));case"HourMilitaryFromOneFixed":return f(uH,2,1+f(EK,t,r));case"MinuteNumber":return Ri(f(TK,t,r));case"MinuteFixed":return f(uH,2,f(TK,t,r));case"SecondNumber":return Ri(f(OK,t,r));case"SecondFixed":return f(uH,2,f(OK,t,r));case"MillisecondNumber":return Ri(f(SK,t,r));case"MillisecondFixed":return f(uH,3,f(SK,t,r));default:return n.a}}),pH=a(function(e,t,r,n){return f(xi,"",f(Ua,l(hH,e,r,n),t))}),gH=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),vH=function(e){return e>11?"pm":"am"},yH=function(e){switch(e.$){case"Jan":return"January";case"Feb":return"February";case"Mar":return"March";case"Apr":return"April";case"May":return"May";case"Jun":return"June";case"Jul":return"July";case"Aug":return"August";case"Sep":return"September";case"Oct":return"October";case"Nov":return"November";default:return"December"}},mH=function(e){switch(f(Fs,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Fs,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},bH=function(e){switch(e.$){case"Mon":return"Monday";case"Tue":return"Tuesday";case"Wed":return"Wednesday";case"Thu":return"Thursday";case"Fri":return"Friday";case"Sat":return"Saturday";default:return"Sunday"}},CH=p(gH,yH,f(tu,yH,fu(3)),bH,f(tu,bH,fu(3)),vH,mH),EH=pH(CH),SH={$:"MonthNameFull"},TH=SH,wH=function(e){return{$:"Text",a:e}},IH=wH,AH={$:"YearNumber"},BH=AH,kH=n(function(e,t,n){var a=r(function(e,t){return f(Fx,M([Ax(18),px(6)]),M([f(IR,M([Lx]),ep(e)),f(IR,M([yK]),ep(t))]))}),i=EH(M([TH,IH(", "),BH])),o=f(Fx,M([px(23),UI(BR)]),U(f(Ua,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([_("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,pK,t)}return"No Committed Trades yet!"}()),_("Release Outcomes",Ri(n.numReleases)+" trades / "+BL(n.amountReleased)+" "+E_(e)+" Released"),_("Abort Outcomes",Ri(n.numAborts)+" trades"),_("Burn Outcomes",Ri(n.numBurns)+" trades / "+BL(n.amountBurned)+" "+E_(e)+" Burned")])),M([f(IR,M([$x]),f(dK,"View User History",hK(n.asRole)))])));return f(Fx,M([vx(8),gK,vK,OR(P_),px(1),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,0),size:0})]),M([f(IR,M([UI(BR),OR(WR),e_(17)]),f(PP,18,t)),f(IR,M([UI(BR),OR(WR),e_(17)]),o)]))}),NH=n(function(e,t,r){var n=l(lK,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=Jp(e.parameters.initiatorRole)+" Stats";return f(IR,r?M([fU(f(IR,M([ZD(30),Ux]),l(kH,e.factory,e.parameters.initiatorAddress,n)))]):vr,f(ZV,a,f(fx,M([UI(BR),px(20),ux,YP(cK)]),f(Ua,fx(M([px(5)])),M([M([f(XR,M([_I(PR(28))]),sK),f(IR,M([Ax(24),o_,Fk(iK)]),ep(l(Os,2,P("0"),Ri(n.numReleases))))]),M([f(XR,M([_I(PR(28))]),oK),f(IR,M([Ax(24),o_,Fk(aK)]),ep(l(Os,2,P("0"),Ri(n.numAborts))))]),M([f(XR,M([_I(PR(28))]),uK),f(IR,M([Ax(24),o_,Fk(TU)]),ep(l(Os,2,P("0"),Ri(n.numBurns))))])])))))}),$H=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+sp(t)}e.a;return"https://kovan.etherscan.io/address/"+sp(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+sp(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+sp(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+sp(t)}}),RH=n(function(e,t,r){return f(_k,e,{label:ep(sp(r)),url:f($H,t,r)})}),xH=function(e){return f(ZV,"Trade Status",f(Fx,M([Ax(24),o_,px(8)]),M([ep(function(){switch(e.state.phase.$){case"Open":return"Buyer"===e.parameters.initiatorRole.$?"Open Buy Offer":"Open Sell Offer";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}}()),l(RH,M([Ax(12),Fk(dF),PF]),e.factory,e.creationInfo.address)])))},_H=f(ox,lx,GI.spaceEvenly),LH=i(function(e,t,r,n,a){return f(fx,M([UI(BR),_H]),M([xH(t),f(tK,t,r),nK(t),l(NH,t,n,a)]))}),PH=l(DR,9,32,107),DH=FR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),UH=f(IR,M([vx(4),ux,YP(zV),e_(5),OR(l(DR,22,0,255))]),f(XR,M([UI(PR(42))]),DH)),OH=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},MH=d(wU,1,31,52,.13),FH=function(e){return f(Fx,M([vx(12),OR(P_),e_(15),px(15),$x]),M([f(IR,M([Ax(24),Tx,ML,$x]),ep("External Payment Method")),f(_x,M([Ax(18),_I(PI),OR(WR),pP({blur:5,color:d(wL,0,0,0,.2),offset:_(-3,3),size:0}),vx(3),e_(5)]),M([f(Kc,f(IR,M([Fk(MH),ML]),ep("No payment methods found.")),f(xo,ep,f(xo,function(e){return e.info},ov(e))))]))]))},VH={$:"Active"},KH=function(e){return{$:"ExpandPhase",a:e}},HH=M([OR(PH),Fk(WR)]),jH=M([OR(WR)]),qH=FR({description:"flame",src:"/DAIHard/static/img/flame.png"}),GH=r(function(e,t){return sg(f(Cs,cg(e),cg(t)))}),zH=r(function(e,t){return d(RF,L(d(wL,1,.6,.2,1),d(wL,1,.6,.2,.8),d(wL,1,.6,.2,.6)),WR,e,t)}),WH=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),YH=function(e){return{$:"ContractActionClicked",a:e}},JH={$:"Web3Connect"},QH=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return d$}e.a;return l$}switch(e.a.$){case"Eth":e.a;return d$;case"Kovan":e.a;return l$;default:e.a;return h$(100)}},XH=n(function(e,t,r){var n=Sm(r);if("Just"===n.$){var a=n.a;if($(QH(t.factory),a.network)){return"TimeUp"===f(I_,e,t).$?_R:f(fx,M([px(8)]),function(){var e=L(t.state.phase,f(Ro,t,a.address),f(_o,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Ji,Cw,f(dK,"Remove and Refund this Trade",mw))])}break e}var r=(e.a,e.b,cg(rS(t.parameters)));return M([f(xF,"Deposit and Commit to Trade",l(WH,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Ji,YH,f(zH,"Abort Trade",aw)),f(Ji,YH,f(xF,"Confirm Payment",lw)),UH])}e.a,e.c.a;return M([UH])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Ji,YH,f(xF,"Burn it All!",fw)),f(Ji,YH,f(dK,"Release Everything",bw)),UH])}e.a,e.c.a;return M([UH])}break e;default:break e}return vr}())}return f(_x,M([Ax(18),ML,Fk(l_)]),M([ep("You must connect to the "+nO(t.factory)+" network to interact with this trade.")]))}return f(xF,"Connect to Wallet",JH)}),ZH={$:"Finished"},ej={$:"NotStarted"},tj=r(function(e,t){var r=_(d_(t),d_(e.state.phase)),n=r.a,a=r.b;return x(n,a)>0?ej:$(n,a)?VH:ZH}),rj=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Ra,r,e),a=t-1,i=r;e=n,t=a,r=i}}),nj=r(function(e,t){return l(rj,vr,e,t)}),aj=a(function(e,t,r,n){var a=BL(f(yg,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+E_(r.factory),i=BL(r.parameters.tradeAmount)+" "+E_(r.factory),o=f(fx,vr,f(nj,3,f(XR,M([_I(PR(18))]),qH))),u=f(Ma,IR(M([Fk(TU)])),ep),s=TL(r.terms.price),c=$(e,r.state.phase),d=f($o,_o(r),f(xo,function(e){return e.address},Sm(n))),h=c?WR:B_,p=_x(M([Fk(h),Ax(18),Tx])),g=c?l(DR,0,226,255):l(DR,16,7,234),v=f(Ma,IR(M([Fk(g)])),ep),y=BL(r.parameters.buyerDeposit)+" "+E_(r.factory),m=r.parameters.abortPunishment,b=BL(m)+" "+E_(r.factory),C=BL(f(GH,r.parameters.buyerDeposit,m))+" "+E_(r.factory),E=BL(f(GH,r.parameters.tradeAmount,m))+" "+E_(r.factory),S=function(){var t=_(e,d);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return _("And Now, We Wait",function(){return"Buyer"===n.$?f(Ua,p,M([M([ep("Your "),u("burnable deposit"),ep(" of "),v(y),ep(" is now held in this contract, and your offer to buy "),v(i),ep(" for "),v(s),ep(" is now listed in the marketplace.")]),M([ep("If another user likes your offer, they can become the Seller by depositing the full "),v(i),ep(" into this contract.")]),M([ep("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),ep(" to you.")])])):f(Ua,p,M([M([ep("Your offer to sell the "),v(i),ep(" held in this contract for "),v(s),ep(" is now listed in the marketplace.")]),M([ep("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),ep(" of 1/3 of the trade amount "),v("("+y+")"),ep(" into this contract.")]),M([ep("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),ep(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return _("Time to Pay Up",f(Ua,p,M([M([ep("You must now pay the Seller "),v(s),ep(" via the External Payment Method, "),f(IR,M([Tx]),ep("and then click ")),u("Confirm Payment"),ep(" before the payment window runs out. Use the chat to coordinate.")]),M([ep("If you abort the trade, or do not confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(") will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to the Seller, "),v(C),ep(" to you).")]),M([ep("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(s),ep(" has been unmistakably transferred.")])])))}t.a,t.b.a;return _("Time to Get Paid",f(Ua,p,M([M([ep("Work and communicate with the Buyer to receive "),v(s),ep(" as described in External Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([ep("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(") will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to you, "),v(C),ep(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return _("Judgement",f(Ua,p,M([M([ep("If the Seller confirms receipt of payment, or makes no decision within the Burn Window, the combined balance of "),v(a),ep(" is yours to claim.")]),M([ep("If they cannot confirm they've received payment from you, they will probably choose to "),u("burn the contract's balance of "),v(a),u("."),ep(" In this case the "),v(a),ep(" will be lost to both parties.")]),M([ep("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return _("Judgement",f(Ua,p,M([M([ep("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([ep("So, have you recieved the "),v(s),ep("? If so, you can click "),v("Release Everything"),ep(".")]),M([ep("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),ep(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([ep("If you don't decide within the Burn Window, the Buyer will be able to claim the full balance.")])])));default:t.a;return _("Contract closed.",M([p(M([ep("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return _("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(Ua,p,M([M([ep("The Seller has deposited "),v(i),ep(" into this contract, and offers to sell it for "),v(s),ep(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),ep(" into this contract by clicking "),u("Deposit and Commit to Trade"),ep(".")]),M([ep("If the trade is successful, the combined "+E_(r.factory)+" balance "),v("("+a+")"),ep(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,ep(" for both parties (see Payment Window for more on this).")]),M([ep("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(s),ep(" within the payment window.")])])):f(Ua,p,M([M([ep("The Buyer is offering to buy "),v(i),ep(" for "),v(s),ep(", and has deposited "),v(y),ep(" into this contract as a "),u("burnable deposit"),ep(". To become the Seller, deposit "),v(i),ep(" into this contract by clicking "),u("Deposit and Commit to Trade"),ep(".")]),M([ep("When you receive the "),v(s),ep(" from the Buyer, the combined "+E_(r.factory)+" balance "),v("("+a+")"),ep(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,ep(" for both parties (see Payment Window for more on this).")]),M([ep("Don't commit unless you can receive "),v(s),ep(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return _("Making the Payment",f(Ua,p,M([M([ep("During this phase, the Buyer is expected to transfer "),v(s),ep(" to the Seller, as described in External Payment Method, "),f(IR,M([Tx]),ep("and ")),u("Confirm the Payment "),ep(" before the payment window runs out. This would move the trade to the final phase.")]),M([ep("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(" amount) will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to the Seller, "),v(C),ep(" to the Buyer).")])])));case"Judgment":t.a,t.b;return _("Judgement",f(Ua,p,M([M([ep("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([ep("If the Seller can verify he has received the "),v(s),ep(", he will probably release the total balance of "),v(i),ep(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),ep(".")]),M([ep("If the Seller has not made a decision before the Burn Window expires, the "),v(i),ep(" becomes claimable by the Buyer.")])])));default:t.a,t.b;return _("Contract closed.",vr)}}(),T=S.a,w=S.b;return f(Fx,M([UI(BR),_I(BR),e_(20),px(30)]),M([f(fx,M([UI(BR)]),M([f(IR,M([Ax(24),Tx,Fk(g),GL]),ep(T))])),f(Fx,M([UI(BR),tx,px(13)]),w),f(IR,M([Ux]),function(){switch(f(tj,r,e).$){case"Active":return l(XH,t,r,n);case"NotStarted":return f(IR,M([Ax(20),Tx,ML,Fk(l_)]),ep("Phase not yet started."));default:return f(IR,M([Ax(20),Tx,ML]),ep("Phase no longer active."))}}())]))}),ij=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},oj=FR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),uj=FR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),sj={$:"None"},cj=sj,fj=FR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),lj=function(e){switch(e.$){case"Open":return fj;case"Committed":return oj;case"Judgment":return uj;default:return cj}},dj=r(function(e,t){var r=lj(e),n=function(){switch(t.$){case"NotStarted":return l(DR,10,33,108);case"Active":return l(DR,0,100,170);default:return l(DR,1,129,104)}}(),a=vO(aF(f(_O,TO(gO(n)),mO(50))));return f(IR,M([$x,xR(f(XR,M([$x,tx,_I(PR(60))]),r))]),a)}),hj=function(e){var t=M([ML,Tx,Ax(20)]);switch(e.$){case"Active":return f(IR,U(t,M([Fk(zR)])),ep("Active"));case"NotStarted":return f(IR,U(t,M([Fk(l_)])),ep("Not Started"));default:return f(IR,t,ep("Finished"))}},pj=n(function(e,t,r){var n=f(tj,t,e),a=function(){return"Active"===n.$?l(DR,0,226,255):B_}(),i=f(IR,M([Fk(a),Ax(20),Tx,$x]),ep(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Burn Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return _R;switch(n.$){case"NotStarted":return d(L_,M([$x]),M([Ax(22),o_]),_(B_,P_),f(w_,e,t));case"Active":var a=f(I_,r,t);if("TimeLeft"===a.$){var i=a.a;return d(V_,M([$x]),M([Ax(22),o_]),_(WR,P_),i)}return f(Fx,M([$x,px(10)]),M([f(IR,M([$x]),ep(ij(e))),f(dK,"Poke",Cw(yw))]));default:return f(IR,M([_I(PR(1))]),_R)}}();return f(Fx,M([e_(20),px(10),_I(BR)]),M([f(IR,M([AP,$x]),i),f(IR,M([_I(BR),$x]),f(IR,M([tx]),f(dj,e,n))),f(Fx,M([px(10),DU,$x]),M([f(IR,M([$x]),hj(n)),o]))]))}),gj=r(function(e,t){return{$:"Min",a:e,b:t}}),vj=r(function(e,t){return f(gj,e,t)}),yj=i(function(e,t,r,n,a){var i=f(tj,t,e),o=f(IR,M([e_(10),UI(BR),_I(BR)]),d(aj,e,a,t,r)),u=function(){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ho(0)}}(),s=l(pj,e,t,a),c=(function(){switch(i.$){case"NotStarted":return u;case"Active":return f(ul,f(oS,t.state.phaseStartTime,u),a);default:Ho(0)}}(),M([vx(12),AP,_I(f(vj,380,PI)),pP({blur:8,color:d(wL,0,0,0,.2),offset:_(0,0),size:0})])),h=f(IR,M([_I(BR),UI(PR(1)),OR(function(){return"Active"===i.$?l(Pk,0,0,1):P_}())]),_R);return n?f(fx,U(c,U($(i,VH)?HH:jH,M([UI(BR)]))),M([s,h,o])):f(fx,U(c,U($(i,VH)?HH:jH,M([ux,Ex(KH(e))]))),M([s]))}),mj=a(function(e,t,r,n){return"Closed"===e.state.phase.$?f(fx,M([$x,vx(12),px(10),e_(10),OR(PH),Ax(24),Tx,Fk(WR)]),M([ep("Trade "+OH(e.state.closedReason)),UH])):f(Fx,M([UI(BR),px(10)]),M([f(fx,M([UI(BR),_I(PI),px(20)]),M([h(yj,Io,e,r,$(t,Io),n),h(yj,To,e,r,$(t,To),n),h(yj,wo,e,r,$(t,wo),n)])),FH(e.terms.paymentMethods)]))}),bj=a(function(e,t,r,n){return _(d(LV,1800,li,"Trade at "+function(){var e=Vw(n.trade);if("Just"===e.$){var t=e.a;return sp(t.address)}return"..."}(),f(IR,M([e_(30),UI(BR)]),function(){var e=n.trade;switch(e.$){case"LoadedTrade":var a=e.a;return f(Fx,M([UI(BR),_I(BR),px(40)]),M([h(LH,t,a,n.wallet,r,n.showStatsModal),f(IR,M([UI(BR),f(ax,40,0),px(40)]),d(mj,a,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(IR,M([$x,tx,Ax(30)]),ep("Loading trade info..."));default:return f(IR,M([$x,tx,Ax(30)]),ep("Invalid trade"))}}())),M([WV(n),XV(n)]))}),Cj=n(function(e,t,r){var n=r.a,a=r.b;return _(e(n),t(a))}),Ej=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"InitialBlank":return _(_R,vr);case"CreateModel":var n=r.a;return l(Cj,Ji(EI),Ua(Ji(EI)),MF(n));case"TradeModel":var a=r.a;return l(Cj,Ji(BI),Ua(Ji(BI)),d(bj,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return l(Cj,Ji(wI),Ua(Ji(wI)),l(xV,t.time,t.tradeCaches,i));default:var o=r.a;return _(f(Ji,yI,l(FP,t.time,t.tradeCaches,o)),vr)}}(),n=r.a,a=r.b;return _(f(IR,M([UI(BR),_I(BR),vx(10)]),n),a)}),Sj=function(e){return{$:"DismissNotice",a:e}},Tj=function(e){return f(uP,sV,cV(e))},wj=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(Pk,1,1,1):l(Pk,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(DR,100,200,255);case"Caution":return l(DR,255,188,0);case"Error":return l(DR,255,70,70);default:return l(DR,200,200,200)}}(),o=f(IR,M([Ux,AP,sP(5),Tj(5)]),wF(Sj(t)));return f(IR,M([OR(i),vx(10),e_(8),UI(BR),LL(1),xL(d(wL,0,0,0,.15)),PV]),f(Fx,M([px(4),UI(BR)]),f(Ni,r(function(e,t){return f(_x,M([UI(BR),Fk(a)]),e?t:f(Ra,o,t))}),n.mainParagraphs)))},Ij=function(e){return $(e,vr)?vr:M([f(Fx,M([fV(20),sP(20),px(10),Ux,DU,UI(PR(300)),Ax(15)]),f(Ua,wj,f(pp,function(e){return $(e.b.align,Xh)},f(Ni,r(function(e,t){return _(e,t)}),e)))),f(Fx,M([Tj(20),ZD(100),px(10),GL,AP,UI(PR(300)),Ax(15)]),f(Ua,wj,f(pp,function(e){return $(e.b.align,n$)},f(Ni,r(function(e,t){return _(e,t)}),e))))])},Aj=r(function(e,t){var r=f(Ej,e,t),n=r.a,a=r.b;return _(f(Fx,M([U_(MR),xR(Vx(t)),UI(BR),_I(BR),e_(30)]),M([f(IR,M([_I(PR(50))]),_R),n])),U(a,Ij(t.userNotices)))}),Bj=function(e){return{$:"FocusStyleOption",a:e}},kj=Bj,Nj=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),$j=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),Rj={$:"AllowHover"},xj={$:"Layout"},_j={backgroundColor:li,borderColor:li,shadow:fi({blur:0,color:d(Lk,155/255,203/255,1,1),offset:_(0,0),size:3})},Lj=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:fi(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:fi(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:fi(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?_j:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?Rj:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?xj:t.a}()}}(l(Da,t,{focus:li,hover:li,mode:li},e))},Pj=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(KI);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),KI);case"Text":var a=t.a;return QB(a);default:return QB("")}}),Dj=n(function(e,t,r){var n=Lj(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?Nj(n):$j(n)}();return f(Pj,a,d(Rk,KI,wR,t,FI(M([r]))))}),Uj=gA(5),Oj=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),Mj={$:"SansSerif"},Fj=function(e){return{$:"Typeface",a:e}},Vj=J,Kj=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(xi,"-",Vj(Zp(t)));case"ImportFont":var t=e.a;e.b;return f(xi,"-",Vj(Zp(t)));default:var t=e.a.name;return f(xi,"-",Vj(Zp(t)))}}())}),Hj=function(){var e=M([Fj("Open Sans"),Fj("Helvetica"),Fj("Verdana"),Mj]);return M([f(Ok,UR,l(Uk,"bg-"+Mk(d(Lk,1,1,1,0)),"background-color",d(Lk,1,1,1,0))),f(Ok,Dk,l(Uk,"fc-"+Mk(d(Lk,0,0,0,1)),"color",d(Lk,0,0,0,1))),f(Ok,wx,Ix(20)),f(Ok,Uj,f(Oj,l(_a,Kj,"font-",e),e))])}(),jj=n(function(e,t,r){var n=e.options;return l(Dj,n,f(Ra,xk(f(xi," ",M([GI.root,GI.any,GI.single]))),U(Hj,t)),r)}),qj=function(e){return f(Ok,Uj,f(Oj,l(_a,Kj,"ff-",e),e))},Gj=Mj,zj=Fj,Wj=function(e){return{body:M([function(){var t=f(Aj,e.screenWidth,e),r=t.a,n=t.b,a=U(M([UI(BR),_I(BR),Ex(SR),qj(M([zj("Soleil"),Gj]))]),f(Ua,xR,n));return l(jj,{options:M([kj({backgroundColor:li,borderColor:li,shadow:li})])},a,r)}()]),title:"DAIHard"}},Yj=Gt,Jj=Yj({init:C$,onUrlChange:ER,onUrlRequest:CR,subscriptions:bR,update:jN,view:Wj});!function(t){e.Elm?Je("Elm",e.Elm,t):e.Elm=t}({App:{init:Jj(f(Cu,function(e){return f(Cu,function(t){return f(Cu,function(r){return Ki({height:r,networkId:t,width:e})},f(hl,"height",xT))},f(hl,"networkId",xT))},f(hl,"width",xT)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),R(r,r,f),k(n,e[0],e[1]),k(f,t[0],t[1]),R(n,n,f),R(a,e[3],t[3]),R(a,a,F),R(i,e[2],t[2]),k(i,i,i),N(o,n,r),N(u,i,a),k(s,i,a),k(c,n,r),R(e[0],o,u),R(e[1],c,s),R(e[2],s,u),R(e[3],o,c)}function l(e,t,r){for(var n=0;n<4;++n)A(e[n],t[n],r)}function d(e,t){var r=B(),n=B(),a=B();w(a,t[2]),R(r,t[0],a),R(n,t[1],a),h(e,n),e[31]^=C(r)<<7}function h(e,t){var r,n,a,i=B(),o=B();for(r=0;r<16;++r)o[r]=t[r];for(I(o),I(o),I(o),n=0;n<2;++n){for(i[0]=o[0]-65517,r=1;r<15;++r)i[r]=o[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=o[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,A(o,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function p(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B();return T(e[2],O),g(e[1],t),$(a,e[1]),R(i,a,M),N(a,a,e[2]),k(i,e[2],i),$(o,i),$(u,o),R(s,u,o),R(r,s,a),R(r,r,i),v(r,r),R(r,r,a),R(r,r,i),R(r,r,i),R(e[0],r,i),$(n,e[0]),R(n,n,i),y(n,a)&&R(e[0],e[0],j),$(n,e[0]),R(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),R(e[3],e[0],e[1]),0)}function g(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function v(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)$(n,n),1!==r&&R(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function y(e,t){var r=new P(32),n=new P(32);return h(r,e),h(n,t),m(r,0,n,0)}function m(e,t,r,n){return b(e,t,r,n,32)}function b(e,t,r,n,a){var i,o=0;for(i=0;i>>8)-1}function C(e){var t=new P(32);return h(t,e),1&t[0]}function E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),R(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)$(n,n),2!==r&&4!==r&&R(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function I(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function A(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function B(e){var t,r=new Float64Array(16);if(e)for(t=0;t=0};var U=B(),O=B([1]),M=B([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),F=B([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),V=B([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),K=B([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),H=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),j=B([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139])}).call(t,r(10).Buffer)},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var o=new a.util.ByteBuffer,u=Math.ceil(i/n)+r,s=new a.util.ByteBuffer,c=r;c0&&(o=a.util.fillString(String.fromCharCode(0),s)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},n.decrypt=function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)},n},a.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(16),r(9),r(35),r(36)},function(e,t,r){var n=r(0);r(26),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e){var t={},r=[];if(!p.validate(e,g.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:h.pki.RDNAttributesAsArray(t.issuer),serialNumber:h.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:p.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(e.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:e.issuer}),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,h.util.hexToBytes(e.serialNumber))]),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(e.encryptedContent.algorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r0){for(var r=p.create(p.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n=r&&a0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,0,!0,e)),n.length>0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,1,!0,n)),a.value[0].value.push(p.create(p.Class.UNIVERSAL,p.Type.SET,!0,r.signerInfos)),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(r.type).getBytes()),a])},addSigner:function(e){var t=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=h.pki.certificateFromPem(a)),t=a.issuer.attributes,n=a.serialNumber}var i=e.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=h.pki.privateKeyFromPem(i));var o=e.digestAlgorithm||h.pki.oids.sha1;switch(o){case h.pki.oids.sha1:case h.pki.oids.sha256:case h.pki.oids.sha384:case h.pki.oids.sha512:case h.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var s=!1,c=!1,f=0;f="8"&&(r="00"+r);var n=o.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function a(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=o.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=v[this.state].block)},y.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==d&&(this.state=c,b(this,0)),this.blocks},y.prototype.sleep=function(e){e=void 0===e?0:e,this.state=v[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,b(t,0)},e)},y.prototype.wait=function(e){e.wait(this)},y.prototype.wakeup=function(){this.state===l&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,b(this,0))},y.prototype.cancel=function(){this.state=v[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},y.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,b(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e){e.error=!1,e.state=v[e.state][g],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),b(e,0))},0)},b=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||b(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,b(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=d,delete i[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(a,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(a,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(a,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new y({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],m(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var r in t)t[r].unblock()},e}},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=this[e],a=1,i=0;++i=a&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||L(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function $(e){this.m=e}function R(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function x(e){return e}function _(e){e.divRemTo(this.m,null,e)}function L(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function P(e,t){e.squareTo(t),this.reduce(t)}function D(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function U(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function M(e){var t=a();return e.copyTo(t),this.reduce(t),t}function F(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function V(e,t){e.squareTo(t),this.reduce(t)}function K(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function H(){return 0==(this.t>0?1&this.data[0]:this.s)}function j(e,t){if(e>4294967295||e<1)return n.ONE;var r=a(),i=a(),o=t.convert(this),u=b(e)-1;for(o.copyTo(r);--u>=0;)if(t.sqrTo(r,i),(e&1<0)t.mulTo(i,o,r);else{var s=r;r=i,i=s}return t.revert(r)}function q(e,t){var r;return r=e<256||t.isEven()?new $(t):new U(t),this.exp(e,r)}function G(){var e=a();return this.copyTo(e),e}function z(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function Y(){return 0==this.t?this.s:this.data[0]<<16>>16}function J(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Q(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function X(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=a(),o=a(),u="";for(this.divRemTo(n,i,o);i.signum()>0;)u=(r+o.intValue()).toString(e).substr(1)+u,i.divRemTo(n,i,o);return o.intValue().toString(e)+u}function Z(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),i=!1,o=0,u=0,s=0;s=r&&(this.dMultiply(a),this.dAddOffset(u,0),o=0,u=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(u,0)),i&&n.ZERO.subTo(this,this)}function ee(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),se,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var a=new Array,i=7&e;a.length=1+(e>>3),t.nextBytes(a),i>0?a[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t}function re(e){return 0==this.compareTo(e)}function ne(e){return this.compareTo(e)<0?this:e}function ae(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,a,i=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function me(){for(var e=0;e=this.t?0!=this.s:0!=(this.data[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Be(e){var t=a();return this.addTo(e,t),t}function ke(e){var t=a();return this.subTo(e,t),t}function Ne(e){var t=a();return this.multiplyTo(e,t),t}function $e(e){var t=a();return this.divRemTo(e,t,null),t}function Re(e){var t=a();return this.divRemTo(e,null,t),t}function xe(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function _e(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Le(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Pe(){}function De(e){return e}function Ue(e,t,r){e.multiplyTo(t,r)}function Oe(e,t){e.squareTo(t)}function Me(e){return this.exp(e,new Pe)}function Fe(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var a;for(a=r.t-this.t;n=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t}function je(e){return e}function qe(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Ge(e,t){e.squareTo(t),this.reduce(t)}function ze(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function We(e,t){var r,n,i=e.bitLength(),o=d(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new $(t):t.isEven()?new Ke(t):new U(t);var u=new Array,s=3,c=r-1,f=(1<1){var l=a();for(n.sqrTo(u[1],l);s<=f;)u[s]=a(),n.mulTo(l,u[s-2],u[s]),s+=2}var h,p,g=e.t-1,v=!0,y=a();for(i=b(e.data[g])-1;g>=0;){for(i>=c?h=e.data[g]>>i-c&f:(h=(e.data[g]&(1<0&&(h|=e.data[g-1]>>this.DB+i-c)),s=r;0==(1&h);)h>>=1,--s;if((i-=s)<0&&(i+=this.DB,--g),v)u[h].copyTo(o),v=!1;else{for(;s>1;)n.sqrTo(o,y),n.sqrTo(y,o),s-=2;s>0?n.sqrTo(o,y):(p=o,o=y,y=p),n.mulTo(y,u[h],o)}for(;g>=0&&0==(e.data[g]&1<0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Je(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Qe(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),a=this.clone(),i=d(1),o=d(0),u=d(0),s=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;a.isEven();)a.rShiftTo(1,a),t?(u.isEven()&&s.isEven()||(u.addTo(this,u),s.subTo(e,s)),u.rShiftTo(1,u)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(a)>=0?(r.subTo(a,r),t&&i.subTo(u,i),o.subTo(s,o)):(a.subTo(r,a),t&&u.subTo(i,u),s.subTo(o,s))}return 0!=a.compareTo(n.ONE)?n.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s}function Xe(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=ut[ut.length-1]){for(t=0;t=0);var s=a.modPow(i,this);if(0!=s.compareTo(n.ONE)&&0!=s.compareTo(t)){for(var c=1;c++a-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=a-11,i}n.putByte(0),n.putByte(r);var o,u=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var s=0;s0;){for(var c=0,f=d.random.getBytes(u),s=0;s1;){if(255!==i.getByte()){--i.read;break}++s}else if(2===u)for(s=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++s}if(0!==i.getByte()||s!==a-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function i(e,t,r){function n(){a(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void a(e.qBits,i))})}function a(e,t){d.prime.generateProbablePrime(e,o,t)}function i(t,o){if(t)return r(t);if(e.q=o,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(0!==e.p.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.p=null,void n();if(0!==e.q.subtract(h.ONE).gcd(e.e).compareTo(h.ONE))return e.q=null,void a(e.qBits,i);if(e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(h.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,i);var s=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,s,e.p,e.q,s.mod(e.p1),s.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng),n()}function o(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=d.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function u(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function s(e){return d.util.isNodejs&&"function"==typeof p[e]}function c(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.crypto&&"object"==typeof v.globalScope.crypto.subtle&&"function"==typeof v.globalScope.crypto.subtle[e]}function f(e){return void 0!==v.globalScope&&"object"==typeof v.globalScope.msCrypto&&"object"==typeof v.globalScope.msCrypto.subtle&&"function"==typeof v.globalScope.msCrypto.subtle[e]}function l(e){for(var t=d.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n=0||!n.gcd(t.n).equals(h.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var a=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);a.compareTo(i)<0;)a=a.add(t.p);var o=a.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return o=o.multiply(n.modInverse(t.n)).mod(t.n)};y.rsa.encrypt=function(e,t,r){var a,i=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,a=n(e,t,r)):(a=d.util.createBuffer(),a.putBytes(e));for(var u=new h(a.toHex(),16),s=w(u,t,i),c=s.toString(16),f=d.util.createBuffer(),l=o-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),f.getBytes()},y.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=i,o}var u=new h(d.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=w(u,t,r),c=s.toString(16),f=d.util.createBuffer(),l=i-Math.ceil(c.length/2);l>0;)f.putByte(0),--l;return f.putBytes(d.util.hexToBytes(c)),!1!==n?a(f.getBytes(),t,r):f.getBytes()},y.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,a=r.prng||d.random,i={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},y.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new h(null);r.fromInt(30);for(var n,a=0,i=function(e,t){return e|t},o=+new Date,s=0;null===e.keys&&(t<=0||sc?e.pqState=0:e.num.isProbablePrime(u(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(m[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(h.ONE).gcd(e.e).compareTo(h.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(h.ONE),e.q1=e.q.subtract(h.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(h.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var l=e.e.modInverse(e.phi);e.keys={privateKey:y.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:y.rsa.setPublicKey(e.n,e.e)}}n=+new Date,s+=n-o,o=n}return null!==e.keys},y.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!d.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(s("generateKeyPair"))return p.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return n(e);n(null,{privateKey:y.privateKeyFromPem(r),publicKey:y.publicKeyFromPem(t)})});if(c("generateKey")&&c("exportKey"))return v.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return v.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(e)));n(null,{privateKey:t,publicKey:y.setRsaPublicKey(t.n,t.e)})}});if(f("generateKey")&&f("exportKey")){var a=v.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return a.oncomplete=function(e){var t=e.target.result,r=v.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=y.privateKeyFromAsn1(g.fromDer(d.util.createBuffer(t)));n(null,{privateKey:r,publicKey:y.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(a.onerror=function(e){n(e)})}}else if(s("generateKeyPairSync")){var o=p.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:y.privateKeyFromPem(o.privateKey),publicKey:y.publicKeyFromPem(o.publicKey)}}var u=y.rsa.createKeyPairGenerationState(e,t,r);if(!n)return y.rsa.stepKeyPairGenerationState(u,0),u.keys;i(u,r,n)},y.setRsaPublicKey=y.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,a){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return d.pkcs1.encode_rsa_oaep(t,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return y.rsa.encrypt(i,r,!0)},r.verify=function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=a(t,r,!0),e===g.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=a(t,r,!0),e===t}});var i=y.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())},r},y.setRsaPrivateKey=y.rsa.setPrivateKey=function(e,t,r,n,i,o,u,s){var c={n:e,e:t,d:r,p:n,q:i,dP:o,dQ:u,qInv:s};return c.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=y.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:a};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return d.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},c.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:T},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return y.rsa.encrypt(n,c,r)},c},y.wrapRsaPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(e).getBytes())])},y.privateKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,b,t,r)&&(e=g.fromDer(d.util.createBuffer(t.privateKey))),t={},r=[],!g.validate(e,C,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var a,i,o,u,s,c,f,l;return a=d.util.createBuffer(t.privateKeyModulus).toHex(),i=d.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=d.util.createBuffer(t.privateKeyPrivateExponent).toHex(),u=d.util.createBuffer(t.privateKeyPrime1).toHex(),s=d.util.createBuffer(t.privateKeyPrime2).toHex(),c=d.util.createBuffer(t.privateKeyExponent1).toHex(),f=d.util.createBuffer(t.privateKeyExponent2).toHex(),l=d.util.createBuffer(t.privateKeyCoefficient).toHex(),y.setRsaPrivateKey(new h(a,16),new h(i,16),new h(o,16),new h(u,16),new h(s,16),new h(c,16),new h(f,16),new h(l,16))},y.privateKeyToAsn1=y.privateKeyToRSAPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.p)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.qInv))])},y.publicKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),$=c.hmac.create();$.start(u,e),$.update(f.toDer(B).getBytes());var R=$.getMac();A=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.sha1).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.NULL,!1,"")]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,R.getBytes())]),f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,k.getBytes()),f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(N).getBytes())])}return f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.INTEGER,!1,f.integerToDer(3).getBytes()),f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(B).getBytes())])]),A])},d.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var a=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var o={name:"ContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=o;var u={name:"EncryptedContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(u)},i.encryptedDataValidator={name:"EncryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"}].concat(u)};var s={name:"SignerInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,capture:"signerInfos",optional:!0,value:[s]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(3),r(6),r(27),r(7),r(17),r(29),r(18),r(13),r(1),r(19);var a=n.asn1,i=e.exports=n.pki=n.pki||{};i.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=a.fromDer(t.body);return i.privateKeyFromAsn1(o)},i.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:a.toDer(i.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){var n=r(0);r(1),r(12),r(2),function(){function t(e,t,n,a){return"workers"in n?i(e,t,n,a):r(e,t,n,a)}function r(e,t,r,n){var i=o(e,t),s=u(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),a(i,e,t,0,s,c,n)}function a(e,t,r,i,u,s,c){var l=+new Date;do{if(e.bitLength()>t&&(e=o(t,r)),e.isProbablePrime(u))return c(null,e);e.dAddOffset(f[i++%8],0)}while(s<0||+new Date-le&&(s=o(e,t));var h=s.toString(16);r.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(d,0)}}f=Math.max(1,f);for(var n=[],a=0;a=32)return i(),e();var t=32-u.pools[0].messageLength<<5;u.seedFile(t,function(t,r){if(t)return e(t);u.collect(r),i(),e()})}function r(){if(u.pools[0].messageLength>=32)return i();var e=32-u.pools[0].messageLength<<5;u.collect(u.seedFileSync(e)),i()}function i(){u.reseeds=4294967295===u.reseeds?0:u.reseeds+1;var e=u.plugin.md.create();e.update(u.keyBytes);for(var t=1,r=0;r<32;++r)u.reseeds%t==0&&(e.update(u.pools[r].digest().getBytes()),u.pools[r].start()),t<<=1;u.keyBytes=e.digest().getBytes(),e.start(),e.update(u.keyBytes);var n=e.digest().getBytes();u.key=u.plugin.formatKey(u.keyBytes),u.seed=u.plugin.formatSeed(n),u.generated=0}function o(e){var t=null,r=n.util.globalScope,a=r.crypto||r.msCrypto;a&&a.getRandomValues&&(t=function(e){return a.getRandomValues(e)});var i=n.util.createBuffer();if(t)for(;i.length()>16),f+=(32767&c)<<16,f+=c>>15,f=(2147483647&f)+(f>>31),d=4294967295&f;for(var s=0;s<3;++s)l=d>>>(s<<3),l^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&l))}return i.getBytes(e)}for(var u={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},s=e.md,c=new Array(32),f=0;f<32;++f)c[f]=s.create();return u.pools=c,u.pool=0,u.generate=function(e,r){function a(l){if(l)return r(l);if(f.length()>=e)return r(null,f.getBytes(e));if(u.generated>1048575&&(u.key=null),null===u.key)return n.util.nextTick(function(){t(a)});var d=i(u.key,u.seed);u.generated+=d.length,f.putBytes(d),u.key=s(i(u.key,o(u.seed))),u.seed=c(i(u.key,u.seed)),n.util.setImmediate(a)}if(!r)return u.generateSync(e);var i=u.plugin.cipher,o=u.plugin.increment,s=u.plugin.formatKey,c=u.plugin.formatSeed,f=n.util.createBuffer();u.key=null,a()},u.generateSync=function(e){var t=u.plugin.cipher,a=u.plugin.increment,i=u.plugin.formatKey,o=u.plugin.formatSeed;u.key=null;for(var s=n.util.createBuffer();s.length()1048575&&(u.key=null),null===u.key&&r();var c=t(u.key,u.seed);u.generated+=c.length,s.putBytes(c),u.key=i(t(u.key,a(u.seed))),u.seed=o(t(u.key,u.seed))}return s.getBytes(e)},a?(u.seedFile=function(e,t){a.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},u.seedFileSync=function(e){return a.randomBytes(e).toString()}):(u.seedFile=function(e,t){try{t(null,o(e))}catch(e){t(e)}},u.seedFileSync=o),u.collect=function(e){for(var t=e.length,r=0;r>n&255);u.collect(r)},u.registerWorker=function(e){if(e===self)u.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&u.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},u}}).call(t,r(20))},function(e,t,r){var n=r(0);r(1);var a=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],o=function(e,t){return e<>16-t},u=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,o=e.length(),u=t,s=Math.ceil(u/8),c=255>>(7&u);for(r=o;r<128;r++)i.putByte(a[i.at(r-1)+i.at(r-o)&255]);for(i.setAt(128-s,a[i.at(128-s)&c]),r=127-s;r>=0;r--)i.setAt(r,a[i.at(r+1)^i.at(r+s)]);return i};var s=function(e,t,r){var a,s,c,f,l=!1,d=null,h=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)g.push(e.getInt16Le());r?(a=function(e){for(c=0;c<4;c++)e[c]+=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=o(e[c],i[c]),f++},s=function(e){for(c=0;c<4;c++)e[c]+=g[63&e[(c+3)%4]]}):(a=function(e){for(c=3;c>=0;c--)e[c]=u(e[c],i[c]),e[c]-=g[f]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),f--},s=function(e){for(c=3;c>=0;c--)e[c]-=g[63&e[(c+3)%4]]});var v=function(e){var t=[];for(c=0;c<4;c++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var a=0;a=8;)v([[5,a],[1,s],[6,a],[1,s],[5,a]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(l=!0,y.update()),!r&&(t=0===d.length()))if(e)t=e(8,h,!r);else{var a=h.length(),i=h.at(a-1);i>a?t=!1:h.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var a=n.rc2.createEncryptionCipher(e,128);return a.start(t,r),a},n.rc2.createEncryptionCipher=function(e,t){return s(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var a=n.rc2.createDecryptionCipher(e,128);return a.start(t,r),a},n.rc2.createDecryptionCipher=function(e,t){return s(e,t,!1)}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),c=[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],s=!0}function a(e,t,r){for(var n,a,i,o,u,s,f,l,d,h,p,g,v,y,m,b=r.length();b>=64;){for(f=0;f<16;++f)t[f]=r.getInt32();for(;f<64;++f)n=t[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=t[f-15],a=(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[f]=n+t[f-7]+a+t[f-16]|0;for(l=e.h0,d=e.h1,h=e.h2,p=e.h3,g=e.h4,v=e.h5,y=e.h6,m=e.h7,f=0;f<64;++f)o=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),u=y^g&(v^y),i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&d|h&(l^d),n=m+o+u+c[f]+t[f],a=i+s,m=y,y=v,v=g,g=p+n>>>0,p=h,h=d,d=l,l=n+a>>>0;e.h0=e.h0+l|0,e.h1=e.h1+d|0,e.h2=e.h2+h|0,e.h3=e.h3+p|0,e.h4=e.h4+g|0,e.h5=e.h5+v|0,e.h6=e.h6+y|0,e.h7=e.h7+m|0,b-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(64),o={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l,d=8*o.fullMessageLength[0],h=0;h>>0,d+=l,n.putInt32(d>>>0),d=f>>>0;n.putInt32(d);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};a(p,r,n);var g=i.util.createBuffer();return g.putInt32(p.h0),g.putInt32(p.h1),g.putInt32(p.h2),g.putInt32(p.h3),g.putInt32(p.h4),g.putInt32(p.h5),g.putInt32(p.h6),g.putInt32(p.h7),g},o};var u=null,s=!1,c=null},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),128),f=[[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]],l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function a(e,t,r){for(var n,a,i,o,u,s,c,l,d,h,p,g,v,y,m,b,C,E,S,T,w,I,A,B,k,N,$,R,x,_,L,P,D,U,O,M=r.length();M>=128;){for(x=0;x<16;++x)t[x][0]=r.getInt32()>>>0,t[x][1]=r.getInt32()>>>0;for(;x<80;++x)P=t[x-2],_=P[0],L=P[1],n=((_>>>19|L<<13)^(L>>>29|_<<3)^_>>>6)>>>0,a=((_<<13|L>>>19)^(L<<3|_>>>29)^(_<<26|L>>>6))>>>0,U=t[x-15],_=U[0],L=U[1],i=((_>>>1|L<<31)^(_>>>8|L<<24)^_>>>7)>>>0,o=((_<<31|L>>>1)^(_<<24|L>>>8)^(_<<25|L>>>7))>>>0,D=t[x-7],O=t[x-16],L=a+D[1]+o+O[1],t[x][0]=n+D[0]+i+O[0]+(L/4294967296>>>0)>>>0,t[x][1]=L>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],$=e[7][0],R=e[7][1],x=0;x<80;++x)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,L=R+l+h+f[x][1]+t[x][1],n=$+c+d+f[x][0]+t[x][0]+(L/4294967296>>>0)>>>0,a=L>>>0,L=s+g,i=u+p+(L/4294967296>>>0)>>>0,o=L>>>0,$=k,R=N,k=A,N=B,A=w,B=I,L=T+a,w=S+n+(L/4294967296>>>0)>>>0,I=L>>>0,S=C,T=E,C=m,E=b,m=v,b=y,L=a+o,v=n+i+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+v+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+b,e[1][0]=e[1][0]+m+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+E,e[2][0]=e[2][0]+C+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+T,e[3][0]=e[3][0]+S+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+I,e[4][0]=e[4][0]+w+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+B,e[5][0]=e[5][0]+A+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+N,e[6][0]=e[6][0]+k+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+R,e[7][0]=e[7][0]+$+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,$=f.handleHeartbeat,R=[];R[f.ConnectionEnd.client]=[[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[A,B,I,I,$],[I,B,k,I,$],[I,B,k,N,$],[I,B,k,I,$]],R[f.ConnectionEnd.server]=[[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[I,B,k,I,$],[A,B,I,I,$],[I,B,k,I,$],[I,B,k,N,$],[I,B,k,I,$]];var x=f.handleHelloRequest,_=f.handleServerHello,L=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[I,I,_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,L,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[x,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var F=f.handleClientHello,V=f.handleClientKeyExchange,K=f.handleCertificateVerify;M[f.ConnectionEnd.server]=[[I,F,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,L,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,K,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],f.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===f.Versions.TLS_1_0.major&&e.version.minor===f.Versions.TLS_1_0.minor;o&&(i+=2*t.fixed_iv_length);var u=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:u.getBytes(t.mac_key_length),server_write_MAC_key:u.getBytes(t.mac_key_length),client_write_key:u.getBytes(t.enc_key_length),server_write_key:u.getBytes(t.enc_key_length)};return o&&(s.client_write_IV=u.getBytes(t.fixed_iv_length),s.server_write_IV=u.getBytes(t.fixed_iv_length)),s},f.createConnectionState=function(e){var t=e.entity===f.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=f.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case f.CompressionMethod.none:break;case f.CompressionMethod.deflate:n.read.compressFunction=u,n.write.compressFunction=o;break;default:throw new Error("Unsupported compression algorithm.")}}return n},f.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},f.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},f.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),f.createRecord(e,{type:f.ContentType.alert,data:r})},f.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(p+=2);var g=e.session.id,v=g.length+1+2+4+28+2+i+1+u+p,y=n.util.createBuffer();return y.putByte(f.HandshakeType.client_hello),y.putInt24(v),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),c(y,1,n.util.createBuffer(g)),c(y,2,t),c(y,1,o),p>0&&c(y,2,s),y},f.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,a=n.util.createBuffer();return a.putByte(f.HandshakeType.server_hello),a.putInt24(r),a.putByte(e.version.major),a.putByte(e.version.minor),a.putBytes(e.session.sp.server_random),c(a,1,n.util.createBuffer(t)),a.putByte(e.session.cipherSuite.id[0]),a.putByte(e.session.cipherSuite.id[1]),a.putByte(e.session.compressionMethod),a},f.createCertificate=function(e){var t=e.entity===f.ConnectionEnd.client,r=null;if(e.getCertificate){var a;a=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,a)}var i=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var o=null,u=0;uf.MaxFragment;)a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,f.MaxFragment))})),i=i.slice(f.MaxFragment);i.length>0&&a.push(f.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var o=0;o0&&(a=r.order[0]),null!==a&&a in r.cache){t=r.cache[a],delete r.cache[a];for(var i in r.order)if(r.order[i]===a){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var a=r.order.shift();delete r.cache[a]}var a=n.util.bytesToHex(e);r.order.push(a),r.cache[a]=t}}return r},f.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var a in f.CipherSuites)r.push(f.CipherSuites[a])}var i=e.server?f.ConnectionEnd.server:f.ConnectionEnd.client,o=e.sessionCache?f.createSessionCache(e.sessionCache):null,u={version:{major:f.Version.major,minor:f.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:o,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===f.ConnectionEnd.client?"client":"server"),r.send&&(f.queue(t,f.createAlert(t,r.alert)),f.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};u.reset=function(e){u.version={major:f.Version.major,minor:f.Version.minor},u.record=null,u.session=null,u.peerCertificate=null,u.state={pending:null,current:null},u.expect=(u.entity,f.ConnectionEnd.client,0),u.fragmented=null,u.records=[],u.open=!1,u.handshakes=0,u.handshaking=!1,u.isConnected=!1,u.fail=!(e||void 0===e),u.input.clear(),u.tlsData.clear(),u.data.clear(),u.state.current=f.createConnectionState(u)},u.reset();var s=function(e,t){var r=t.type-f.ContentType.change_cipher_spec,n=R[e.entity][e.expect];r in n?n[r](e,t):f.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,a=r.length();if(a<5)t=5-a;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}})}return t},l=function(e){var t=0,r=e.input,n=r.length();if(n0&&(u.sessionCache&&(t=u.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&u.sessionCache&&null!==(t=u.sessionCache.getSession())&&(e=t.id),u.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(u.version=t.version,u.session.sp=t.sp),u.session.sp.client_random=f.createRandom().getBytes(),u.open=!0,f.queue(u,f.createRecord(u,{type:f.ContentType.handshake,data:f.createClientHello(u)})),f.flush(u)}},u.process=function(e){var t=0;return e&&u.input.putBytes(e),u.fail||(null!==u.record&&u.record.ready&&u.record.fragment.isEmpty()&&(u.record=null),null===u.record&&(t=c(u)),u.fail||null===u.record||u.record.ready||(t=l(u)),!u.fail&&null!==u.record&&u.record.ready&&s(u,u.record)),t},u.prepare=function(e){return f.queue(u,f.createRecord(u,{type:f.ContentType.application_data,data:n.util.createBuffer(e)})),f.flush(u)},u.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),u.expectedHeartbeatPayload=e,f.queue(u,f.createRecord(u,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_request,e,t)})),f.flush(u)},u.close=function(e){if(!u.fail&&u.sessionCache&&u.session){var t={id:u.session.id,version:u.session.version,sp:u.session.sp};t.sp.keys=null,u.sessionCache.setSession(t.id,t)}u.open&&(u.open=!1,u.input.clear(),(u.isConnected||u.handshaking)&&(u.isConnected=u.handshaking=!1,f.queue(u,f.createAlert(u,{level:f.Alert.Level.warning,description:f.Alert.Description.close_notify})),f.flush(u)),u.closed(u)),u.reset(e)},u},e.exports=n.tls=n.tls||{};for(var q in f)"function"!=typeof f[q]&&(n.tls[q]=f[q]);n.tls.prf_tls1=a,n.tls.hmac_sha1=i,n.tls.createSessionCache=f.createSessionCache,n.tls.createConnection=f.createConnection},function(e,t,r){"use strict";var n=function(){var e={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,$a(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,ka(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Ia(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function $(e,t){for(var r,n=[],a=R(e,t,0,n);a&&(r=n.pop());a=R(r.a,r.b,0,n));return a}function R(e,t,r,n){if(r>100)return n.push(_(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&k(5),!1;"Set_elm_builtin"===e.$&&(e=$a(e),t=$a(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=ka(e),t=ka(t));for(var a in e)if(!R(e[a],t[a],r+1,n))return!1;return!0}function x(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ve("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=de(e.b,t[a]);return Va(n)?n:di(f(vi,a,n.a));case 8:if("object"!=typeof t||null===t||pe(t))return ve("an OBJECT",t);var i=vr;for(var o in t)if(t.hasOwnProperty(o)){var n=de(e.b,t[o]);if(!Va(n))return di(f(gi,o,n.a));i=O(_(o,n.a),i)}return hi(La(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=gn[e].r,o=Le(0);return gn[e].b=o,gn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=Ce(i(t.a)),s=0;s0&&yt(r,1,n,f));case 4:for(var l=e.j,d=t.j,h=!1,p=e.k;4===p.$;)h=!0,"object"!=typeof l?l=[l,p.j]:l.push(p.j),p=p.k;for(var g=t.k;4===g.$;)h=!0,"object"!=typeof d?d=[d,g.j]:d.push(g.j),g=g.k;return h&&l.length!==d.length?void yt(r,0,n,t):((h?bt(l,d):l===d)||yt(r,2,n,d),void mt(p,g,r,n+1));case 0:return void(e.a!==t.a&&yt(r,3,n,t.a));case 1:return void Ct(e,t,r,n,St);case 2:return void Ct(e,t,r,n,Tt);case 3:if(e.h!==t.h)return void yt(r,0,n,t);var v=Et(e.d,t.d);v&&yt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&yt(r,5,n,y))}}}function bt(e,t){for(var r=0;ru?yt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&yt(r,8,n,{w:a,x:o,y:k})}function wt(e,t,r,n,a,i){var o=e[r];if(!o)return o={c:0,z:n,r:a,s:void 0},i.push({r:a,A:o}),void(e[r]=o);if(1===o.c){i.push({r:a,A:o}),o.c=2;var u=[];return mt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}wt(e,t,r+Pn,n,a,i)}function It(e,t,r,n,a){var i=e[r];if(!i){var o=yt(t,9,a,void 0);return void(e[r]={c:1,z:n,r:a,s:o})}if(0===i.c){i.c=2;var u=[];return mt(n,i.z,u,a),void yt(t,9,a,{w:u,A:i})}It(e,t,r+Pn,n,a)}function At(e,t,r,n){Bt(e,t,r,0,0,t.b,n)}function Bt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)At(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Bt(e,t,f,0,a,i,o)}else if(9===c){u.t=e,u.u=o;var l=u.s;if(l){l.A.s=e;var f=l.w;f.length>0&&Bt(e,t,f,0,a,i,o)}}else u.t=e,u.u=o;if(n++,!(u=r[n])||(s=u.r)>i)return n}var d=t.$;if(4===d){for(var h=t.k;4===h.$;)h=h.k;return Bt(e,h,r,n,a+1,i,e.elm_event_node_ref)}for(var p=t.e,g=e.childNodes,v=0;vi))return n;a=m}return n}function kt(e,t,r,n){return 0===r.length?e:(At(e,t,r,n),Nt(e,r))}function Nt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(th,o,function(e){return fi(rh(e)?u+", "+e.a:u)},t)}}return t}function Ht(e,t,r){t.upload.addEventListener("progress",function(n){t.c||ke(f(ah,e,_(r,fh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||ke(f(ah,e,_(r,ch({received:n.loaded,size:n.lengthComputable?fi(n.total):li}))))})}function jt(e){try{return fi(decodeURIComponent(e))}catch(e){return li}}function qt(e,t){function r(){n=1===n?0:(sa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&sa(r),n=2)}}function Gt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(zt()))};return ua({setup:function(e){return a.a=e,la.addEventListener("popstate",a),la.navigator.userAgent.indexOf("Trident")<0||la.addEventListener("hashchange",a),r(function(t,r){if(!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&r.button<1&&!t.target&&!t.hasAttribute("download")){r.preventDefault();var a=t.href,i=zt(),o=$N(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?CN(o):bN(a)))}})},init:function(t){return l(e.init,t,zt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function zt(){return $N(En.location.href).a||k(1)}function Wt(e,t){return Ae(function(r){sa(function(){var n=document.getElementById(e);r(n?we(t(n)):Ie(EN(e)))})})}function Yt(e){return Ae(function(t){sa(function(){t(we(e()))})})}function Jt(e){return f(Nw,SN,Ae(function(t){try{la.location=e}catch(e){En.location.reload(!1)}}))}function Qt(){return f(tu,Ua(dc),f(tu,zs,lc))}console.warn("Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.0/optimize for better performance and smaller assets.");var Xt,Zt,er=[],tr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),sr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;ar.length&&(a=r.length);for(var i=n+a,o=new Array(i),u=0;u0}),r(function(e,t){return x(e,t)>=0}),r(function(e,t){var r=x(e,t);return r<0?Sa:r?Aa:Ea})),pr={$:"#0"},gr=r(U),vr={$:"[]"},yr=r(O),mr=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),br=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return x(e(t),e(r))}))})),Cr=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===Ea?0:n===Sa?-1:1}))}),Er=r(function(e,t){return e+t}),Sr=(r(function(e,t){return e-t}),r(function(e,t){return e*t})),Tr=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),wr=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Ir=Math.PI,Ar=(Math.E,Math.cos),Br=Math.sin,kr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),Nr=Math.floor,$r=Math.round,Rr=(Math.sqrt,Math.log),xr=isNaN,_r=(r(function(e,t){return e&&t}),r(function(e,t){return e||t}),r(function(e,t){return e!==t}),r(function(e,t){return e+t})),Lr=r(function(e,t){return e+t}),Pr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return vr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=oe(function(e){return"number"!=typeof e?ve("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ae(function(r){r(we(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),Wn=r(function(e,t){try{return fi(f(e,t,0).b)}catch(e){return li}}),Yn=(r(function(e,t){return _(t+1,e.getInt8(t))}),n(function(e,t,r){return _(r+2,t.getInt16(r,e))}),n(function(e,t,r){return _(r+4,t.getInt32(r,e))}),r(function(e,t){return _(t+1,e.getUint8(t))})),Jn=(n(function(e,t,r){return _(r+2,t.getUint16(r,e))}),n(function(e,t,r){return _(r+4,t.getUint32(r,e))}),n(function(e,t,r){return _(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return _(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return _(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?fi(l):li}a.push(d(Eg,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?fi(o):li}return r(d(Eg,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),a(function(e,t,r,n){return Pe(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:k(0),o=Lt(i);return qt(r,function(e){var r=a(e),n=vt(o,r);i=kt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Pe(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=En.title,o=En.body,u=Lt(o);return qt(r,function(e){Xt=n;var r=a(e),s=Tn("body")(vr)(r.body),c=vt(u,s);o=kt(o,u,c,t),u=s,Xt=0,i!==r.title&&(En.title=i=r.title)})})})),sa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ca=(r(function(e,t){return f(Nw,SN,Ae(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Nw,SN,Ae(function(){history.pushState({},"",t),e()}))})),fa=(r(function(e,t){return f(Nw,SN,Ae(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),la=("undefined"!=typeof document&&document,"undefined"!=typeof window?window:fa),da=(n(function(e,t,r){return Ne(Ae(function(n){function a(e){ke(r(e))}return e.addEventListener(t,a,Zt&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=de(e,t);return Va(r)?fi(r.a):li}),r(function(e,t){return Wt(t,function(t){return t[e](),pr})}),r(function(e,t){return Yt(function(){return la.scroll(e,t),pr})}),n(function(e,t,r){return Wt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,pr})}),r(function(e,t){return Ae(function(r){var n=setInterval(function(){ke(t)},e);return function(){clearInterval(n)}})})),ha=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),pa=function(e){return{$:"GTag",a:e}},ga=function(e){return{$:"GotoRoute",a:e}},va={$:"RequestBrowserNotificationPermission"},ya=function(e){return{$:"UserNotice",a:e}},ma={$:"Web3Connect"},ba=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),Ca=r(function(e,t){return t(e)}),Ea={$:"EQ"},Sa={$:"LT"},Ta=ur,wa=n(function(e,t,n){var a=n.c,i=n.d,o=r(function(t,r){if("SubTree"===t.$){var n=t.a;return l(Ta,o,r,n)}var a=t.a;return l(Ta,e,r,a)});return l(Ta,o,l(Ta,e,t,i),a)}),Ia=function(e){return l(wa,Ra,vr,e)},Aa={$:"GT"},Ba=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(Ba,e,t,o)),c=i;e=u,t=s,r=c}}),ka=function(e){return l(Ba,n(function(e,t,r){return f(Ra,_(e,t),r)}),vr,e)},Na=function(e){return l(Ba,n(function(e,t,r){return f(Ra,e,r)}),vr,e)},$a=function(e){var t=e.a;return Na(t)},Ra=yr,xa=Er,_a=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),La=function(e){return l(_a,Ra,vr,e)},Pa=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l(_a,e,t,La(p)):d(Pa,e,t,r+1,p)))))}return f(e,a,f(e,o,f(e,s,t)))}return f(e,a,f(e,o,t))}return f(e,a,t)}return t}),Da=n(function(e,t,r){return d(Pa,e,t,0,r)}),Ua=r(function(e,t){return l(Da,r(function(t,r){return f(Ra,e(t),r)}),vr,t)}),Oa=r(function(e,t){return e(t)}),Ma=n(function(e,t,r){return e(t(r))}),Fa=function(e){return e},Va=function(e){return"Ok"===e.$},Ka=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Ha=kr,ja=r(function(e,t){return Rr(t)/Rr(e)}),qa=V,Ga=Ha(f(ja,2,32)),za=er,Wa=d(Ka,0,Ga,za,za),Ya=function(e){return{$:"Leaf",a:e}},Ja=function(e){return{$:"SubTree",a:e}},Qa=rr,Xa=r(function(e,t){for(;;){var r=f(Qa,32,e),n=r.a,a=r.b,i=f(Ra,Ja(n),t);if(!a.b)return La(i);var o=a,u=i;e=o,t=u}}),Za=lr,ei=function(e){return e.a},ti=r(function(e,t){for(;;){var r=Ha(t/32);if(1===r)return f(Qa,32,e).a;var n=f(Xa,e,vr),a=r;e=n,t=a}}),ri=Nr,ni=r(function(e,t){return x(e,t)>0?e:t}),ai=Sr,ii=m,oi=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ri(f(ja,32,r-1)),a=e?La(t.nodeList):t.nodeList,i=f(ti,a,t.nodeListSize);return d(Ka,ii(t.tail)+r,f(ni,5,n*Ga),i,t.tail)}return d(Ka,ii(t.tail),Ga,za,t.tail)}),ui=tr,si=i(function(e,t,r,n,a){for(;;){if(t<0)return f(oi,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ya(l(ui,32,t,e)),o=e,u=t-32,s=r,c=f(Ra,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ci=r(function(e,t){if(e<=0)return Wa;var r=e%32,n=l(ui,r,e-r,t);return h(si,t,e-r-32,e,vr,n)}),fi=function(e){return{$:"Just",a:e}},li={$:"Nothing"},di=function(e){return{$:"Err",a:e}},hi=function(e){return{$:"Ok",a:e}},pi=r(function(e,t){return{$:"Failure",a:e,b:t}}),gi=r(function(e,t){return{$:"Field",a:e,b:t}}),vi=r(function(e,t){return{$:"Index",a:e,b:t}}),yi=function(e){return{$:"OneOf",a:e}},mi=gr,bi=j,Ci=function(e){var t=bi(e);return 97<=t&&t<=122},Ei=function(e){var t=bi(e);return t<=90&&65<=t},Si=function(e){return Ci(e)||Ei(e)},Ti=function(e){var t=bi(e);return t<=57&&48<=t},wi=function(e){return Ci(e)||Ei(e)||Ti(e)},Ii=function(e){return l(_a,r(function(e,t){return t+1}),0,e)},Ai=mr,Bi=n(function(e,t,r){for(;;){if(!(x(e,t)<1))return r;var n=e,a=t-1,i=f(Ra,t,r);e=n,t=a,r=i}}),ki=r(function(e,t){return l(Bi,e,t,vr)}),Ni=r(function(e,t){return l(Ai,e,f(ki,0,Ii(t)-1),t)}),$i=Vr,Ri=Z,xi=r(function(e,t){return f(Mr,e,F(t))}),_i=z,Li=r(function(e,t){return M(f(Or,e,t))}),Pi=function(e){return f(xi,"\n ",f(Li,"\n",e))},Di=on,Ui=r(function(e,t){return"\n\n("+Ri(e+1)+") "+Pi(Oi(t))}),Oi=function(e){return f(Mi,e,vr)},Mi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=_i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Si(n)&&f($i,wi,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Ra,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ri(s)+"]",o=n,u=f(Ra,c,t);e=o,t=u;continue e;case"OneOf":var l=e.a;if(l.b){if(l.b.b){var d=function(){return t.b?"The Json.Decode.oneOf at json"+f(xi,"",La(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ri(Ii(l))+" ways:";return f(xi,"\n\n",f(Ra,h,f(Ni,Ui,l)))}var n=l.a,o=n,u=t;e=o,t=u;continue e}return"Ran into a Json.Decode.oneOf with no possibilities"+function(){return t.b?" at json"+f(xi,"",La(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(xi,"",La(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Pi(f(Di,4,g))+"\n\n")+p}}),Fi=en,Vi=tn,Ki=ae,Hi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},ji=An,qi={$:"Empty"},Gi=function(e){return{$:"Styled",a:e}},zi=function(e){return{$:"Text",a:e}},Wi=function(e){return{$:"Unstyled",a:e}},Yi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return Gi({html:r(function(t,r){return f(ji,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Wi(f(Ma,ji(e),a));case"Text":var i=t.a;return zi(i);default:return qi}}),Ji=Yi,Qi=r(function(e,t){return d(ba,t.noticeType,f(Ua,Ua(Ji(e)),t.mainParagraphs),t.align,t.label)}),Xi=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return ya(f(Qi,e,r));case"Web3Connect":return ma;case"GotoRoute":var n=t.a;return ga(n);case"GTag":var a=t.a;return pa(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(ha,i,o,u);default:return va}}),Zi=r(function(e,t){return f(Ua,Xi(e),t)}),eo={$:"EthDai"},to=function(e){return{$:"Native",a:e}},ro=function(e){return{$:"Token",a:e}},no={$:"XDai"},ao=M([ro(eo),to(no)]),io=function(e){var t=e.a;e.b,e.c;return t},oo=function(e){var t=(e.a,e.b);e.c;return t},uo=function(e){e.a,e.b;return e.c},so={$:"InitialBlank"},co=r(function(e,t){return t.b?l(Da,Ra,t,e):e}),fo=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=t.b;if(e(r))return!0;var a=e,i=n;e=a,t=i}}),lo=r(function(e,t){return f(fo,function(t){return $(t,e)},t)}),ho=r(function(e,t){return f(lo,e,t.userNotices)?t:D(t,{userNotices:f(co,t.userNotices,M([e]))})}),po=r(function(e,t){return l(_a,ho,t,e)}),go=Fa,vo={$:"Buyer"},yo={$:"Seller"},mo=r(function(e,t){return{options:t,type_:e}}),bo={$:"OfferType"},Co=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),Eo=r(function(e,t){return f(mo,bo,M([l(Co,"Buying",e,function(e){return $(e.parameters.initiatorRole,vo)}),l(Co,"Selling",t,function(e){return $(e.parameters.initiatorRole,yo)})]))}),So={$:"Closed"},To={$:"Committed"},wo={$:"Judgment"},Io={$:"Open"},Ao={$:"Phase"},Bo=a(function(e,t,r,n){return f(mo,Ao,M([l(Co,"Open",e,function(e){return $(e.state.phase,Io)}),l(Co,"Committed",t,function(e){return $(e.state.phase,To)}),l(Co,"Judgment",r,function(e){return $(e.state.phase,wo)}),l(Co,"Closed",n,function(e){return $(e.state.phase,So)})]))}),ko={$:"Initiator"},No={$:"Responder"},$o=r(function(e,t){if("Just"===t.$){return e(t.a)}return li}),Ro=r(function(e,t){return $(t,e.parameters.initiatorAddress)?fi(ko):f($o,function(e){return $(t,e)?fi(No):li},e.state.responder)}),xo=r(function(e,t){if("Just"===t.$){var r=t.a;return fi(e(r))}return li}),_o=r(function(e,t){return f(xo,function(t){var r=_(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return yo}r.a,r.b;return vo}if("Seller"===r.b.$){r.a,r.b;return vo}r.a,r.b;return yo},f(Ro,e,t))}),Lo={$:"Role"},Po=n(function(e,t,r){return f(mo,Lo,M([l(Co,"Buyer",t,function(t){return $(f(_o,t,e),fi(vo))}),l(Co,"Seller",r,function(t){return $(f(_o,t,e),fi(yo))})]))}),Do=function(e){return{orderBy:e}},Uo=Do,Oo={$:"Ascending"},Mo={$:"Phase"},Fo=Fe,Vo=Fo(vr),Ko=function(e){return{$:"Posix",a:e}},Ho=Ko,jo=r(function(e,t){return _({agentAddress:t,filters:go(M([d(Bo,!0,!0,!0,!1),f(Eo,!0,!0),l(Po,t,!0,!0)])),now:Ho(0),prices:vr,tradeTable:Uo(_(Mo,Oo)),wallet:e},Vo)}),qo=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Go={$:"None"},zo=Go,Wo=function(e){return d(qo,e,Vo,zo,vr)},Yo=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Wo(D(t,{wallet:r}))}return Wo(t)}),Jo=function(e){return{$:"PricesFetched",a:e}},Qo=function(e){return{$:"TradeTableMsg",a:e}},Xo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Zo=r(function(e,t){return f(Xo,e,t)}),eu=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),tu=n(function(e,t,r){return t(e(r))}),ru=r(function(e,t){if("None"===t.$)return Go;var r=t.a,n=t.b,a=l(eu,f(xo,Ma(e),r.onSign),f(xo,Ma(e),r.onBroadcast),f(xo,function(t){var r=t.a,n=t.b;return _(f(tu,r,e),f(xo,function(t){return{confirmations:t.confirmations,toMsg:f(tu,t.toMsg,e)}},n))},r.onMined));return f(Xo,a,n)}),nu=function(e){return{$:"AbiDecoder",a:e}},au=r(function(e,t){return{$:"Tape",a:e,b:t}}),iu=W,ou=Fr,uu=r(function(e,t){return e<1?t:l(ou,e,iu(t),t)}),su=uu(64),cu=n(function(e,t,r){return _(f(au,e,su(t)),r)}),fu=r(function(e,t){return e<1?"":l(ou,0,e,t)}),lu=fu(64),du=r(function(e,t){if("Ok"===t.$){var r=t.a;return hi(e(r))}var n=t.a;return di(n)}),hu=function(e){return-e},pu=r(function(e,t){return e<1?"":l(ou,-e,iu(t),t)}),gu=function(){var e=function(e){if(!f($i,Za(P("0")),f(fu,63,e)))return di("Boolean decode error. "+e+" is not 1 or 0.");switch(f(pu,1,e)){case"0":return hi(!1);case"1":return hi(!0);default:return di("Boolean decode error. "+e+" is not 1 or 0.")}};return nu(function(t){var r=t.a,n=t.b;return f(du,f(cu,r,n),e(lu(n)))})}(),vu=Hr,yu=function(e){return f(vu,"0x",e)||f(vu,"0X",e)?f(uu,2,e):e},mu=function(e){return e.b},bu=r(function(e,t){var r=e.a;return f(du,mu,r(function(e){return f(au,e,e)}(yu(t))))}),Cu=Zr,Eu=ie,Su=Jr,Tu=function(e){return f(Cu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Ki(n)}var a=r.a;return Eu(a)},Su)},wu=f(tu,bu,Tu),Iu=function(e){return{$:"Magnitude",a:e}},Au=function(e){return{$:"Pos",a:e}},Bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),ku=function(e){return{$:"MagnitudeNotNormalised",a:e}},Nu=function(e){e:for(;;){if(e.b){if(e.b.b){var t=e.b,r=t;e=r;continue e}var n=e.a;return fi(n)}return li}},$u=function(e){var t=Nu(e);return"Nothing"!==t.$&&t.a<0},Ru=function(e){return{$:"Neg",a:e}},xu={$:"Zer"},_u=function(e){return!e.b},Lu=r(function(e,t){var r=t.a;if(_u(r))return xu;switch(e.$){case"Zero":return xu;case"Positive":return Au(t);default:return Ru(t)}}),Pu=r(function(e,t){return f(Bu,e,ku(t))}),Du=function(e){return f(Da,r(function(t,r){return e(t)&&_u(r)?vr:f(Ra,t,r)}),vr)}(Za(0)),Uu=Tr,Ou=-1+f(Uu,10,7),Mu=Ou+1,Fu=r(function(e,t){var r=t.a,n=t.b;return _(e(r),n)}),Vu=function(e){return e<0?f(Fu,xa(-1),Vu(e+Mu)):_(e/Mu|0,e%Mu)},Ku=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Vu(r+e),i=a.a,o=a.b;return f(Ra,o,f(Ku,i,n))}{if(!(x(e,Mu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Hu=function(e){var t=e.a;return Iu(Du(f(Ku,0,t)))},ju=Ua(hu),qu={$:"Negative"},Gu={$:"Positive"},zu={$:"Zero"},Wu=function(e){switch(e.$){case"Positive":return qu;case"Negative":return Gu;default:return zu}},Yu=function(e){for(;;){var t=e.a,r=e.b,n=Hu(r),a=n.a;if(!$u(a))return f(Lu,t,Iu(a));e=f(Pu,Wu(t),ju(a))}},Ju=hr,Qu=function(e){switch(f(Ju,e,0).$){case"LT":return qu;case"GT":return Gu;default:return zu}},Xu=function(e){return e<0?-e:e},Zu=function(e){return Yu(f(Bu,Qu(e),ku(M([Xu(e)]))))},es=function(e){e:for(;;)switch(e.$){case"Zer":return 0;case"Pos":if(e.a.a.b){if(e.a.a.b.b){if(e.a.a.b.b.b)break e;var t=e.a.a,r=t.a,n=t.b,a=n.a;return a*f(Uu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},ts=function(e){switch(e.$){case"Zer":return xu;case"Neg":var t=e.a;return Au(t);default:return e}},rs=function(e){return{$:"MagnitudePair",a:e}},ns=r(function(e,t){var r=_(e,t);if(r.a.b){if(r.b.b){var n=r.a,a=n.a,i=n.b,o=r.b,u=o.a,s=o.b;return f(Ra,_(a,u),f(ns,i,s))}var c=r.a,a=c.a,i=c.b;return f(Ra,_(a,0),f(ns,i,vr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Ra,_(0,u),f(ns,vr,s))}return vr}),as=r(function(e,t){var r=e.a,n=t.a;return rs(f(ns,r,n))}),is=function(e){switch(e.$){case"Zer":return f(Pu,zu,vr);case"Neg":var t=e.a.a;return f(Pu,Gu,ju(t));default:var t=e.a.a;return f(Pu,Gu,t)}},os=r(function(e,t){var r=is(t),n=r.b,a=is(e),i=a.b,o=f(as,i,n),u=o.a,s=f(Ua,function(e){return e.a+e.b},u);return Yu(f(Bu,Gu,ku(s)))}),us=a(function(e,t,r,n){e:for(;;){var a=_(r,n);if(a.a.b){if(a.b.b){var i=a.a,o=i.a,u=i.b,s=a.b,c=s.a,l=s.b;if($(o,c)){var d=e,h=t,p=u,g=l;e=d,t=h,r=p,n=g;continue e}var d=o,h=c,p=u,g=l;e=d,t=h,r=p,n=g;continue e}return Aa}return a.b.b?Sa:f(Ju,e,t)}}),ss=function(e){switch(e.$){case"LT":return Aa;case"EQ":return Ea;default:return Sa}},cs=r(function(e,t){var r=_(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(us,0,0,n,a)}return Aa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return ss(d(us,0,0,n,a))}return Sa;default:switch(r.b.$){case"Pos":r.a;return Sa;case"Zer":r.a,r.b;return Ea;default:r.a;return Aa}}}),fs=r(function(e,t){return $(f(cs,e,t),Aa)}),ls=H,ds=r(function(e,t){return!f(fs,e,t)}),hs=function(e){switch(e.$){case"Zer":return Iu(vr);case"Pos":default:var t=e.a;return t}},ps=r(function(e,t){var r=e.a;return Hu(ku(f(Ua,ai(t),r)))}),gs=r(function(e,t){var r=e.a,n=t.a;if(r.b){if(r.b.b){var a=r.a,i=r.b,o=f(ps,Iu(n),a),u=f(gs,Iu(i),Iu(n)),s=u.a,c=f(os,f(Lu,Gu,o),f(Lu,Gu,Iu(f(Ra,0,s))));return hs(c)}var a=r.a;return f(ps,Iu(n),a)}return Iu(vr)}),vs=function(e){switch(e.$){case"Zer":return zu;case"Pos":return Gu;default:return qu}},ys=r(function(e,t){return $(e,zu)||$(t,zu)?zu:$(e,t)?Gu:qu}),ms=r(function(e,t){return f(Lu,f(ys,vs(e),vs(t)),f(gs,hs(e),hs(t)))}),bs=function(e){switch(e.$){case"Zer":return xu;case"Pos":var t=e.a;return Ru(t);default:var t=e.a;return Au(t)}},Cs=r(function(e,t){return f(os,e,bs(t))}),Es=Zu(0),Ss=a(function(e,t,r,n){if(e){var a=Zu(e),i=f(ms,f(ms,a,n),t),o=f(ds,i,r)?_(f(ms,a,t),f(Cs,r,i)):_(Es,r),u=o.a,s=o.b,c=d(Ss,e/2|0,t,s,n),l=c.a,h=c.b;return _(f(os,u,l),h)}return _(Es,r)}),Ts=Ha(f(ja,2,Ou)),ws=n(function(e,t,r){return d(Ss,f(Uu,2,Ts),e,t,r)}),Is=Zu(1),As=r(function(e,t){return e}),Bs=n(function(e,t,r){return l(_a,As(e),t,f(ki,1,r))}),ks=function(e){return l(Bs,ms(Zu(Mu)),Is,e)},Ns=n(function(e,t,r){if(e){var n=l(ws,ks(e),t,r),a=n.a,i=n.b,o=l(Ns,e-1,i,r),u=o.a,s=o.b;return _(f(os,a,u),s)}return l(ws,ks(e),t,r)}),$s=function(e){switch(e.$){case"Zer":return vr;case"Pos":default:var t=e.a.a;return t}},Rs=r(function(e,t){if($(t,Es))return li;var r=Ii($s(e))-Ii($s(t))+1,n=l(Ns,f(ni,0,r),ts(e),ts(t)),a=n.a,i=n.b;return fi(_(f(Lu,f(ys,vs(e),vs(t)),hs(a)),f(Lu,vs(e),hs(i))))}),xs=f(ms,Zu(2),Zu(2147483648)),_s=_r,Ls=function(e){return f(_s,e,"")},Ps=Dn,Ds=n(function(e,t,r){return e<=0?r:l(Ds,e>>1,U(t,t),1&e?U(r,t):r)}),Us=r(function(e,t){return l(Ds,e,t,"")}),Os=n(function(e,t,r){return U(f(Us,e-iu(r),Ls(t)),r)}),Ms=re,Fs=wr,Vs=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},Ks=r(function(e,t){for(;;){if(t<16)return f(Ra,Vs(t),e);var r=f(Ra,Vs(f(Fs,16,t)),e),n=t/16|0;e=r,t=n}}),Hs=function(e){return Ms(e<0?f(Ra,P("-"),f(Ks,vr,-e)):f(Ks,vr,e))},js=function(e){var t=f(Rs,e,xs);if("Nothing"===t.$)return"Failure converting BigInt to hex string. Should be impossible. Open up issue on the elm-bigint repo.";var r=t.a,n=r.a,a=r.b,i=Hs(es(a));return $(n,Zu(0))?i:U(js(n),l(Os,8,P("0"),i))},qs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Iu(vr))?"0":js(Au(t));default:var t=e.a;return"-"+qs(f(ms,Zu(-1),e))}},Gs=function(e){return l(Os,64,P("0"),e)},zs=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b,o=t.c;if("Just"===r.$){var u=r.a,s=Gs(Hs(a)),c=function(e){return U(e,n)}(Gs(Hs(u)));return L(a+32+(iu(n)/2|0),U(i,s),U(o,c))}return L(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(_a,t,L(32*Ii(e),"",""),e))},Ws=Dr,Ys=n(function(e,t,r){return t<128?f(e,t,r):t<2048?f(e,128|63&t,f(e,192|t>>>6,r)):t<65536?f(e,128|63&t,f(e,128|63&t>>>6,f(e,224|t>>>12,r))):f(e,128|63&t,f(e,128|63&t>>>6,f(e,128|63&t>>>12,f(e,240|t>>>18,r))))}),Js=n(function(e,t,n){return l(Ws,r(function(t,r){return l(Ys,e,bi(t),r)}),t,n)}),Qs=function(e){return La(l(Js,Ra,vr,e))},Xs=function(e){return f(xi,"",f(Ua,f(tu,Hs,f(Os,2,P("0"))),Qs(e)))},Zs=function(e){return 64-f(Fs,64,e)},ec=function(e){return U(e,f(Us,Zs(iu(e)),"0"))},tc=function(e){return _(fi(iu(e)/2|0),ec(e))},rc=function(e){return _(li,Gs(e))},nc=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},ac=function(e){switch(e.valueOf()){case"0":return"0000";case"1":return"0001";case"2":return"0010";case"3":return"0011";case"4":return"0100";case"5":return"0101";case"6":return"0110";case"7":return"0111";case"8":return"1000";case"9":return"1001";case"a":return"1010";case"b":return"1011";case"c":return"1100";case"d":return"1101";case"e":return"1110";case"f":return"1111";default:return"error converting hex to binary"}},ic=Ur,oc=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=_(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return _(f(_s,P("1"),r),!0);case"1":return _(f(_s,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return _(f(_s,P("0"),r),!1);case"1":return _(f(_s,P("1"),r),!0);default:break e}return _(r,!0)});return l(ic,t,_("",!1),e).a},uc=function(e){return l(ic,Ra,vr,e)},sc=n(function(e,t,r){for(;;){if(""===t)return La(r);var n=e,a=f(uu,e,t),i=f(Ra,l(ou,0,e,t),r);e=n,t=a,r=i}}),cc=r(function(e,t){return e&&""!==t?l(sc,e,t,vr):M([t])}),fc=function(e){var t=function(){var t=uc(qs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return _(r,f(tu,oc,f(Os,256,P("1"))))}var r=t;return _(r,f(Os,256,P("0")))}(),r=t.a,n=t.b;return Ms(f(Ua,nc,f(cc,4,n(f(xi,"",f(Ua,ac,r))))))},lc=function(e){return{$:"Hex",a:e}},dc=function(e){switch(e.$){case"AddressE":var t=e.a.a;return rc(t);case"UintE":var r=e.a;return rc(qs(r));case"IntE":var n=e.a;return rc(fc(n));case"BoolE":return rc(e.a?"1":"0");case"DBytesE":var a=e.a.a;return tc(a);case"BytesE":var a=e.a.a;return rc(yu(a));case"StringE":var i=e.a;return tc(Xs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return tc(t)}(Qt()(o));default:var i=e.a;return rc(yu(i))}};try{var hc=Qt();Qt=function(){return hc}}catch(e){throw"Some top-level definitions from `Abi.Encode` are causing infinite recursion:\n\n ┌─────┐\n │ abiEncodeList\n │ ↓\n │ lowLevelEncode\n └─────┘\n\nThese errors are very tricky, so read https://elm-lang.org/0.19.0/halting-problem to learn how to fix it!"}var pc=Lr,gc=function(e){return 1===iu(e)?f(pc,"0",e):e},vc=n(function(e,t,r){for(;;){if(e<=0)return r;{if(!t.b)return r;var n=t.a,a=t.b,i=e-1,o=a,u=f(Ra,n,r);e=i,t=o,r=u}}}),yc=r(function(e,t){return La(l(vc,e,t,vr))}),mc=n(function(e,t,r){if(t<=0)return vr;var n=_(t,r);e:for(;;){t:for(;;){if(!n.b.b)return r;if(!n.b.b.b){if(1===n.a)break e;break t}switch(n.a){case 1:break e;case 2:var a=n.b,i=a.a,o=a.b,u=o.a;return M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(Ra,i,f(Ra,u,f(Ra,h,f(Ra,m,f(yc,t-4,b))))):f(Ra,i,f(Ra,u,f(Ra,h,f(Ra,m,l(mc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),bc=r(function(e,t){return l(mc,0,e,t)}),Cc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Ec=function(e){switch(e.$){case"I8":return 1;case"I16":return 2;case"I32":return 4;case"U8":return 1;case"U16":return 2;case"U32":case"F32":return 4;case"F64":return 8;case"Seq":case"Utf8":var t=e.a;return t;default:return Ut(e.a)}},Sc={$:"LE"},Tc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,$(a,Sc));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,$(a,Sc));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,$(a,Sc));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,$(a,Sc));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,$(a,Sc));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,$(a,Sc));case"Seq":var i=e.b;return l(wc,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),wc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Tc,n,t,r);e=i,t=o,r=u}}),Ic=Ot,Ac=r(function(e,t){return{$:"Seq",a:e,b:t}}),Bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Ec(r),i=n;e=a,t=i}}),kc=function(e){return f(Ac,f(Bc,0,e),e)},Nc=function(e){return{$:"U8",a:e}},$c=Nc,Rc=r(function(e,t){return x(e,t)<0?e:t}),xc=dr,_c=function(e){return{$:"Bytes",a:e}},Lc=_c,Pc=function(e){return Ic(kc(f(Ua,Lc,La(e))))},Dc=Ut,Uc=r(function(e,t){var r=e.a;return f(Wn,r,t)}),Oc=function(e){return{$:"Decoder",a:e}},Mc=a(function(e,t,r,n){for(;;){var a=t(e),i=a.a,o=f(i,r,n),u=o.a,s=o.b;if("Loop"!==s.$){return _(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),Fc=r(function(e,t){return Oc(f(Mc,e,t))}),Vc=Oc(Yn),Kc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Hc=function(e){return{$:"Done",a:e}},jc=function(e){return{$:"Loop",a:e}},qc=r(function(e,t){var n=t.a;return Oc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return _(i,e(o))}))}),Gc=function(e){return Oc(r(function(t,r){return _(r,e)}))},zc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Gc(Hc(La(n))):f(qc,function(e){return jc(_(r-1,f(Ra,e,n)))},e)}),Wc=function(e){return f(Kc,vr,f(Uc,f(Fc,_(Dc(e),vr),zc(Vc)),e))},Yc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return _(f(e,n,i),f(e,a,o))}),Jc=r(function(e,t){return l(Yc,Ps,e,t)}),Qc=f(ki,0,4),Xc=r(function(e,t){var r=t.d0,n=t.d1,a=t.d2,i=t.d3,o=t.d4;switch(e){case 0:return r;case 1:return n;case 2:return a;case 3:return i;default:return o}}),Zc=Dt,ef=r(function(e,t){var r=t.a,n=t.b;return _(e(r),e(n))}),tf=function(e){return f(ef,f(tu,Zc,Ps(4294967295)),e)},rf=r(function(e,t){return 5*t+e}),nf=4294967295>>>32-Ga,af=nr,of=n(function(e,t,r){for(;;){var n=nf&t>>>e,a=f(af,n,r);if("SubTree"!==a.$){var i=a.a;return f(af,nf&t,i)}var o=a.a,u=e-Ga,s=t,c=o;e=u,t=s,r=c}}),uf=function(e){return e>>>5<<5},sf=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||x(e,r)>-1?li:fi(x(e,uf(r))>-1?f(af,nf&e,i):l(of,n,e,a))}),cf=r(function(e,t){var r=f(sf,e,t);if("Just"===r.$){return r.a}return _(0,0)}),ff=n(function(e,t,r){var n=f(rf,e,t);return f(cf,n,r)}),lf=ar,df=a(function(e,t,r,n){var a=nf&t>>>e,i=f(af,a,n);if("SubTree"===i.$){var o=i.a,u=d(df,e-Ga,t,r,o);return l(lf,a,Ja(u),n)}var s=i.a,c=l(lf,nf&t,r,s);return l(lf,a,Ya(c),n)}),hf=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||x(e,n)>-1?r:x(e,uf(n))>-1?d(Ka,n,a,i,l(lf,nf&e,t,o)):d(Ka,n,a,d(df,a,e,t,i),o)}),pf=n(function(e,t,r){return l(hf,e,t,r)}),gf=a(function(e,t,r,n){var a=f(rf,e,t);return l(pf,a,r,n)}),vf=Un,yf=r(function(e,t){return l(Yc,vf,e,t)}),mf=function(e){var t=l(Da,r(function(t,n){var a={d0:l(ff,0,t,e.state),d1:l(ff,1,t,e.state),d2:l(ff,2,t,e.state),d3:l(ff,3,t,e.state),d4:l(ff,4,t,e.state)},i=r(function(e,r){return d(gf,e,t,f(yf,f(Xc,e,a),f(Jc,tf(f(Xc,f(Fs,5,e+1),a)),f(Xc,f(Fs,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Qc);return D(e,{state:t})},bf=_(0,0),Cf=function(e){return{current:bf,lfsrstate:1,state:e,x:1,y:0}},Ef=function(e){var t=1&e;return 128&e?_(t,e<<1^113):_(t,e<<1)},Sf=_(1,0),Tf=r(function(e,t){var r=t.a,n=t.b;return e?_(n,r):_(r,n)}),wf=r(function(e,t){if(e){var n=f(Tf,1,t);return l(Yc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),If=r(function(e,t){var r=f(Fs,32,e/32|0),n=f(Tf,r,t),a=f(Fs,32,e);return f(wf,a,n)}),Af=n(function(e,t,r){var n=f(sf,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(hf,e,t(a),r)}),Bf=n(function(e,t,r){return l(Af,e,yf(t),r)}),kf=a(function(e,t,r,n){var a=f(rf,e,t);return l(Bf,a,r,n)}),Nf=function(e){return l(_a,r(function(e,t){var r=(1<>r}),Uf=n(function(e,t,r){return t?_(0,r<0))return t;var a=f(Rc,n,r),i=f(Ua,function(e){return f(Df,e,g)},f(ki,0,a)),o=Pf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(bc,i.outputLen,l(v,g,vr,i.outputLen))},Vf=function(e){return{$:"KS",a:e}},Kf=function(e){var t=e.a;return Vf({config:t,inputLength:0,partial:vr,state:f(ci,25,As(bf))})},Hf=function(e){return Oc(Jn(e))},jf=Ic(kc(vr)),qf=r(function(e,t){var n=t.a;return Oc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Gf=r(function(e,t){return f(qf,function(e){return Hf(t)},Hf(e))}),zf=r(function(e,t){return f(Kc,jf,f(Uc,f(Gf,e,Dc(t)-e),t))}),Wf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Dc(e)?f(Ra,e,n.partial):n.partial;if(!(x(l(_a,r(function(e,t){return t+Dc(e)}),0,i),a)>-1))return Vf(D(n,{inputLength:Dc(e)+n.inputLength,partial:i}));var o=Pc(i),u=f(Kc,jf,f(Uc,Hf(a),o)),s=Wc(u),c=f(Mf,s,n.state),d=Pf(c),h=f(zf,a,o),p=jf,g=Vf(D(n,{inputLength:Dc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Yf=r(function(e,t){return Ff(f(Wf,Ic(kc(f(Ua,$c,t))),Kf(e)))}),Jf=Yf(Cc),Qf=function(e){return lc(f(xi,"",f(Ua,f(tu,Hs,gc),f(bc,4,Jf(f(Ua,bi,uc(e)))))))},Xf=function(e){return f(vu,"0x",e)||f(vu,"0X",e)?e:"0x"+e},Zf=function(e){var t=e.a;return Xf(t)},el=r(function(e,t){var r=zs(f(Ua,dc,t)),n=function(e){return U(e,r)}(yu(Zf(Qf(e))));return lc(n)}),tl=function(e){return{data:fi(f(el,"poke()",vr)),decoder:wu(gu),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},rl=r(function(e,t){return D(t,{checked:e})}),nl=n(function(e,t,r){return f(Ua,function(r){return e(r)?t(r):r},r)}),al=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(nl,f(tu,function(e){return e.type_},Za(r)),function(e){return D(e,{options:l(nl,f(tu,function(e){return e.label},Za(n)),rl(a),e.options)})},t)}),il=function(e){return e.a},ol=r(function(e,t){return f(Ju,il(e),il(t))}),ul=r(function(e,t){return Ho(il(e)-il(t))}),sl=function(e){return{$:"Ok",a:e}},cl={$:"Outdated"},fl=r(function(e,t){return $(f(ol,f(ul,e,t.timestamp),Ho(6e5)),Aa)?cl:sl(t.price)}),ll=r(function(e,t){return{price:e,timestamp:t}}),dl=r(function(e,t){return _(e,t)}),hl=Qr,pl=Wr,gl=n(function(e,t,r){return{col:t,problem:r,row:e}}),vl=function(e){return l(gl,e.row,e.col,e.problem)},yl=r(function(e,t){e:for(;;)switch(e.$){case"Empty":return t;case"AddRight":var r=e.a,n=e.b,a=r,i=f(Ra,n,t);e=a,t=i;continue e;default:var r=e.a,o=e.b,a=r,i=f(yl,o,t);e=a,t=i;continue e}}),ml=r(function(e,t){var r=e.a,n=r({col:1,context:vr,indent:1,offset:0,row:1,src:t});if("Good"===n.$){var a=n.b;return hi(a)}var i=n.b;return di(f(yl,i,vr))}),bl=r(function(e,t){var r=f(ml,e,t);if("Ok"===r.$){var n=r.a;return hi(n)}var a=r.a;return di(f(Ua,vl,a))}),Cl=r(function(e,t){return{$:"Bad",a:e,b:t}}),El=n(function(e,t,r){return{$:"Good",a:e,b:t,c:r}}),Sl=function(e){return{$:"Parser",a:e}},Tl=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Cl,a,i)}var o=n.a,u=n.b,s=n.c,c=e(u),d=c.a,h=d(s);if("Bad"===h.$){var p=h.a,i=h.b;return f(Cl,o||p,i)}var p=h.a,g=h.b,v=h.c;return l(El,o||p,g,v)})}),wl=Tl,Il={$:"ExpectingEnd"},Al=r(function(e,t){return{$:"AddRight",a:e,b:t}}),Bl=a(function(e,t,r,n){return{col:t,contextStack:n,problem:r,row:e}}),kl={$:"Empty"},Nl=r(function(e,t){return f(Al,kl,d(Bl,e.row,e.col,t,e.context))}),$l=function(e){return Sl(function(t){return $(iu(t.src),t.offset)?l(El,!1,pr,t):f(Cl,!1,f(Nl,t,e))})}(Il),Rl=n(function(e,t,r){var n=t.a,a=r.a;return Sl(function(t){var r=n(t);if("Bad"===r.$){var i=r.a,o=r.b;return f(Cl,i,o)}var u=r.a,s=r.b,c=r.c,d=a(c);if("Bad"===d.$){var h=d.a,o=d.b;return f(Cl,u||h,o)}var h=d.a,p=d.b,g=d.c;return l(El,u||h,f(e,s,p),g)})}),xl=r(function(e,t){return l(Rl,As,e,t)}),_l=xl,Ll=r(function(e,t){return l(Rl,Oa,e,t)}),Pl=Ll,Dl=r(function(e,t){return{$:"Append",a:e,b:t}}),Ul=n(function(e,t,r){for(;;){if(!r.b)return f(Cl,!1,t);var n=r.a.a,a=r.b,i=n(e);if("Good"===i.$){var o=i;return o}var o=i,u=o.a,s=o.b;if(u)return o;var c=e,l=f(Dl,t,s),d=a;e=c,t=l,r=d}}),Ol=function(e){return Sl(function(t){return l(Ul,t,kl,e)})},Ml=Ol,Fl=function(e){return Sl(function(t){return l(El,!1,e,t)})},Vl=Fl,Kl=function(e){return{$:"ExpectingSymbol",a:e}},Hl=r(function(e,t){return{$:"Token",a:e,b:t}}),jl=function(e){return""===e},ql=Qn,Gl=function(e){var t=e.a,r=e.b,n=!jl(t);return Sl(function(e){var a=h(ql,t,e.offset,e.row,e.col,e.src),i=a.a,o=a.b,u=a.c;return $(i,-1)?f(Cl,!1,f(Nl,e,r)):l(El,n,pr,{col:u,context:e.context,indent:e.indent,offset:i,row:o,src:e.src})})},zl=Gl,Wl=function(e){return zl(f(Hl,e,Kl(e)))},Yl=$r,Jl=te,Ql=Xn,Xl=i(function(e,t,r,n,a){for(;;){var i=l(Ql,e,t,a.src);if($(i,-1))return l(El,x(a.offset,t)<0,pr,{col:n,context:a.context,indent:a.indent,offset:t,row:r,src:a.src});if($(i,-2)){var o=e,u=t+1,s=r+1,c=1,f=a;e=o,t=u,r=s,n=c,a=f}else{var o=e,u=i,s=r,c=n+1,f=a;e=o,t=u,r=s,n=c,a=f}}}),Zl=function(e){return Sl(function(t){return h(Xl,e,t.offset,t.row,t.col,t)})},ed=Zl,td=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Bad"===n.$){var a=n.a,i=n.b;return f(Cl,a,i)}var a=n.a,o=n.b,u=n.c;return l(El,a,f(e,l(ou,t.offset,u.offset,t.src),o),u)})}),rd=function(e){return f(td,As,e)},nd=rd,ad=function(e){return{$:"Problem",a:e}},id=function(e){return Sl(function(t){return f(Cl,!1,f(Nl,t,e))})},od=function(e){return id(ad(e))},ud=f(wl,function(e){if(iu(e)<=9){var t=Jl("0."+e);if("Just"===t.$){var r=t.a;return Vl(Yl(1e3*r))}return od('Invalid float: "'+e+'"')}return od("Expected at most 9 digits, but got "+Ri(iu(e)))},nd(ed(Ti))),sd=o(function(e,t,r,n,a,i){return Ho(e+60*t*60*1e3+60*(r-i)*1e3+1e3*n+a)}),cd=ee,fd=function(e){return{$:"Done",a:e}},ld=function(e){return{$:"Loop",a:e}},dd={$:"UnexpectedChar"},hd=r(function(e,t){return Sl(function(r){var n=l(Ql,e,r.offset,r.src);return $(n,-1)?f(Cl,!1,f(Nl,r,t)):$(n,-2)?l(El,!0,pr,{col:1,context:r.context,indent:r.indent,offset:r.offset+1,row:r.row+1,src:r.src}):l(El,!0,pr,{col:r.col+1,context:r.context,indent:r.indent,offset:n,row:r.row,src:r.src})})}),pd=function(e){return f(hd,e,dd)},gd=r(function(e,t){var r=t.a;return Sl(function(t){var n=r(t);if("Good"===n.$){var a=n.a,i=n.b,o=n.c;return l(El,a,e(i),o)}var a=n.a,u=n.b;return f(Cl,a,u)})}),vd=gd,yd=function(e){return{$:"Done",a:e}},md=function(e){return{$:"Loop",a:e}},bd=function(e){if("Loop"===e.$){var t=e.a;return md(t)}var r=e.a;return yd(r)},Cd=a(function(e,t,r,n){e:for(;;){var a=r(t),i=a.a,o=i(n);if("Good"===o.$){var u=o.a,s=o.b,c=o.c;if("Loop"===s.$){var d=s.a,h=e||u,p=d,g=r,v=c;e=h,t=p,r=g,n=v;continue e}var y=s.a;return l(El,e||u,y,c)}var u=o.a,m=o.b;return f(Cl,e||u,m)}}),Ed=r(function(e,t){return Sl(function(r){return d(Cd,!1,e,t,r)})}),Sd=r(function(e,t){return f(Ed,e,function(e){return f(vd,bd,t(e))})}),Td=function(e){return f(Sd,"",function(t){if($(iu(t),e)){var r=cd(t);if("Just"===r.$){var n=r.a;return f(vd,fd,Vl(n))}return od('Invalid integer: "'+t+'"')}return f(vd,function(e){return ld(f(pc,t,e))},nd(pd(Ti)))})},wd=function(e){return od("Invalid day: "+Ri(e))},Id=function(e){return!f(Fs,4,e)&&(f(Fs,100,e)||!f(Fs,400,e))},Ad=function(e){var t=e-1;return(t/4|0)-(t/100|0)+(t/400|0)},Bd=function(e){var t=e.a,r=e.b,n=e.c;if(n<0)return wd(n);var a=function(e){var a=31536e6*(t-1970),i=r<3||!Id(t)?n-1:n,o=864e5*(i+(Ad(t)-Ad(1970)));return Vl(e+a+o)};switch(r){case 1:return n>31?wd(n):a(0);case 2:return n>29||29===n&&!Id(t)?wd(n):a(26784e5);case 3:return n>31?wd(n):a(50976e5);case 4:return n>30?wd(n):a(7776e6);case 5:return n>31?wd(n):a(10368e6);case 6:return n>30?wd(n):a(130464e5);case 7:return n>31?wd(n):a(156384e5);case 8:return n>31?wd(n):a(183168e5);case 9:return n>30?wd(n):a(209952e5);case 10:return n>31?wd(n):a(235872e5);case 11:return n>30?wd(n):a(262656e5);case 12:return n>31?wd(n):a(288576e5);default:return od('Invalid month: "'+Ri(r)+'"')}},kd=f(wl,Bd,f(Pl,f(Pl,f(Pl,Vl(n(function(e,t,r){return L(e,t,r)})),Td(4)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl("-")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl("-")),Td(2)),Td(2)])))),Nd=function(){var e=n(function(e,t,r){return e*(60*t)+r});return f(Pl,Vl(Fa),Ml(M([f(vd,function(e){return 0},Wl("Z")),f(Pl,f(Pl,f(Pl,Vl(e),Ml(M([f(vd,function(e){return 1},Wl("+")),f(vd,function(e){return-1},Wl("-"))]))),Td(2)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2),Vl(0)]))),f(_l,Vl(0),$l)])))}(),$d=f(wl,function(e){return Ml(M([f(Pl,f(Pl,f(Pl,f(Pl,f(Pl,f(_l,Vl(sd(e)),Wl("T")),Td(2)),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(":")),Td(2)),Td(2)]))),Ml(M([f(Pl,f(_l,Vl(Fa),Wl(".")),ud),Vl(0)]))),f(_l,Nd,$l)),f(_l,Vl(p(sd,e,0,0,0,0,0)),$l)]))},kd),Rd=function(e){return f(bl,$d,e)},xd=f(Cu,function(e){var t=Rd(e);if("Err"===t.$){t.a;return Eu("TODO deadEndsToString")}var r=t.a;return Ki(r)},Su),_d=l(Vi,dl,f(hl,"symbol",Su),f(hl,"quote",f(hl,"USD",l(Vi,ll,f(hl,"price",pl),f(hl,"last_updated",xd))))),Ld=function(e){return l(Ba,n(function(e,t,r){return f(Ra,t,r)}),vr,e)},Pd={$:"RBEmpty_elm_builtin"},Dd=Pd,Ud={$:"Black"},Od=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Md={$:"Red"},Fd=i(function(e,t,r,n,a){if("RBNode_elm_builtin"===a.$&&"Red"===a.a.$){var i=(a.a,a.b),o=a.c,u=a.d,s=a.e;if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var c=(n.a,n.b),f=n.c,l=n.d,d=n.e;return h(Od,Md,t,r,h(Od,Ud,c,f,l,d),h(Od,Ud,i,o,u,s))}return h(Od,e,i,o,h(Od,Md,t,r,n,u),s)}if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$&&"RBNode_elm_builtin"===n.d.$&&"Red"===n.d.a.$){var c=(n.a,n.b),f=n.c,p=n.d,g=(p.a,p.b),v=p.c,y=p.d,m=p.e,d=n.e;return h(Od,Md,c,f,h(Od,Ud,g,v,y,m),h(Od,Ud,t,r,d,a))}return h(Od,e,t,r,n,a)}),Vd=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Od,Md,e,t,Pd,Pd);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ju,e,a).$){case"LT":return h(Fd,n,a,i,l(Vd,e,t,o),u);case"EQ":return h(Od,n,a,t,o,u);default:return h(Fd,n,a,i,o,l(Vd,e,t,u))}}),Kd=n(function(e,t,r){var n=l(Vd,e,t,r);if("RBNode_elm_builtin"===n.$&&"Red"===n.a.$){var a=(n.a,n.b),i=n.c,o=n.d,u=n.e;return h(Od,Ud,a,i,o,u)}return n}),Hd=function(e){return l(_a,r(function(e,t){var r=e.a,n=e.b;return l(Kd,r,n,t)}),Dd,e)},jd=ce,qd=f(Fi,Ld,function(e){return f(Fi,Hd,jd(e))}(_d)),Gd=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return li;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ju,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return fi(n);default:var u=e,s=i;e=u,t=s;continue e}}}),zd=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Wd=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.e.d.$&&"Red"===e.e.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=a.e,c=e.e,f=(c.a,c.b),l=c.c,d=c.d,p=(d.a,d.b),g=d.c,v=d.d,y=d.e,m=c.e;return h(Od,Md,p,g,h(Od,Ud,r,n,h(Od,Md,i,o,u,s),v),h(Od,Ud,f,l,y,m))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,u=b.d,s=b.e,C=e.e,f=(C.a,C.b),l=C.c,d=C.d,m=C.e;return t.$,h(Od,Ud,r,n,h(Od,Md,i,o,u,s),h(Od,Md,f,l,d,m))}return e},Yd=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$&&"RBNode_elm_builtin"===e.e.$){if("RBNode_elm_builtin"===e.d.d.$&&"Red"===e.d.d.a.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=(a.a,a.b),o=a.c,u=a.d,s=(u.a,u.b),c=u.c,f=u.d,l=u.e,d=a.e,p=e.e,g=(p.a,p.b),v=p.c,y=p.d,m=p.e;return h(Od,Md,i,o,h(Od,Ud,s,c,f,l),h(Od,Ud,r,n,d,h(Od,Md,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Od,Ud,r,n,h(Od,Md,i,o,C,d),h(Od,Md,g,v,y,m))}return e},Jd=u(function(e,t,r,n,a,i,o){if("RBNode_elm_builtin"===i.$&&"Red"===i.a.$){var u=(i.a,i.b),s=i.c,c=i.d,f=i.e;return h(Od,r,u,s,c,h(Od,Md,n,a,f,o))}e:for(;;){if("RBNode_elm_builtin"===o.$&&"Black"===o.a.$){if("RBNode_elm_builtin"===o.d.$){if("Black"===o.d.a.$){var l=(o.a,o.d);l.a;return Yd(t)}break e}o.a,o.d;return Yd(t)}break e}return t}),Qd=function(e){if("RBNode_elm_builtin"===e.$&&"RBNode_elm_builtin"===e.d.$){var t=e.a,r=e.b,n=e.c,a=e.d,i=a.a,o=a.d,u=e.e;if("Black"===i.$){if("RBNode_elm_builtin"===o.$&&"Red"===o.a.$){o.a;return h(Od,t,r,n,Qd(a),u)}var s=Wd(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Fd,c,f,l,Qd(d),p)}return Pd}return h(Od,t,r,n,Qd(a),u)}return Pd},Xd=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Pd;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(x(e,n)<0){if("RBNode_elm_builtin"===i.$&&"Black"===i.a.$){var u=(i.a,i.d);if("RBNode_elm_builtin"===u.$&&"Red"===u.a.$){u.a;return h(Od,r,n,a,f(Xd,e,i),o)}var s=Wd(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Fd,c,l,d,f(Xd,e,p),v)}return Pd}return h(Od,r,n,a,f(Xd,e,i),o)}return f(Zd,e,g(Jd,e,t,r,n,a,i,o))}),Zd=r(function(e,t){if("RBNode_elm_builtin"===t.$){var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if($(e,n)){var u=zd(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Fd,r,s,c,i,Qd(o))}return Pd}return h(Fd,r,n,a,i,f(Xd,e,o))}return Pd}),eh=r(function(e,t){var r=f(Xd,e,t);if("RBNode_elm_builtin"===r.$&&"Red"===r.a.$){var n=(r.a,r.b),a=r.c,i=r.d,o=r.e;return h(Od,Ud,n,a,i,o)}return r}),th=n(function(e,t,r){var n=t(f(Gd,e,r));if("Just"===n.$){var a=n.a;return l(Kd,e,a,r)}return f(eh,e,r)}),rh=function(e){return"Just"===e.$},nh=vn,ah=yn,ih=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),oh=function(e){return{$:"BadUrl_",a:e}},uh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),sh={$:"NetworkError_"},ch=function(e){return{$:"Receiving",a:e}},fh=function(e){return{$:"Sending",a:e}},lh={$:"Timeout_"},dh=ra,hh=r(function(e,t){if("Ok"===t.$){var r=t.a;return hi(r)}var n=t.a;return di(e(n))}),ph=r(function(e,t){return l(ea,"",Fa,f(tu,t,e))}),gh=function(e){return{$:"BadBody",a:e}},vh=function(e){return{$:"BadStatus",a:e}},yh=function(e){return{$:"BadUrl",a:e}},mh={$:"NetworkError"},bh={$:"Timeout"},Ch=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return di(yh(r));case"Timeout_":return di(bh);case"NetworkError_":return di(mh);case"BadStatus_":var n=t.a;return di(vh(n.statusCode));default:var a=t.b;return f(hh,gh,e(a))}}),Eh=nn,Sh=r(function(e,t){return f(ph,e,Ch(function(e){return f(hh,Oi,f(Eh,t,e))}))}),Th=function(e){return{$:"Request",a:e}},wh=we,Ih=r(function(e,t){return{reqs:e,subs:t}}),Ah=wh(f(Ih,Dd,vr)),Bh=cn,kh=Re,Nh=Ne,$h=n(function(e,t,r){e:for(;;){if(t.b){var n=t.a,a=t.b;if("Cancel"===n.$){var i=n.a,o=f(Gd,i,r);if("Nothing"===o.$){var u=e,s=a,c=r;e=u,t=s,r=c;continue e}var d=o.a;return f(Bh,function(t){return l($h,e,a,f(eh,i,r))},kh(d))}var h=n.a;return f(Bh,function(t){var n=h.tracker;if("Nothing"===n.$)return l($h,e,a,r);var i=n.a;return l($h,e,a,l(Kd,i,t,r))},Nh(l(Zn,e,nh(e),h)))}return wh(r)}}),Rh=a(function(e,t,r,n){return f(Bh,function(e){return wh(f(Ih,e,r))},l($h,e,t,n.reqs))}),xh=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Ra,a,r)}return r}),_h=r(function(e,t){return l(Da,xh(e),vr,t)}),Lh=n(function(e,t,r){return f(Bh,function(t){return f(Bh,function(r){return wh(f(e,t,r))},r)},t)}),Ph=function(e){return l(Da,Lh(Ra),wh(vr),e)},Dh=a(function(e,t,r,n){var a=n.a,i=n.b;return $(t,a)?fi(f(nh,e,i(r))):li}),Uh=n(function(e,t,r){var n=t.a,a=t.b;return f(Bh,function(e){return wh(r)},Ph(f(_h,l(Dh,e,n,a),r.subs)))}),Oh=function(e){return{$:"Cancel",a:e}},Mh=r(function(e,t){if("Cancel"===t.$){var r=t.a;return Oh(r)}var n=t.a;return Th({allowCookiesFromOtherDomains:n.allowCookiesFromOtherDomains,body:n.body,expect:f(ta,e,n.expect),headers:n.headers,method:n.method,timeout:n.timeout,tracker:n.tracker,url:n.url})}),Fh=r(function(e,t){return{$:"MySub",a:e,b:t}}),Vh=r(function(e,t){var r=t.a,n=t.b;return f(Fh,r,f(tu,n,e))});gn.Http=Ue(Ah,Rh,Uh,Mh,Vh);var Kh=Me("Http"),Hh=(Me("Http"),function(e){return Kh(Th({allowCookiesFromOtherDomains:!1,body:e.body,expect:e.expect,headers:e.headers,method:e.method,timeout:e.timeout,tracker:e.tracker,url:e.url}))}),jh=function(e){return Hh({body:dh,expect:f(Sh,e,qd),headers:vr,method:"GET",timeout:li,tracker:li,url:"https://daihard.exchange/prices.json"})},qh=r(function(e,t){return{$:"Trade",a:e,b:t}}),Gh=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),zh={$:"Descending"},Wh=function(e){return"Ascending"===e.$?zh:Oo},Yh=function(e){return d(Gh,e,Vo,zo,vr)},Jh=r(function(e,t){return _(t.a,e(t.b))}),Qh=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Gh,t,Vo,zo,M([ga(f(qh,r,n))]));case"ChangeSort":var a=e.a,i=$(t.orderBy.a,a)?f(Jh,Wh,t.orderBy):_(a,Oo);return Yh(D(t,{orderBy:i}));default:return Yh(t)}}),Xh={$:"BottomRight"},Zh={$:"Caution"},ep=function(e){return zi(e)},tp={align:Xh,label:"cantFetchPrices",mainParagraphs:M([M([ep("Error encountered fetching crypto prices.")])]),noticeType:Zh},rp=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},np=mn,ap=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=rp(tl(r)),a={onBroadcast:li,onMined:li,onSign:li},i=f(Zo,a,n);return d(qo,t,Vo,i,vr);case"TradeClicked":var o=e.a,u=e.b;return d(qo,t,Vo,zo,M([ga(f(qh,o,u))]));case"FiltersMsg":var s=e.a;return Wo(D(t,{filters:f(al,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(Qh,c,t.tradeTable);return d(qo,D(t,{tradeTable:l.model}),f(np,Qo,l.cmd),f(ru,Qo,l.chainCmd),f(Ua,Xi(Qo),l.cmdUps));case"UpdateNow":var h=e.a;return Wo(D(t,{now:h}));case"PricesFetched":var p=e.a;if("Ok"===p.$){var g=p.a,v=f(Ua,Jh(fl(t.now)),g);return Wo(D(t,{prices:v}))}p.a;return d(qo,t,Vo,zo,M([ya(tp)]));case"Refresh":return d(qo,t,jh(Jo),zo,vr);default:return Wo(t)}}),ip={$:"ShouldBeImpossible"},op=fr,up=r(function(e,t){f(op,e,t);return{align:Xh,label:"unexpectedError",mainParagraphs:M([M([ep(e)])]),noticeType:ip}}),sp=function(e){var t=e.a;return Xf(t)},cp=be,fp=f(tu,sp,cp),lp=f(tu,qs,f(tu,Xf,cp)),dp=f(tu,Zf,cp),hp=f(tu,Hs,f(tu,Xf,cp)),pp=r(function(e,t){return l(Da,r(function(t,r){return e(t)?f(Ra,t,r):r}),vr,t)}),gp=sn,vp=function(e){return be(l(_a,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},yp=function(e){return vp(f(Ua,function(e){var t=e.a,r=e.b;return _(t,f(Kc,gp,r))},f(pp,function(e){e.a;return!$(e.b,li)},e)))},mp=function(e){return yp(M([_("to",f(xo,fp,e.to)),_("from",f(xo,fp,e.from)),_("gas",f(xo,hp,e.gas)),_("gasPrice",f(xo,lp,e.gasPrice)),_("value",f(xo,lp,e.value)),_("data",f(xo,dp,e.data)),_("nonce",f(xo,hp,e.nonce))]))},bp=function(e){return{$:"TxSentry",a:e}},Cp=be,Ep=r(function(e,t){return vp(M([_("ref",Cp(e)),_("txParams",t)]))}),Sp=function(e){return{$:"Signing",a:e}},Tp=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Sp(e)}}),wp=n(function(e,t,r){var n=e.a,a=mp(r),i=l(Kd,n.ref,f(Tp,r,t),n.txs);return _(bp(D(n,{ref:n.ref+1,txs:i})),f(np,n.tagger,n.outPort(f(Ep,n.ref,a))))}),Ip=wp,Ap=r(function(e,t){var r=_(e,t);if("None"===r.b.$){r.b;return L(e,Vo,vr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return L(fi(t),r,vr)}(l(Ip,n,i,o))}return L(li,Vo,M([f(up,"submodel sent chainCmd, but there is no txSentry to use!",li)]))}),Bp={$:"CloseAnyDropdownsOrModals"},kp=function(e){return{$:"UpdateWallet",a:e}},Np=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),$p=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Rp=function(e){return"CryptoSwap"===e.$?"ZEC":"USD"},xp={$:"Day"},_p={$:"Hour"},Lp=r(function(e,t){return{num:e,unit:t}}),Pp=function(e){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return L(f(Lp,24,_p),f(Lp,1,_p),f(Lp,24,_p))}e.a;return L(f(Lp,24,_p),f(Lp,24,_p),f(Lp,24,_p));case"OffRamp":default:return L(f(Lp,3,xp),f(Lp,3,xp),f(Lp,3,xp))}},Dp=function(e){return{$:"CryptoSwap",a:e}},Up=function(e){return{$:"DHToken",a:e}},Op=function(e){return{$:"External",a:e}},Mp={$:"OffRamp"},Fp={$:"OnRamp"},Vp={$:"KovanDai"},Kp=function(e){e:for(;;)switch(e.$){case"Mainnet":return fi(ro(eo));case"Kovan":return fi(ro(Vp));case"Private":if(100===e.a)return fi(to(no));break e;default:break e}return li},Hp=function(e){switch(e.$){case"NoneDetected":return li;case"OnlyNetwork":var t=e.a;return fi(t);default:var r=e.a;return fi(r.network)}},jp=function(e){return f($o,Kp,Hp(e))},qp=r(function(e,t){var r=Op("USD"),n=Up(f(Kc,to(no),jp(e))),a=Op("ZEC");return _($(t,Dp(yo))||$(t,Mp)?n:$(t,Dp(vo))?a:r,$(t,Dp(vo))||$(t,Fp)?n:$(t,Dp(yo))?a:r)}),Gp={$:"Even"},zp=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return{amountIn:e,amountOut:r,currencySearch:a,inType:t,interval:c,margin:i,marginType:o,outType:n,paymentMethod:s,receiveAddress:u}}}}}}}}}}},Wp=r(function(e,t){return zp("")(f(qp,e,t).a)("")(f(qp,e,t).b)("")("0")(Gp)("")("")("")}),Yp=a(function(e,t,r,n){return pa(d(Np,e,t,r,n))}),Jp=function(e){return"Buyer"===e.$?"Buyer":"Seller"},Qp=function(e){switch(e.$){case"Expiry":return"Expiry";case"Payment":return"Payment";default:return"Judgment"}},Xp=function(e){return{$:"Address",a:e}},Zp=X,eg=f(tu,yu,f(tu,Zp,Xp)),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return eg("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return eg("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return eg("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return eg("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return eg("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},rg=function(e){return eg("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ng=function(e){return{$:"AddressE",a:e}},ag=ng,ig=function(e){return{$:"UintE",a:e}},og=ig,ug=n(function(e,t,r){return{data:fi(f(el,"approve(address,uint256)",M([ag(t),og(r)]))),decoder:wu(gu),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),sg=function(e){return{$:"TokenValue",a:e}},cg=function(e){return e.a},fg=r(function(e,t){return f(Kc,Es,f(xo,ei,f(Rs,e,t)))}),lg=r(function(e,t){return sg(f(fg,cg(e),Zu(t)))}),dg=function(e){return f(lg,e,12)},hg=function(e){return f(lg,e,3)},pg=sg(Zu(0)),gg=r(function(e,t){var r=pg;return{abortPunishment:dg(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:hg(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),vg=function(e){return f(lg,e,200)},yg=r(function(e,t){return sg(f(os,cg(e),cg(t)))}),mg=function(e){var t=f(lg,e.tradeAmount,200);return f(yg,e.pokeReward,f(yg,vg(e.tradeAmount),f(yg,t,function(){return"Buyer"===e.initiatorRole.$?hg(e.tradeAmount):e.tradeAmount}())))},bg=Vi(Ca),Cg=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),Eg=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Sg=oa,Tg=ia,wg=function(e){return f(Tg,{caseInsensitive:!1,multiline:!1},e)},Ig=aa,Ag=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Bg=r(function(e,t){return!f(fo,f(Ma,ls,e),t)}),kg=Bg(Fa),Ng=G,$g=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Rg=n(function(e,t,r){if("Err"===t.$){var n=t.a;return di(n)}var a=t.a;if("Err"===r.$){var n=r.a;return di(n)}var i=r.a;return hi(f(e,a,i))}),xg=f(Da,Rg(Ra),hi(vr)),_g=function(e){if(e.b){var t=(e.a,e.b);return fi(t)}return li},Lg=n(function(e,t,r){e:for(;;){if(!t.b)return hi(r);var n=t.a,a=t.b;switch(n.valueOf()){case"0":var i=e-1,o=a,u=r;e=i,t=o,r=u;continue e;case"1":var i=e-1,o=a,u=r+f(Uu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Uu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Uu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Uu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Uu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Uu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Uu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Uu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Uu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Uu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Uu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Uu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Uu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Uu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Uu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return di(Ls(s)+" is not a valid hexadecimal character.")}}}),Pg=function(e){if(jl(e))return di("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(vu,"-",e)){var t=f(Kc,vr,_g(uc(e)));return f(du,hu,l(Lg,Ii(t)-1,t,0))}return l(Lg,iu(e)-1,uc(e),0)}();return f(hh,function(t){return f(xi," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Dg=function(e){var t=uc(e);return function(e){return _(t,e)}(f($g,vr,xg(f(Ua,Pg,f(Li,"",f(xi,"",f(Ua,f(tu,Hs,gc),f(bc,20,Jf(f(Ua,f(tu,Ng,bi),t))))))))))},Ug=function(e){var t=r(function(e,t){return!(t>=8&&Ci(e)||t<8&&Ei(e))}),n=Dg(yu(e)),a=n.a,i=n.b,o=l(Ai,t,a,i);return!!Ag(e)&&kg(o)},Og=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-f]{40}$"))),Mg=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9A-F]{40}$"))),Fg=function(e){return'"'+e+'"'},Vg=function(e){var t=yu(e),r=f(fu,24,t),n=f(pu,40,e);return 64===iu(t)&&f($i,Za(P("0")),r)?Mg(n)||Og(n)?hi(Xp(n)):Ug(n)?hi(Xp(n)):di("Given address "+Fg(e)+" failed the EIP-55 checksum test."):40!==iu(t)?di("Given address "+Fg(e)+" is not the correct length."):Ag(t)?Mg(t)||Og(t)?hi(Xp(t)):Ug(t)?hi(Xp(t)):di("Given address "+Fg(e)+" failed the EIP-55 checksum test."):di("Given address "+Fg(e)+" contains invalid hex characters.")},Kg=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),Vg(lu(r)))}),Hg=r(function(e,t){var r=t.a;return nu(function(t){var n=t.a,a=t.b;return r(f(au,n,f(uu,64*e,a)))})}),jg=r(function(e,t){return f(hl,"data",wu(f(Hg,e,t)))}),qg=Xr,Gg=r(function(e,t){return f(hl,"topics",f(qg,e,wu(t)))}),zg=function(e){if("Ok"===e.$){var t=e.a;return fi(t)}return li},Wg=r(function(e,t){for(;;){if(e<=0)return t;{if(!t.b)return t;var r=(t.a,t.b),n=e-1,a=r;e=n,t=a}}}),Yg=n(function(e,t,r){var n=f(Wg,t,r),a=Ii(r)>0;return e>0&&t>0&&a?f(Ra,f(bc,e,r),l(Yg,e,t,n)):vr}),Jg=r(function(e,t){return l(Yg,e,e,t)}),Qg=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return li;var a=n.a;return f(xo,Ra(a),r)});return f(Da,t,fi(vr))}(Fa),Xg=function(e){return f(xo,f(tu,La,f(_a,r(function(e,t){return f(os,Zu(e),f(ms,t,xs))}),Es)),Qg(f(Ua,f(tu,La,f(tu,Ms,f(tu,Pg,zg))),f(Jg,8,La(e)))))},Zg=function(e){var t=uc(Zp(e));e:for(;;){if(!t.b)return li;switch(t.a.valueOf()){case"-":if(t.b.b){if("0"===t.b.a.valueOf()&&t.b.b.b&&"x"===t.b.b.a.valueOf()){if(t.b.b.b.b){var r=t.b,n=r.b,a=n.b;return f(xo,ms(Zu(-1)),Xg(a))}var i=t.b;i.b;return li}var a=t.b;return f(xo,ms(Zu(-1)),Xg(a))}return li;case"+":if(t.b.b){var a=t.b;return Xg(a)}return li;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Xg(a)}t.b;return li}break e;default:break e}}var a=t;return Xg(a)},ev=r(function(e,t){if("Just"===t.$){var r=t.a;return hi(r)}return di(e)}),tv=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),f(ev,"Error Decoding Uint into BigInt",Zg(Xf(lu(r)))))}),rv=f(bg,f(Gg,1,Kg),f(bg,f(jg,1,Kg),f(bg,f(jg,0,tv),Ki(Cg)))),nv=an,av=r(function(e,t){return be(l(_a,Te(e),Ee(),t))}),iv=r(function(e,t){return{address:t.address,blockHash:t.blockHash,blockNumber:t.blockNumber,data:t.data,logIndex:t.logIndex,removed:t.removed,returnData:f(nv,e,vp(M([_("data",cp(t.data)),_("topics",f(av,dp,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),ov=function(e){if(e.b){var t=e.a;e.b;return fi(t)}return li},uv=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return di(r)}),sv=r(function(e,t){return f(du,function(e){return e.id},f(uv,function(e){return f(hh,Oi,f(iv,rv,e).returnData)},f(ev,"No log found from that factoryAddress in that txReceipt",ov(f(pp,function(t){return $(f(tu,sp,Zp)(t.address),f(tu,sp,Zp)(tg(e)))},t.logs)))))}),cv=n(function(e,t,r){return{data:fi(f(el,"allowance(address,address)",M([ag(t),ag(r)]))),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),fv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},lv=function(e){switch(e.$){case"BlockNum":var t=e.a;return cp(Xf(Hs(t)));case"EarliestBlock":return cp("earliest");case"LatestBlock":return cp("latest");default:return cp("pending")}},dv=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return yp(M([_("to",f(xo,fp,t)),_("from",f(xo,fp,r)),_("gas",f(xo,hp,n)),_("gasPrice",f(xo,lp,a)),_("value",f(xo,lp,i)),_("data",f(xo,dp,o))]))},hv=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return di(yh(r));case"Timeout_":return di(bh);case"NetworkError_":return di(mh);case"BadStatus_":var n=t.a,a=t.b;return di(vh(n.statusCode));default:var n=t.a,a=t.b,i=f(Eh,f(hl,"result",e),a);if("Ok"===i.$){var o=i.a;return hi(o)}var u=i.a;return di(gh(Oi(u)))}}),pv=n(function(e,t,r){return vp(M([_("id",Cp(e)),_("jsonrpc",cp("2.0")),_("method",cp(t)),_("params",f(av,Fa,r))]))}),gv=function(e){return f(na,"application/json",f(Di,0,e))},vv=n(function(e,t,r){return gv(l(pv,e,t,r))}),yv=f(ea,"",Fa),mv=Ie,bv=function(e){if("Ok"===e.$){var t=e.a;return wh(t)}var r=e.a;return mv(r)},Cv=function(e){return l(Zn,pr,bv,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:li,url:e.url})},Ev=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Cv({body:l(vv,1,r,n),headers:vr,method:"POST",resolver:yv(hv(a)),timeout:li,url:t})},Sv=n(function(e,t,r){return Ev({decoder:t.decoder,method:"eth_call",params:M([dv(t),lv(r)]),url:e})}),Tv={$:"LatestBlock"},wv=r(function(e,t){return l(Sv,e,t,Tv)}),Iv=function(e){return{$:"Perform",a:e}},Av=wh(pr),Bv=r(function(e,t){return f(Bh,function(t){return wh(e(t))},t)}),kv=r(function(e,t){var r=t.a;return Ne(f(Bh,nh(e),r))}),Nv=n(function(e,t,r){return f(Bv,function(e){return pr},Ph(f(Ua,kv(e),t)))}),$v=n(function(e,t,r){return wh(pr)}),Rv=r(function(e,t){var r=t.a;return Iv(f(Bv,e,r))});gn.Task=Ue(Av,Nv,$v,Rv);var xv=Me("Task"),_v=fn,Lv=r(function(e,t){return xv(Iv(f(_v,f(Ma,f(Ma,wh,e),di),f(Bh,f(Ma,f(Ma,wh,e),hi),t))))}),Pv=a(function(e,t,r,n){return f(Lv,n,f(wv,fv(ro(e)),l(cv,rg(e),t,r)))}),Dv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return eg("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return eg("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return eg("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return eg("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return eg("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Uv=function(e){return{$:"BoolE",a:e}},Ov=Uv,Mv=function(e){return{$:"StringE",a:e}},Fv=Mv,Vv=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:fi(f(el,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ag(t),ag(r),Ov(n),og(a),og(i),og(o),og(u),og(s),og(c),og(l),og(d),Fv(h),Fv(p)]))),decoder:wu(Kg),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}}}}}}}}}}}}}},Kv=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(l){return function(d){return function(h){return function(p){return{data:fi(f(el,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ag(t),ag(r),Ov(n),og(a),og(i),og(o),og(u),og(s),og(c),og(l),og(d),Fv(h),Fv(p)]))),decoder:wu(Kg),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}}}}}}}}}}}}}},Hv=r(function(e,t){return{paymentMethods:t,price:e}}),jv=be,qv=function(e){return f(av,Fa,M([cp(e.symbol),jv(e.amount)]))},Gv=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},zv=function(e){return vp(M([_("type",cp(Gv(e.type_))),_("info",cp(e.info))]))},Wv=function(e){var t=qv(e.price),r=f(av,zv,e.paymentMethods);return f(Di,0,vp(M([_("paymentmethods",r),_("price",t)])))},Yv=r(function(e,t){return D(t,{value:fi(e)})}),Jv=function(e){return Zu(il(e))},Qv=function(e){return f(fg,Jv(e),Zu(1e3))},Xv=r(function(e,t){var r=function(){return"Token"===e.$?Vv:Kv}();return function(){return"Native"===e.$?Yv(cg(mg(t))):Fa}()(r(tg(e))(t.initiatorAddress)(Dv(e))($(t.initiatorRole,yo))(cg(t.tradeAmount))(cg(hg(t.tradeAmount)))(cg(dg(t.tradeAmount)))(cg(t.pokeReward))(Qv(t.autorecallInterval))(Qv(t.autoabortInterval))(Qv(t.autoreleaseInterval))(cg(vg(t.tradeAmount)))(Wv(f(Hv,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Zv=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),ey=function(e){return{$:"CreateNeedsSig",a:e}},ty=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),ry=r(function(e,t){var r=rp(f(Xv,e,t)),n={onBroadcast:li,onMined:fi(_(Zv(e),li)),onSign:fi(ty(e))};return _(fi(ey(e)),f(Zo,n,r))}),ny=function(e){if(""===e)return hi(li);var t=Jl(e);if("Just"===t.$){var r=t.a;return r>0?hi(fi(r)):di("Number must be greater than 0")}return di("Invalid amount")},ay=function(e){if(""===e)return hi(li);var t=cd(e);if("Just"===t.$){var r=t.a;return r>0?hi(fi(r)):di("Number must be greater than 0")}return di("Must be an integer")},iy={$:"Loss"},oy=r(function(e,t){return""===e?hi(li):f(du,fi,f(du,$(t,iy)?hu:Fa,f(du,function(e){return e/100},f(ev,"Invalid margin",Jl(e)))))}),uy=Z,sy=function(e){return uy(Xu(100*e))},cy=r(function(e,t){return f(xo,mu,ov(f(pp,f(tu,ei,Za(e)),t)))}),fy=function(e){return f(cy,e.foreignCurrencyType,e.prices)},ly=function(e){switch(e.$){case"CryptoSwap":return e.a;case"OffRamp":return yo;default:return vo}},dy=function(e){return"Buyer"===ly(e.mode).$?e.dhTokenAmount:e.foreignCurrencyAmount},hy=r(function(e,t){return"Seller"===ly(t.mode).$?D(t,{dhTokenAmount:e}):D(t,{foreignCurrencyAmount:e})}),py={align:Xh,label:"oldPriceDataWarning",mainParagraphs:M([M([ep("Uh oh, it looks like our price data might be out of date. You might want to double check the math...")])]),noticeType:Zh},gy=function(e){var t=fy(e);if("Just"===t.$){if("Ok"===t.a.$){var r=t.a.a,n=e.inputs,a=e.errors,i=f(xo,function(t){return"Buyer"===ly(e.mode).$?t/(1+e.margin)/r:t/(1+e.margin)*r*1.01},dy(e));return _(function(){if("Just"===i.$){var t=i.a;return f(hy,fi(t),D(e,{errors:D(a,{amountIn:li}),inputs:D(n,{amountIn:uy(t)})}))}return e}(),vr)}t.a;return _(e,M([ya(py)]))}return _(e,vr)},vy=function(e){return"Buyer"===ly(e.mode).$?e.foreignCurrencyAmount:e.dhTokenAmount},yy=r(function(e,t){return"Seller"===ly(t.mode).$?D(t,{foreignCurrencyAmount:e}):D(t,{dhTokenAmount:e})}),my=function(e){var t=fy(e);if("Just"===t.$){if("Ok"===t.a.$){var r=t.a.a,n=e.inputs,a=e.errors,i=f(xo,function(t){return"Buyer"===ly(e.mode).$?t*r*(1+e.margin):t/1.01/r*(1+e.margin)},vy(e));return _(function(){if("Just"===i.$){var t=i.a;return f(yy,fi(t),D(e,{errors:D(a,{amountOut:li}),inputs:D(n,{amountOut:uy(t)})}))}return e}(),vr)}t.a;return _(e,M([ya(py)]))}return _(e,vr)},by=function(e){var t=function(){var t=_(ly(e.mode),_(e.inputs.inType,e.inputs.outType));e:for(;;){if("Buyer"===t.a.$){if("External"===t.b.a.$&&"DHToken"===t.b.b.$){var r=(t.a,t.b),n=r.a.a,a=r.b.a;return _(n,a)}break e}if("DHToken"===t.b.a.$&&"External"===t.b.b.$){var i=(t.a,t.b),a=i.a.a,n=i.b.a;return _(n,a)}break e}f(op,"unexpected currency types in input when trying to update model currency types","");return _(e.foreignCurrencyType,e.dhTokenType)}(),r=t.a,n=t.b;return D(e,{dhTokenType:n,foreignCurrencyType:r})},Cy=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Ey={$:"AmountIn"},Sy={$:"AmountOut"},Ty=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wy=function(e){return{$:"ApproveNeedsSig",a:e}},Iy=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ay=r(function(e,t){return{$:"Confirm",a:e,b:t}}),By=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ky=function(e){return{$:"PricesFetched",a:e}},Ny=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),$y=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"DAI"}e.a;return"DAI"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"ETH";default:e.a;return"XDAI"}},Ry=function(e){if("DHToken"===e.$){var t=e.a;return $y(t)}return e.a},xy=r(function(e,t){switch(e.$){case"Expiry":return io(t.intervals);case"Payment":return oo(t.intervals);default:return uo(t.intervals)}}),_y=function(e){switch(e.$){case"Minute":return"Minute";case"Hour":return"Hour";case"Day":return"Day";default:return"Week"}},Ly=function(e){return{chainCmd:zo,cmd:Vo,cmdUps:vr,model:e}},Py=function(e){switch(e.$){case"Loss":return"Loss";case"Even":return"Even";default:return"Profit"}},Dy=function(e){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return"CryptoSwap Seller"}e.a;return"CryptoSwap Buyer";case"OffRamp":return"OffRamp";default:return"OnRamp"}},Uy=r(function(e,t){if("Seller"===ly(t.mode).$)return"DHToken"===e.$?D(t,{dhTokenType:e.a}):(f(op,"Trying to update inType with the wrong currency type",_(ly(t.mode),e)),t);if("External"===e.$){return D(t,{foreignCurrencyType:e.a})}f(op,"Trying to update inType with the wrong currency type",_(ly(t.mode),e));return t}),Oy=r(function(e,t){if("Seller"===ly(t.mode).$)return"External"===e.$?D(t,{foreignCurrencyType:e.a}):(f(op,"Trying to update outType with the wrong currency type",_(ly(t.mode),e)),t);if("DHToken"===e.$){return D(t,{dhTokenType:e.a})}f(op,"Trying to update outType with the wrong currency type",_(ly(t.mode),e));return t}),My=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return L(e(a),t(i),r(o))}),Fy=function(e){return l(My,e,Fa,Fa)},Vy=function(e){return l(My,Fa,e,Fa)},Ky=function(e){return l(My,Fa,Fa,e)},Hy=n(function(e,t,r){return D(r,{intervals:f(function(){switch(e.$){case"Expiry":return Fy;case"Payment":return Vy;default:return Ky}}(),As(t),r.intervals)})}),jy=f(Ma,f(Os,7,P("0")),Ri),qy=function(e){return f(xi,"",e)},Gy=function(e){var t=e.a,r=La(t);if(r.b){var n=r.a,a=r.b;return qy(f(Ra,Ri(n),f(Ua,jy,a)))}return"0"},zy=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Gy(t);default:var t=e.a;return"-"+Gy(t)}},Wy=function(e){return cd(zy(e))},Yy=function(e){return sg(e)},Jy=qr,Qy=function(e){var t=ov(f(Jy,".",e));if("Nothing"===t.$)return _(e,0);var r=t.a,n=iu(e)-1-r;return _(U(f(fu,r,e),f(uu,r+1,e)),n)},Xy=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=t.b;if(e(r)){var a=e,i=n;e=a,t=i;continue e}return t}return vr}}),Zy=function(e){var t=e.a,r=f(Xy,Za(0),t);return Iu(r.b?t:vr)},em=function(e){return f(xo,f(Ma,Zy,Iu),Qg(f(Ua,f(tu,La,f(tu,Ms,cd)),f(Jg,7,La(e)))))},tm=function(e){var t=uc(Zp(e));if(!t.b)return li;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(xo,Lu(qu),em(r))}return li;case"+":if(t.b.b){var r=t.b;return f(xo,Lu(Gu),em(r))}return li;default:var r=t;return f(xo,Lu(Gu),em(r))}},rm=function(e){var t=function(e){return!f(Fs,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(Kc,0,ov(r)))}},nm=function(e){return f(ms,e,e)},am=Zu(2),im=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Is;case"Neg":return xu;default:if($(r,Is))return f(ms,e,t);if(rm(r)){var n=e,a=nm(t),i=f(fg,r,am);e=n,t=a,r=i;continue e}var n=f(ms,t,e),a=nm(t),i=f(fg,f(Cs,r,Is),am);e=n,t=a,r=i;continue e}}),om=r(function(e,t){return l(im,Is,e,t)}),um=r(function(e,t){return e<1?t:l(ou,0,-e,t)}),sm=function(e){if(""===e)return li;var t=Qy(e),r=t.a,n=t.b,a=18-n,i=tm(a<0?f(um,-a,r):r);if("Nothing"===i.$)return li;var o=i.a,u=f(ms,o,f(om,Zu(10),Zu(a)));return fi(u)},cm=function(e){var t=sm(uy(e));if("Just"===t.$){var r=t.a;return Yy(r)}f(op,"Error converting float to tokenValue","");return Yy(Zu(0))},fm=jr,lm=function(e){for(;;){if(f(fm,".",e))return l(ou,0,-1,e);{if(!f(fm,"0",e))return""===e?"0":e;e=l(ou,0,-1,e)}}},dm=function(e){if($(f(cs,e,Zu(0)),Sa))return"-"+dm(bs(e));var t=l(Os,18,P("0"),zy(e)),r=f(um,18,t)+"."+f(pu,18,t);return function(e){return""===e?"0":e}(lm(r))},hm=r(function(e,t){var r=dm(t),n=ov(f(Jy,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(fu,a+1+e,r):f(fu,a,r)}),pm=r(function(e,t){if("Nothing"===e.$)return dm(cg(t));var r=e.a;return f(hm,r,cg(t))}),gm=function(e){var t=Jl(f(pm,li,e));if("Just"===t.$){return t.a}f(op,"Error converting tokenValue to float: string -> float failed",e);return 0},vm={$:"Error"},ym=r(function(e,t){f(op,e+" fetch error",t);return{align:Xh,label:"web3FetchError",mainParagraphs:M([M([ep('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:vm}}),mm=r(function(e,t){return{align:Xh,label:"web3MiningError",mainParagraphs:M([M([ep('Error mining "'+e+'" transaction: '+t)])]),noticeType:vm}}),bm=r(function(e,t){return{align:Xh,label:"web3SigError",mainParagraphs:M([M([ep('Error signing "'+e+'" transaction: '+t)])]),noticeType:Zh}}),Cm=Pr,Em=Cm(function(e){return f(fo,Za(e),M([P("1"),P("2"),P("3"),P("4"),P("5"),P("6"),P("7"),P("8"),P("9"),P("0"),P(".")]))}),Sm=function(e){if("Active"===e.$){var t=e.a;return fi(t)}return li},Tm=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Ly(D(t,{now:r}));case"Refresh":var n=function(){var e=_(Sm(t.wallet),jp(t.wallet));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var r=e.a.a,n=e.b.a.a;return d(Pv,n,r.address,tg(ro(n)),Cy(n))}return Vo}(),a=jh(ky);return d(Ny,t,Fo(M([n,a])),zo,vr);case"PricesFetched":var i=e.a;if("Ok"===i.$){var o=i.a,u=f(Ua,Jh(fl(t.now)),o),s=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{prices:u})),c=s.a,h=s.b;return d(Ny,c,Vo,zo,h)}i.a;return d(Ny,t,Vo,zo,M([ya(tp)]));case"ChangeMode":var p=e.a,c=D(t,{mode:p});return d(Ny,$(t.mode,p)?c:by(D(c,{inputs:f(Wp,t.wallet,p),intervals:Pp(p)})),Vo,zo,M([d(Yp,"change mode","navigation",Dy(p),0)]));case"SwapClicked":var g=t.inputs,v=D(g,{amountIn:g.amountOut,amountOut:g.amountIn,inType:g.outType,outType:g.inType}),y=t.mode;if("CryptoSwap"===y.$){var m=y.a,b=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{inputs:v,lastAmountInputChanged:function(){return"AmountIn"===t.lastAmountInputChanged.$?Sy:Ey}(),mode:function(){return Dp("Buyer"===m.$?yo:vo)}()})),c=b.a,h=b.b;return d(Ny,c,Vo,zo,U(h,M([d(Yp,"swap clicked","navigation",Jp(ly(c.mode)),0)])))}f(op,"swap button clicked, but it should be hidden right now!","");return Ly(t);case"AmountInChanged":var C=e.a,g=t.inputs,E=Em(C),S=function(){var e=t.errors,r=ny(E);if("Ok"===r.$){return _(r.a,D(e,{amountIn:li}))}var n=r.a;return _(li,D(e,{amountIn:fi(n)}))}(),T=S.a,w=S.b,I=my(f(hy,T,D(t,{errors:w,inputs:D(g,{amountIn:E}),lastAmountInputChanged:Ey}))),c=I.a,h=I.b;return d(Ny,c,Vo,zo,h);case"InTypeClicked":return d(Ny,D(t,{showInTypeDropdown:!t.showInTypeDropdown}),Vo,zo,M([d(Yp,"in currency dropdown clicked","input","",0)]));case"InTypeSelected":var A=e.a,B=t.inputs;return function(e){return D(e,{cmdUps:f(co,e.cmdUps,M([d(Yp,"in currency selected","input",Ry(A),0)]))})}(function(e){var t=e.a,r=e.b;return d(Ny,t,Vo,zo,r)}(my(f(Uy,A,D(t,{inputs:D(B,{currencySearch:"",inType:A}),showInTypeDropdown:!1})))));case"AmountOutChanged":var C=e.a,g=t.inputs,E=Em(C),k=function(){var e=t.errors,r=ny(E);if("Ok"===r.$){return _(r.a,D(e,{amountOut:li}))}var n=r.a;return _(li,D(e,{amountOut:fi(n)}))}(),N=k.a,w=k.b,R=gy(f(yy,N,D(t,{errors:w,inputs:D(g,{amountOut:E}),lastAmountInputChanged:Sy}))),c=R.a,h=R.b;return d(Ny,c,Vo,zo,h);case"OutTypeClicked":return d(Ny,D(t,{showOutTypeDropdown:!t.showOutTypeDropdown}),Vo,zo,M([d(Yp,"out currency dropdown clicked","input","",0)]));case"OutTypeSelected":var A=e.a,B=t.inputs;return function(e){return D(e,{cmdUps:f(co,e.cmdUps,M([d(Yp,"out currency selected","input",Ry(A),0)]))})}(function(e){var t=e.a,r=e.b;return d(Ny,t,Vo,zo,r)}(my(f(Oy,A,D(t,{inputs:D(B,{currencySearch:"",outType:A}),showOutTypeDropdown:!1})))));case"SearchInputChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{currencySearch:C})}));case"MarginBoxClicked":return d(Ny,D(t,{showMarginModal:!t.showMarginModal}),Vo,zo,M([d(Yp,"margin box clicked","input","",0)]));case"MarginInputChanged":var C=e.a,g=t.inputs,E=Em(C),x=function(){var e=t.errors,r=f(oy,E,g.marginType);if("Ok"===r.$){var n=r.a;return L(n,$(n,fi(0))?Gp:g.marginType,D(e,{margin:li}))}var a=r.a;return L(li,g.marginType,D(e,{margin:fi(a)}))}(),P=x.a,O=x.b,w=x.c,F=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{errors:w,inputs:D(g,{margin:E,marginType:O}),margin:f(Kc,t.margin,P)})),c=F.a,h=F.b;return d(Ny,c,Vo,zo,h);case"MarginButtonClicked":var V=e.a,g=t.inputs,P=function(){switch(V.$){case"Loss":return t.margin?-Xu(t.margin):-.01;case"Even":return 0;default:return t.margin?Xu(t.margin):.01}}(),K=function(){return"AmountIn"===t.lastAmountInputChanged.$?my:gy}()(D(t,{inputs:D(g,{margin:sy(P),marginType:V}),margin:P})),c=K.a,h=K.b;return d(Ny,c,Vo,zo,U(h,M([d(Yp,"margin button clicked","input",Py(V),0)])));case"ReceiveAddressChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{receiveAddress:C})}));case"PaymentMethodChanged":var C=e.a,B=t.inputs;return Ly(D(t,{inputs:D(B,{paymentMethod:C})}));case"WindowBoxClicked":var H=e.a,g=t.inputs;return d(Ny,D(t,{inputs:D(g,{interval:Ri(f(xy,H,t).num)}),showIntervalModal:fi(H)}),Vo,zo,M([d(Yp,"window box clicked","input",Qp(H),0)]));case"IntervalInputChanged":var C=e.a,j=t.showIntervalModal;if("Just"===j.$){var H=j.a,g=t.inputs,E=Em(C),q=function(){var e=t.errors,r=ay(E);if("Ok"===r.$){var n=r.a;return _(f(Kc,f(xy,H,t),f(xo,function(e){return f(Lp,e,f(xy,H,t).unit)},n)),D(e,{interval:li}))}var a=r.a;return _(f(xy,H,t),D(e,{interval:fi(a)}))}(),G=q.a,w=q.b,c=l(Hy,H,G,D(t,{errors:w,inputs:D(g,{interval:E})}));return d(Ny,c,Vo,zo,vr)}f(op,"Interal input changed, but there is no interval modal open! Wut","");return Ly(t);case"IntervalUnitChanged":var z=e.a,W=t.showIntervalModal;if("Just"===W.$){var H=W.a;return d(Ny,l(Hy,H,f(Lp,f(xy,H,t).num,z),t),Vo,zo,M([d(Yp,"interval unit changed","input",_y(z),0)]))}f(op,"Interal unit changed, but there is no interval modal open! Wut","");return Ly(t);case"CloseModals":var B=t.inputs;return Ly(D(t,{inputs:D(B,{currencySearch:""}),showInTypeDropdown:!1,showIntervalModal:li,showMarginModal:!1,showOutTypeDropdown:!1}));case"PlaceOrderClicked":var Y=e.a,J=e.b,Q=e.c,X=f(gg,J,Q);return d(Ny,D(t,{depositAmount:function(){return"Buyer"===ly(t.mode).$?fi(mg(X)):f(xo,cm,vy(t))}(),txChainStatus:fi(f(Ay,Y,X))}),Vo,zo,M([d(Yp,"place order clicked","txchain",t.inputs.paymentMethod,ri(gm(X.tradeAmount)))]));case"AbortCreate":return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([d(Yp,"abort","txchain","",0)]));case"ConfirmCreate":var Y=e.a,X=e.b,Z=e.c,ee=function(){if("Native"===Y.$)return f(ry,Y,X);var e=Y.a,r=function(){var t=rp(l(ug,rg(e),tg(Y),cg(Z))),r={onBroadcast:li,onMined:li,onSign:fi(f(Iy,e,X))};return f(Zo,r,t)}(),n=t.userAllowance;if("Just"===n.$){var a=n.a;return $(f(cs,a,cg(Z)),Sa)?_(fi(wy(e)),r):f(ry,Y,X)}return _(fi(wy(e)),r)}(),te=ee.a,re=ee.b;return d(Ny,D(t,{txChainStatus:te}),Vo,re,M([d(Yp,"confirm","txchain","",0)]));case"ApproveSigned":var ne=e.a,X=e.b,ae=e.c;if("Ok"===ae.$){var ie=ae.a;return d(Ny,D(t,{txChainStatus:fi(l(Ty,ne,X,ie))}),Vo,zo,M([d(Yp,"approve signed","txchain","",0)]))}var oe=ae.a;return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"appove",oe))]));case"AllowanceFetched":var ne=e.a,i=e.b;if("Ok"===i.$){var ue=i.a,c=D(t,{userAllowance:fi(ue)}),se=_(c.txChainStatus,c.depositAmount);if("Just"===se.a.$&&"ApproveMining"===se.a.a.$&&"Just"===se.b.$){var ce=se.a.a,X=ce.b,fe=se.b.a;if($(f(cs,ue,cg(fe)),Sa))return Ly(c);var le=f(ry,ro(ne),X),te=le.a,re=le.b;return d(Ny,D(c,{txChainStatus:te}),Vo,re,vr)}return Ly(c)}var de=i.a;return d(Ny,t,Vo,zo,M([ya(f(ym,"allowance",de))]));case"CreateSigned":var Y=e.a,ae=e.b;if("Ok"===ae.$){var ie=ae.a;return d(Ny,D(t,{txChainStatus:fi(f(By,Y,ie))}),Vo,zo,M([d(Yp,"create signed","txchain","",0)]))}var oe=ae.a;return d(Ny,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"create",oe))]));case"CreateMined":if("Err"===e.b.$){var Y=e.a,oe=e.b.a;return d(Ny,t,Vo,zo,M([ya(f(mm,"create",oe))]))}var he=e.a,pe=e.b.a,ge=f($o,Wy,zg(f(sv,he,pe)));if("Just"===ge.$){var ve=ge.a;return d(Ny,t,Vo,zo,M([d(Yp,"create mined","txchain","",0),ga(f(qh,he,ve))]))}return d(Ny,t,Vo,zo,M([ya(f(up,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',pe))]));case"NoOp":return Ly(t);default:var ye=e.a;return d(Ny,t,Vo,zo,M([ye]))}}),wm={$:"Refresh"},Im=a(function(e,t,r,n){return{amountIn:e,amountOut:t,interval:n,margin:r}}),Am=d(Im,li,li,li,li),Bm=r(function(e,t){return f(Tm,wm,{depositAmount:li,dhTokenAmount:li,dhTokenType:f(Kc,to(no),jp(e)),errors:Am,foreignCurrencyAmount:li,foreignCurrencyType:Rp(t),inputs:f(Wp,e,t),intervals:Pp(t),lastAmountInputChanged:Ey,margin:0,mode:t,now:Ho(0),prices:vr,showInTypeDropdown:!1,showIntervalModal:li,showMarginModal:!1,showOutTypeDropdown:!1,txChainStatus:li,userAllowance:li,wallet:e})}),km={$:"CloseModals"},Nm=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(Ny,D(t,{wallet:r}),function(){var e=_(Sm(r),jp(r));if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$){var t=e.a.a,n=e.b.a.a;return d(Pv,n,t.address,tg(ro(n)),Cy(n))}return Vo}(),zo,vr)}return f(Tm,km,t)}),$m=r(function(e,t){return f(Bg,function(e){return f(fo,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),Rm=r(function(e,t){return $(f(ol,t.derived.phaseEndTime,e),Aa)}),xm=function(e){return f(xo,sg,sm(e))},_m=function(e){if(""===e)return hi(li);var t=xm(e);if("Nothing"===t.$)return di("I can't interpret this number");var r=t.a;return hi(fi(r))},Lm=r(function(e,t){return{maxDai:t,minDai:e}}),Pm=f(Lm,li,li),Dm=function(e){return jl(e)?li:fi(e)},Um=function(e){return l(Rg,r(function(t,r){return{dai:{max:r,min:t},fiatSymbol:Dm(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(hh,function(e){return D(Pm,{minDai:fi(e)})},_m(e.minDai)),f(hh,function(e){return D(Pm,{maxDai:fi(e)})},_m(e.maxDai)))},Om=Kr,Mm=r(function(e,t){var r=function(t){return f(Bg,function(e){return f(Om,Zp(e),Zp(t))},e)};return f(fo,function(e){return r(e.info)},t)}),Fm=r(function(e,t){return D(t,{paymentMethod:e})}),Vm=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Km=r(function(e,t){return f(cs,cg(e),cg(t))}),Hm=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(co,e.inputs.paymentMethodTerms,M([t]));return jm(D(e,{inputs:f(Vm,r,f(Fm,"",e.inputs))}))},jm=function(e){var t=Hm(e),n=Um(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Mm,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatSymbol;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.symbol,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Km,e.parameters.tradeAmount,r),Sa)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Km,e.parameters.tradeAmount,r),Aa)}()},s=r(function(e,r){return f(Rm,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f($m,t.filters,r)});return D(t,{filterFunc:s})},qm={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:vr},Gm=function(e){return{$:"PricesFetched",a:e}},zm={$:"Expires"},Wm=function(e){return _(jm({errors:Pm,filterFunc:Rm,filters:go(M([f(Eo,!0,!0),d(Bo,!0,!1,!1,!1)])),inputs:qm,now:Ho(0),prices:vr,showCurrencyDropdown:!1,tradeTable:Uo(_(zm,Oo)),wallet:e}),jh(Gm))},Ym=r(function(e,t){var r=f(pp,xc(e),t.inputs.paymentMethodTerms);return jm(D(t,{inputs:f(Vm,r,t.inputs)}))}),Jm=function(e){return jm(D(e,{filterFunc:Rm,inputs:qm}))},Qm=function(e){return{$:"TradeTableMsg",a:e}},Xm=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),Zm=function(e){return d(Xm,e,Vo,zo,vr)},eb=r(function(e,t){return D(t,{fiatType:e})}),tb=r(function(e,t){return D(t,{maxDai:e})}),rb=r(function(e,t){return D(t,{minDai:e})}),nb=Q,ab=r(function(e,t){switch(e.$){case"UpdateNow":var r=e.a;return Zm(D(t,{now:r}));case"Refresh":return d(Xm,t,jh(Gm),zo,vr);case"PricesFetched":var n=e.a;if("Ok"===n.$){var a=n.a,i=f(Ua,Jh(fl(t.now)),a);return Zm(D(t,{prices:i}))}n.a;return d(Xm,t,Vo,zo,M([ya(tp)]));case"MinDaiChanged":var o=e.a;return Zm(D(t,{inputs:f(rb,Em(o),t.inputs)}));case"MaxDaiChanged":var o=e.a;return Zm(D(t,{inputs:f(tb,Em(o),t.inputs)}));case"FiatTypeInputChanged":var o=e.a;return Zm(D(t,{inputs:f(eb,nb(o),t.inputs)}));case"FiatTypeSelected":var o=e.a;return Zm(jm(D(t,{inputs:f(eb,o,t.inputs),showCurrencyDropdown:!1})));case"ShowCurrencyDropdown":var u=e.a;t.inputs;return Zm(D(t,{inputs:(u?eb(""):Fa)(t.inputs),showCurrencyDropdown:u}));case"FiatTypeLostFocus":return Zm(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var o=e.a;return Zm(D(t,{inputs:f(Fm,o,t.inputs)}));case"AddSearchTerm":return Zm(Hm(t));case"RemoveTerm":var s=e.a;return Zm(f(Ym,s,t));case"ApplyInputs":return d(Xm,jm(t),Vo,zo,vr);case"ResetSearch":return Zm(Jm(t));case"FiltersMsg":var c=e.a;return Zm(jm(D(t,{filters:f(al,c,t.filters)})));case"TradeTableMsg":var l=e.a,h=f(Qh,l,t.tradeTable);return d(Xm,D(t,{tradeTable:h.model}),f(np,Qm,h.cmd),f(ru,Qm,h.chainCmd),f(Ua,Xi(Qm),h.cmdUps));case"NoOp":return Zm(t);default:var p=e.a;return d(Xm,t,Vo,zo,M([p]))}}),ib=function(e){return{$:"ShowCurrencyDropdown",a:e}},ob=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return Zm(D(t,{wallet:r}))}return f(ab,ib(!1),t)}),ub=a(function(e,t,r,n){return e(vp(M([_("title",cp(t)),_("body",function(){if("Nothing"===r.$)return gp;var e=r.a;return cp(e)}()),_("image",function(){if("Nothing"===n.$)return gp;var e=n.a;return cp(e)}())])))}),sb=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},cb=function(e){return e.a+"="+e.b},fb=function(e){return e.b?"?"+f(xi,"&",f(Ua,cb,e)):""},lb=r(function(e,t){return"/"+(f(xi,"/",e)+fb(t))}),db=function(e){switch(e.$){case"InitialBlank":return f(lb,M(["DAIHard"]),vr);case"CreateCrypto":return f(lb,M(["DAIHard","create","crypto"]),vr);case"CreateFiat":return f(lb,M(["DAIHard"]),vr);case"Trade":var t=e.a,r=e.b;return f(lb,M(["DAIHard","trade",sb(t),Ri(r)]),vr);case"Marketplace":return f(lb,M(["DAIHard","marketplace"]),vr);case"AgentHistory":var n=e.a;return f(lb,M(["DAIHard","history",sp(n)]),vr);default:return f(lb,vr,vr)}},hb={$:"NotFound"},pb=function(e){return{$:"AgentHistory",a:e}},gb={$:"CreateCrypto"},vb={$:"CreateFiat"},yb={$:"Marketplace"},mb=function(e){return{$:"Parser",a:e}},bb=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Cb=r(function(e,t){return mb(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(bb,f(Ra,u,r),s,a,i,o(l))])}return vr}return vr})}),Eb=f(Cb,"ADDRESS",f(tu,Vg,zg)),Sb={$:"Eth"},Tb={$:"Kovan"},wb=f(Cb,"FACTORY",function(e){switch(e){case"eth":return fi(to(Sb));case"keth":return fi(to(Tb));case"dai":return fi(ro(eo));case"kdai":return fi(ro(Vp));case"xdai":return fi(to(no));default:return li}}),Ib=f(Cb,"NUMBER",cd),Ab=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(bb,r,n,a,i,e(o))}),Bb=r(function(e,t){var r=t.a;return mb(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(Ua,Ab(u),r(h(bb,n,a,i,o,e)))})}),kb=function(e){return l(Da,co,vr,e)},Nb=r(function(e,t){return kb(f(Ua,e,t))}),$b=function(e){return mb(function(t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;if(n.b){var u=n.a,s=n.b;return $(u,e)?M([h(bb,f(Ra,u,r),s,a,i,o)]):vr}return vr})},Rb=r(function(e,t){var r=e.a,n=t.a;return mb(function(e){return f(Nb,n,r(e))})}),xb=mb(function(e){return M([e])}),_b=f(Rb,$b("DAIHard"),function(e){return mb(function(t){return f(Nb,function(e){return(0,e.a)(t)},e)})}(M([f(Bb,gb,$b("cryptoswap")),f(Bb,vb,xb),f(Bb,qh,f(Rb,$b("trade"),f(Rb,wb,Ib))),f(Bb,yb,$b("marketplace")),f(Bb,pb,f(Rb,$b("history"),Eb)),f(Bb,function(e){return pb(e)},f(Rb,$b("history"),Eb))]))),Lb=function(e){e:for(;;){if(e.b){var t=e.a,r=e.b,n=t.unvisited;if(n.b){if(""!==n.a||n.b.b){var a=r;e=a;continue e}return fi(t.value)}return fi(t.value)}return li}},Pb=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Ra,t,Pb(r))}return vr}return vr},Db=function(e){var t=f(Li,"/",e);if(t.b&&""===t.a){var r=t.b;return Pb(r)}var r=t;return Pb(r)},Ub=jt,Ob=r(function(e,t){if("Nothing"===t.$)return fi(M([e]));var r=t.a;return fi(f(Ra,e,r))}),Mb=r(function(e,t){var r=f(Li,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Ub(n);if("Nothing"===o.$)return t;var u=o.a,s=Ub(i);if("Nothing"===s.$)return t;var c=s.a;return l(th,u,Ob(c),t)}return t}),Fb=function(e){if("Nothing"===e.$)return Dd;var t=e.a;return l(Da,Mb,Dd,f(Li,"&",t))},Vb=r(function(e,t){var r=e.a;return Lb(r(h(bb,vr,Db(t.path),Fb(t.query),t.fragment,Fa)))}),Kb=function(e){return f(Kc,hb,f(Vb,_b,e))},Hb=Ge("connectToWeb3",function(e){return gp}),jb=function(e){return vp(M([_("event",cp(e.event)),_("category",cp(e.category)),_("label",cp(e.label)),_("value",Cp(e.value))]))},qb=r(function(e,t){return vp(M([_("address",cp(sp(e))),_("signSeedMsg",cp(t))]))}),Gb=Ge("gTagOut",Fa),zb=Ge("genPrivkey",Fa),Wb=r(function(e,t){for(;;){if(!t.b)return li;var r=t.a,n=t.b;if(e(r))return fi(r);var a=e,i=n;e=a,t=i}}),Yb=n(function(e,t,r){return f($o,sf(t),f(xo,function(e){return e.trades},f(Wb,function(t){return $(t.factory,e)},r)))}),Jb=Ge("notifyPort",Fa),Qb=Ge("requestNotifyPermissionPort",function(e){return gp}),Xb=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Zb=function(e){return{$:"PartiallyLoadedTrade",a:e}},eC=r(function(e,t){return Zb(g(Xb,e,t,li,li,li,li,li))}),tC=function(e){return{$:"CurrentBlockFetched",a:e}},rC=Tu(f(tu,yu,Pg)),nC=function(e){return Ev({decoder:rC,method:"eth_blockNumber",params:vr,url:e})},aC=function(e){return f(Lv,tC,nC(e))},iC=r(function(e,t){return{address_:e,blocknum:t}}),oC=function(e){return nu(function(t){return hi(_(t,e))})},uC=n(function(e,t,r){var n=t.a,a=r.a;return nu(function(t){return f(uv,function(t){var r=t.a,n=t.b;return f(du,Jh(e(n)),a(r))},n(t))})}),sC=r(function(e,t){return l(uC,r(function(e,t){return e(t)}),t,e)}),cC=wu(f(sC,tv,f(sC,Kg,oC(iC)))),fC=r(function(e,t){return{data:fi(f(el,"createdTrades(uint256)",M([og(t)]))),decoder:cC,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),lC=n(function(e,t,r){return f(Lv,r,f(wv,fv(e),f(fC,tg(e),t)))}),dC=function(e){return{$:"CreationInfoFetched",a:e}},hC=r(function(e,t){return l(lC,e,Zu(t),dC)}),pC=function(e){return{$:"EventSentryMsg",a:e}},gC=function(e){return{$:"BlockNumber",a:e}},vC=function(e){return{$:"EventSentry",a:e}},yC=function(e){return{$:"Set_elm_builtin",a:e}},mC=yC(Dd),bC=r(function(e,t){return _(vC({blockNumber:li,errors:vr,nodePath:t,pending:mC,ref:1,requests:Dd,tagger:e,watching:mC}),f(Lv,f(tu,gC,e),nC(t)))}),CC=function(e){return f(bC,pC,fv(e))},EC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),SC=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},TC=SC(f(EC,li,li)),wC=n(function(e,t,r){return{allowance:li,blocknumOnInit:li,chatHistoryModel:li,eventSentry:t,eventsWaitingForChatHistory:vr,expandedPhase:Io,secureCommInfo:TC,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:li,wallet:r}}),IC=a(function(e,t,r,n){return{chainCmd:r,cmd:t,cmdUps:n,model:e}}),AC=n(function(e,t,r){var n=f(hC,t,r),a=CC(t),i=a.a,o=a.b;return d(IC,l(wC,f(eC,t,r),i,e),Fo(M([n,o,aC(fv(t))])),zo,M([va]))}),BC=function(e){return{$:"LoadedTrade",a:e}},kC=function(e){return{$:"EventLogFetched",a:e}},NC=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),$C=se,RC=le,xC=Yr,_C=n(function(e,t,r){var n=function(e){return RC(M([e,$C(r)]))};return f(Cu,function(a){var i=f(nv,e,a);if("Ok"===i.$){var o=i.a,u=f(nv,n(t),o);if("Ok"===u.$){var s=u.a;return Ki(s)}var c=u.a;return Eu(Oi(c))}return Ki(r)},xC)}),LC=a(function(e,t,r,n){return f(bg,l(_C,f(hl,e,xC),t,r),n)}),PC=n(function(e,t,r){return f(bg,f(hl,e,t),r)}),DC=Tu(Vg),UC=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),OC=function(e){return{$:"BlockHash",a:e}},MC=function(e){return UC(e)?hi(OC(yu(e))):di("Given blockHash "+Fg(e)+" is not valid.")},FC=Tu(MC),VC=Sg(f(Kc,Ig,wg("^((0[Xx]){1})?[0-9a-fA-F]+$"))),KC=function(e){return VC(e)?hi(lc(yu(e))):di("Something in here is not very hexy: "+Fg(e))},HC=Tu(KC),jC=function(e){return{$:"TxHash",a:e}},qC=function(e){return UC(e)?hi(jC(yu(e))):di("Given txHash "+Fg(e)+" is not valid.")},GC=Tu(qC),zC=c(function(e,t,r,n,a,i,o,u,s){return{address:e,blockHash:u,blockNumber:s,data:t,logIndex:a,removed:n,topics:r,transactionHash:o,transactionIndex:i}}),WC=zr,YC=ue,JC=l(PC,"blockNumber",rC,l(PC,"blockHash",FC,l(PC,"transactionHash",GC,l(PC,"transactionIndex",rC,l(PC,"logIndex",rC,d(LC,"removed",WC,!1,l(PC,"topics",YC(HC),l(PC,"data",Su,l(PC,"address",DC,Ki(zC)))))))))),QC=function(e){return f(av,function(e){if("Just"===e.$){var t=e.a;return cp(Zf(t))}return gp},e)},XC=function(e){return vp(M([_("fromBlock",lv(e.fromBlock)),_("toBlock",lv(e.toBlock)),_("address",fp(e.address)),_("topics",QC(e.topics))]))},ZC=r(function(e,t){return Ev({decoder:YC(JC),method:"eth_getLogs",params:M([XC(t)]),url:e})}),eE=function(e){return{$:"BlockNum",a:e}},tE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Bh,function(r){return f(Bv,mi(r),f(ZC,e,D(t,{fromBlock:eE(n),toBlock:eE(a)})))},f(ZC,e,t)):f(ZC,e,t)}),rE=r(function(e,t){var r=t.a;return yC(l(Kd,e,pr,r))}),nE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(Kd,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return L(vC(D(o,{watching:f(rE,a.ref,o.watching)})),f(Lv,f(tu,NC(a.ref),a.tagger),e),a.ref)}(l(tE,a.nodePath,n,_(s,s)))}return L(vC(D(o,{pending:f(rE,a.ref,o.pending)})),Vo,a.ref)}),aE=nE(!1),iE=r(function(e,t){var r=function(){var e=CC(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return L(t,Fo(M([n,r])),a)}(l(aE,kC,r,{address:t.creationInfo.address,fromBlock:eE(t.creationInfo.blocknum),toBlock:Tv,topics:vr}))}(),n=r.a,a=r.b;return d(IC,l(wC,BC(t),n,e),Fo(M([a,aC(fv(t.factory))])),zo,M([va]))}),oE=function(e){return{$:"AllowanceFetched",a:e}},uE=function(e){return d(IC,e,Vo,zo,vr)},sE=r(function(e,t){if("UpdateWallet"===e.$){var r=e.a;return d(IC,D(t,{wallet:r}),function(){var e=L(Sm(r),jp(r),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var n=e.a.a,a=e.b.a.a,i=e.c.a;return $(jp(r),fi(i.factory))?d(Pv,a,n.address,i.creationInfo.address,oE):Vo}return Vo}(),zo,vr)}return uE(D(t,{showChatHistory:!1,showStatsModal:!1}))}),cE=function(e){return{data:fi(f(el,"abort()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},fE=function(e){return{data:fi(f(el,"burn()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},lE=function(e){return{data:fi(f(el,"claim()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},dE=r(function(e,t){return{data:fi(f(el,"initiatorStatement(string)",M([Fv(t)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),hE=function(e){return{data:fi(f(el,"recall()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},pE=function(e){return{data:fi(f(el,"release()",vr)),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},gE=r(function(e,t){return{data:fi(f(el,"responderStatement(string)",M([Fv(t)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),vE={$:"Invalid"},yE=r(function(e,t){return{amount:t,symbol:e}}),mE=f(Cu,function(e){var t=tm(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("Can't convert that to a BigInt")},Su),bE=RC(M([l(Vi,yE,f(qg,0,Su),f(Cu,function(e){var t=Jl(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("Error converting BigInt to float")},f(Fi,zy,f(qg,1,mE)))),l(Vi,yE,f(qg,0,Su),f(qg,1,pl))])),CE=r(function(e,t){return{info:t,type_:e}}),EE={$:"Bank"},SE={$:"Cash"},TE={$:"Custom"},wE=function(e){switch(e){case"cash":return fi(SE);case"bank":return fi(EE);case"custom":return fi(TE);default:return li}},IE=f(Cu,function(e){var t=wE(e);if("Just"===t.$){var r=t.a;return Ki(r)}return Eu("")},Su),AE=l(Vi,CE,f(hl,"type",IE),f(hl,"info",Su)),BE=function(e){var t=l(Vi,Hv,f(hl,"price",bE),f(hl,"paymentmethods",YC(AE)));return f(Eh,t,e)},kE=r(function(e,t){return{commPubkey:t,responder:e}}),NE=r(function(e,t){var n=r(function(t,r){return l(ou,t,t+2*r,e)}),a=f(tu,Pg,du(ai(2)));return f(uv,function(t){return f(du,function(e){return f(n,t+64,e)},Pg(l(ou,t,t+64,e)))},a(t))}),$E=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=function(e){return 63&e|n<<6};return a?1===a?L(0,0,f(e,o(t),i)):L(o(t),a-1,i):128&t?192==(224&t)?L(31&t,1,i):224==(240&t)?L(15&t,2,i):L(7&t,3,i):L(0,0,f(e,t,i))}),RE=n(function(e,t,r){var n=l(_a,$E(e),L(0,0,t),r);if(n.b)return di("invalid UTF-8 sequence");var a=n.c;return hi(a)}),xE=q,_E=function(e){return Ls(xE(e))},LE=function(e){return l(RE,r(function(e,t){return U(t,_E(e))}),"",e)},PE=nu(function(e){var t=e.a,r=e.b;return f(du,f(cu,t,r),f(uv,LE,f(uv,f(tu,Ua(Pg),xg),f(du,pp(f(tu,jl,ls)),f(du,cc(2),f(NE,t,lu(r)))))))}),DE=f(bg,f(jg,1,PE),f(bg,f(jg,0,Kg),Ki(kE))),UE=r(function(e,t){return{commPubkey:t,terms:e}}),OE=f(bg,f(jg,1,PE),f(bg,f(jg,0,PE),Ki(UE))),ME=function(e){return{statement:e}},FE=f(bg,f(jg,0,PE),Ki(ME)),VE=function(e){return{statement:e}},KE=f(bg,f(jg,0,PE),Ki(VE)),HE={$:"AbortedEvent"},jE={$:"BurnedEvent"},qE={$:"ClaimedEvent"},GE=function(e){return{$:"CommittedEvent",a:e}},zE=function(e){return{$:"InitiatedEvent",a:e}},WE=function(e){return{$:"InitiatorStatementLogEvent",a:e}},YE={$:"PokeEvent"},JE={$:"RecalledEvent"},QE={$:"ReleasedEvent"},XE=function(e){return{$:"ResponderStatementLogEvent",a:e}},ZE=f(hl,"topics",f(qg,0,HC)),eS=function(e){return lc(f(xi,"",f(Ua,f(tu,Hs,gc),Jf(f(Ua,bi,uc(e))))))},tS=f(Cu,function(e){return $(e,eS("Initiated(string,string)"))?f(Fi,zE,OE):$(e,eS("Committed(address,string)"))?f(Fi,GE,DE):$(e,eS("Recalled()"))?Ki(JE):$(e,eS("Claimed()"))?Ki(qE):$(e,eS("Aborted()"))?Ki(HE):$(e,eS("Released()"))?Ki(QE):$(e,eS("Burned()"))?Ki(jE):$(e,eS("InitiatorStatementLog(string)"))?f(Fi,WE,FE):$(e,eS("ResponderStatementLog(string)"))?f(Fi,XE,KE):$(e,eS("Poke()"))?Ki(YE):Eu("Unrecognized topic hash")},ZE),rS=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},nS=function(e){switch(e.$){case"Invalid":return li;case"PartiallyLoadedTrade":var t=e.a;return fi(t.factory);default:var r=e.a;return fi(r.factory)}},aS=function(e){return $(e.buyerDeposit,hg(e.tradeAmount))&&$(e.abortPunishment,dg(e.tradeAmount))},iS=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),oS=r(function(e,t){return Ho(il(t)+il(e))}),uS=n(function(e,t,r){var n=function(){switch(t.phase.$){case"Open":return e.autorecallInterval;case"Committed":return e.autoabortInterval;case"Judgment":return e.autoreleaseInterval;default:return Ho(0)}}();return{phaseEndTime:function(){return"Closed"===t.phase.$?Ho(f(Uu,2,53)-1):f(oS,t.phaseStartTime,n)}()}}),sS=function(e){var t=L(_(e.creationInfo,e.parameters),_(e.state,e.terms),e.phaseStartInfo);if("Just"===t.a.a.$&&"Just"===t.a.b.$&&"Just"===t.b.a.$&&"Just"===t.b.b.$&&"Just"===t.c.$){var r=t.a,n=r.a.a,a=r.b.a,i=t.b,o=i.a.a,u=i.b.a,s=t.c.a;return BC(v(iS,e.factory,e.id,n,a,o,u,s,l(uS,a,o,u)))}return Zb(e)},cS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{creationInfo:fi(e)}));case"LoadedTrade":f(op,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vE}}),fS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{parameters:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vE}}),lS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{phaseStartInfo:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vE}}),dS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{state:fi(e)}));case"LoadedTrade":var n=t.a;return BC(D(n,{state:e}));default:return vE}}),hS=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return sS(D(r,{terms:fi(e)}));case"LoadedTrade":t.a,f(op,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vE}}),pS=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiatedByCustodian:t,initiator:e,pokeReward:s,tradeAmount:r}}),gS=wu(f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,gu,f(sC,Kg,oC(pS))))))))))),vS=function(e){return{data:fi(f(el,"getParameters()",vr)),decoder:gS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},yS=function(e){return f(xo,function(e){return Ho(1e3*e)},cd(zy(e)))},mS=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return di(a)}var i=t.a;if("Err"===r.$){var a=r.a;return di(a)}var o=r.a;if("Err"===n.$){var a=n.a;return di(a)}var u=n.a;return hi(l(e,i,o,u))}),bS=function(e){var t=f(ev,"error converting BigInt to Time.Posix",yS(e.autoabortInterval)),r=f(ev,"error converting BigInt to Time.Posix",yS(e.autoreleaseInterval)),a=f(ev,"error converting BigInt to Time.Posix",yS(e.autorecallInterval));return d(mS,n(function(t,r,n){return{abortPunishment:Yy(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Yy(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?yo:vo,pokeReward:Yy(e.pokeReward),tradeAmount:Yy(e.tradeAmount)}}),a,t,r)},CS=n(function(e,t,r){return f(Lv,r,f(Bv,bS,f(wv,fv(e),vS(t))))}),ES=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return{v0:e,v1:t,v2:r,v3:n,v4:a,v5:i,v6:o,v7:u,v8:s,v9:c}}}}}}}}}}},SS=wu(f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,f(sC,tv,oC(ES)))))))))))),TS=function(e){return{data:fi(f(el,"getPhaseStartInfo()",vr)),decoder:SS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},wS=i(function(e,t,r,n,a){if("Nothing"===t.$)return li;var i=t.a;if("Nothing"===r.$)return li;var o=r.a;if("Nothing"===n.$)return li;var u=n.a;if("Nothing"===a.$)return li;var s=a.a;return fi(d(e,i,o,u,s))}),IS=function(e){return h(wS,a(function(t,r,n,a){return{claimedBlock:e.v3,claimedTime:n,closedBlock:e.v4,closedTime:a,committedBlock:e.v2,committedTime:r,openedBlock:e.v1,openedTime:t}}),yS(e.v6),yS(e.v7),yS(e.v8),yS(e.v9))},AS=n(function(e,t,r){return f(Lv,r,f(Bv,IS,f(wv,fv(e),TS(t))))}),BS=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),kS=wu(f(sC,tv,f(sC,Kg,f(sC,tv,f(sC,tv,f(sC,tv,oC(BS))))))),NS=function(e){return{data:fi(f(el,"getState()",vr)),decoder:kS,from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},$S={$:"Aborted"},RS={$:"Burned"},xS={$:"NotClosed"},_S={$:"Recalled"},LS={$:"Released"},PS=function(e){switch(f(Kc,99,cd(zy(e)))){case 0:return fi(xS);case 1:return fi(_S);case 2:return fi($S);case 3:return fi(LS);case 4:return fi(RS);default:return li}},DS=function(e){switch(f(Kc,99,cd(zy(e)))){case 1:return fi(Io);case 2:return fi(To);case 3:return fi(wo);case 4:return fi(So);default:return li}},US=function(e){return $(e,eg("0x0000000000000000000000000000000000000000"))?li:fi(e)},OS=a(function(e,t,r,n){if("Nothing"===t.$)return li;var a=t.a;if("Nothing"===r.$)return li;var i=r.a;if("Nothing"===n.$)return li;var o=n.a;return fi(l(e,a,i,o))}),MS=function(e){var t=yS(e.phaseStartTimestamp),r=DS(e.phase),a=PS(e.closedReason);return d(OS,n(function(t,r,n){return{balance:Yy(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:US(e.responder)}}),r,t,a)},FS=n(function(e,t,r){return f(Lv,r,f(Bv,MS,f(wv,fv(e),NS(t))))}),VS=i(function(e,t,r,n,a){return Fo(M([l(CS,e,t,r),l(FS,e,t,n),l(AS,e,t,a)]))}),KS=function(e){var t=Wy(e);if("Just"===t.$){return t.a}f(op,"Warning! BigInt to Int conversion failed!",zy(e));return 0},HS=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),jS=n(function(e,t,r){for(;;){var n=f(Qa,32,e),a=n.a,i=n.b;if(x(ii(a),32)<0)return f(oi,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Ra,Ya(a),t),s=r+1;e=o,t=u,r=s}}),qS=function(e){return e.b?l(jS,e,vr,0):Wa},GS=rn,zS=function(e){var t=h(GS,HS,f(hl,"encapsulation",Su),f(hl,"iv",Su),f(hl,"tag",Su),f(hl,"encrypted",Su)),r=YC(t),n=f(nv,r,e);if("Err"===n.$){var a=n.a;return di(Oi(a))}var i=n.a;return function(e){var t=_(f(sf,0,e),f(sf,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return hi(_(r,n))}return di("Decoded list has less than 2 items.")}(qS(i))},WS=function(e){var t=function(e){var t=iu(e);return t>1114111?di("string is too long"):hi(f(_s,xE(t),e))};return f(du,xi(""),xg(f(Ua,t,e)))},YS=function(e){var t=e.a,r=e.b;return WS(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},JS=r(function(e,t){return vp(M([_("message",cp(e)),_("pubkeyHexStrings",f(av,cp,M([t.initiatorPubkey,t.responderPubkey])))]))}),QS=function(e){return{$:"LoadedCommInfo",a:e}},XS=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),ZS=function(e){var t=_(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return QS(f(XS,r,n))}return SC(e)},eT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return ZS(D(r,{initiatorPubkey:fi(e)}))}var n=t.a;return QS(D(n,{initiatorPubkey:e}))}),tT=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return ZS(D(r,{responderPubkey:fi(e)}))}var n=t.a;return QS(D(n,{responderPubkey:e}))}),rT=r(function(e,t){var r=_(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return vo}r.a,r.b;return yo}if("Buyer"===r.b.$){r.a,r.b;return yo}r.a,r.b;return vo}),nT=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=bi(r),i=f(Wg,a,n),o=Ms(f(bc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),aT=n(function(e,t,r){if("Nothing"===t.$)return li;var n=t.a;if("Nothing"===r.$)return li;var a=r.a;return fi(f(e,n,a))}),iT=function(e){var t=qS(f(nT,uc(e),vr));return l(aT,dl,h(wS,HS,f(sf,0,t),f(sf,1,t),f(sf,2,t),f(sf,3,t)),h(wS,HS,f(sf,4,t),f(sf,5,t),f(sf,6,t),f(sf,7,t)))},oT=r(function(e,t){if("Statement"===t.$){t.a;return l(ha,"New Message from Trade",li,li)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(ha,n,li,li)}),uT={$:"Aborted"},sT={$:"Burned"},cT={$:"Claimed"},fT=function(e){return{$:"Committed",a:e}},lT=function(e){return{$:"Encrypted",a:e}},dT={$:"FailedDecode"},hT={$:"Initiated"},pT={$:"Recalled"},gT={$:"Released"},vT=function(e){return{$:"StateChange",a:e}},yT=function(e){return{$:"Statement",a:e}},mT=cr,bT=sr,CT=r(function(e,t){var r=ii(e),n=32-ii(t.tail)-r,a=l(mT,32,t.tail,e);return n<0?{nodeList:f(Ra,Ya(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(bT,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Ra,Ya(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:za}}),ET=ir,ST=y,TT=a(function(e,t,r,n){var a=nf&t>>>e;if(x(a,ii(n))>-1){if(5===e)return f(ET,Ya(r),n);var i=Ja(d(TT,e-Ga,t,r,za));return f(ET,i,n)}var o=f(af,a,n);if("SubTree"===o.$){var u=o.a,i=Ja(d(TT,e-Ga,t,r,u));return l(lf,a,i,n)}var i=Ja(d(TT,e-Ga,t,r,ST(o)));return l(lf,a,i,n)}),wT=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ii(i),u=ii(e),s=r+(u-o);if($(u,32)){if(x(s>>>Ga,1<0){var c=n+Ga,f=d(TT,c,r,e,ST(Ja(a)));return d(Ka,s,c,f,za)}return d(Ka,s,n,d(TT,n,r,e,a),za)}return d(Ka,s,n,a,e)}),IT=r(function(e,t){var r=(t.a,t.c,t.d),n=ii(e),a=32-ii(r)-n,i=l(mT,32,r,e),o=f(wT,i,t);if(a<0){var u=l(bT,a,n,e);return f(wT,u,o)}return o}),AT=or,BT=function(e){var t=e.a,n=e.c,a=e.d,i=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,i,t,r)}return f(Ra,e,t)});return{nodeList:l(AT,i,vr,n),nodeListSize:t/32|0,tail:a}},kT=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(x(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,o,t,r)}var n=e.a;return f(IT,n,t)});return f(IT,i,l(AT,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(AT,o,t,r)}var n=e.a;return f(CT,n,t)});return f(oi,!0,f(CT,i,l(AT,o,BT(e),a)))}),NT=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Ra,r,t)}),$T=f(Da,NT,vr),RT=n(function(e,t,r){var n=rT(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return fi(vT(hT));case"CommittedEvent":var r=t.a;return fi(vT(fT(r.responder)));case"RecalledEvent":return fi(vT(pT));case"ClaimedEvent":return fi(vT(cT));case"AbortedEvent":return fi(vT(uT));case"ReleasedEvent":return fi(vT(gT));case"BurnedEvent":return fi(vT(sT));case"InitiatorStatementLogEvent":var r=t.a;return fi(yT({blocknum:e,message:function(){var e=iT(r.statement);if("Just"===e.$){var t=e.a;return lT(t)}return dT}(),who:n(ko)}));case"ResponderStatementLogEvent":var r=t.a;return fi(yT({blocknum:e,message:function(){var e=iT(r.statement);if("Just"===e.$){var t=e.a;return lT(t)}return dT}(),who:n(No)}));default:return li}}(),i=f(xo,function(t){return{blocknum:e,eventInfo:t,time:li}},a),o=f(kT,r.history,qS($T(M([i])))),u=x(e,r.lastNotificationBlocknum)>0?_(f(xo,oT($(r.userRole,r.trade.parameters.initiatorRole)),a),e):_(li,r.lastNotificationBlocknum),s=u.a;return L(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),$T(M([s])))}),xT=Gr,_T=function(e){var t=l(Vi,dl,f(hl,"id",xT),f(hl,"message",Su));return f(hh,Oi,f(nv,t,e))},LT=function(e){return{$:"Decrypted",a:e}},PT=a(function(e,t,r,n){return{cmdUps:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),DT=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(RT,n,a,t),o=i.a,u=i.b,s=i.c;return d(PT,o,u,li,s);case"MessageInputChanged":var c=e.a;return d(PT,D(t,{messageInput:c}),!1,li,vr);case"MessageSubmit":return d(PT,D(t,{messageInput:""}),!1,fi(t.messageInput),vr);default:var h=e.a,p=_T(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(sf,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:LT(y)}),T=D(b,{eventInfo:yT(S)}),w=l(hf,v,T,t.history);return d(PT,D(t,{history:w}),!1,li,vr)}return d(PT,t,!1,li,M([ya(f(up,"got a decryption result, but for an event that is not a message!",b))]))}return d(PT,t,!1,li,M([ya(f(up,"got a decryption result, but for an id out of bounds!",_(v,t.history)))]))}var I=p.a;return d(PT,t,!1,li,M([ya(f(up,"Error decoding decryption result",I))]))}}),UT=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),OT=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),MT=function(e){return{onBroadcast:li,onMined:fi(_(UT(e),li)),onSign:fi(OT(e))}},FT=Ge("encryptToPubkeys",Fa),VT=n(function(e,t,r){return{data:fi(f(el,"commit(address,string)",M([ag(t),Fv(r)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),KT=n(function(e,t,r){return{data:fi(f(el,"commit(address,string)",M([ag(t),Fv(r)]))),decoder:Ki(pr),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}}),HT=function(e){return{$:"CommitMined",a:e}},jT={$:"CommitNeedsSig"},qT=function(e){return{$:"CommitSigned",a:e}},GT=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?KT:VT}(),a=rp(function(){return"Token"===e.factory.$?Fa:Yv(cg(rS(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return _(fi(jT),f(Zo,{onBroadcast:li,onMined:fi(_(HT,li)),onSign:fi(qT)},a))}),zT=r(function(e,t){return vp(M([_("id",Cp(e)),_("encapsulation",cp(t.encapsulatedKey)),_("iv",cp(t.iv)),_("tag",cp(t.tag)),_("encrypted",cp(t.message))]))}),WT=Ge("decryptMessage",Fa),YT=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return _(r-1,f(Ra,_(r,e),n))});return l(wa,n,_(t-1,vr),e).b},JT=r(function(e,t){return Fo(f(Ua,function(e){var r=e.a,n=e.b,a=n.eventInfo;if("Statement"===a.$){var i=a.a,o=i.message;if("Encrypted"===o.$){var u=o.a,s=function(){return"Initiator"===t.$?u.a:u.b}();return WT(f(zT,r,s))}return Vo}return Vo},YT(e.history)))}),QT=function(e){if("Just"===e.$){return e.a}return li},XT=function(e){var t=QT(l(aT,Ro,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return fi(r)}return li}(),f(xo,function(e){return e.address},Sm(e.wallet)))),r=_(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(JT,n,a)}return Vo},ZT=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return L(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(RT,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=L(d,n||h,f(co,a,p));e=g,t=v}}),e,L(t,!1,vr))}),ew=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),tw=i(function(e,t,r,n,a){return f(ZT,n,p(ew,e,r,t,Wa,a,""))}),rw=function(e){return{$:"ChatHistoryMsg",a:e}},nw=a(function(e,t,r,n){var a=L(t,Sm(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(_o,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return L(fi(t),r,f(Ua,Xi(rw),n))}(h(tw,e,c,i,n,u))}return L(li,!1,vr)}return L(li,!1,vr)}),aw={$:"Abort"},iw=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),ow=function(e){return{$:"ActionNeedsSig",a:e}},uw=function(e){return{$:"ApproveMining",a:e}},sw={$:"ApproveNeedsSig"},cw=function(e){return{$:"ApproveSigned",a:e}},fw={$:"Burn"},lw={$:"Claim"},dw=function(e){return{$:"CommitMining",a:e}},hw=function(e){return{$:"ConfirmingAction",a:e}},pw=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),gw=function(e){return{$:"ParametersFetched",a:e}},vw=function(e){return{$:"PhaseInfoFetched",a:e}},yw={$:"Poke"},mw={$:"Recall"},bw={$:"Release"},Cw=function(e){return{$:"StartContractAction",a:e}},Ew=function(e){return{$:"StateFetched",a:e}},Sw=function(e){switch(e.$){case"Poke":return"poke";case"Recall":return"recall";case"Claim":return"claim";case"Abort":return"abort";case"Release":return"release";default:return"burn"}},Tw={align:Xh,label:"cantFindTradeWillRetry",mainParagraphs:M([M([ep("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:vm},ww=r(function(e,t){if("Err"===t.$){var r=t.a;return f(ym,e,r)}if("Nothing"===t.a.$){t.a;return f(up,"Couldn't decode the fetched \""+e+'" result.',li)}return f(up,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),Iw={align:Xh,label:"tradeParametersNotDefault",mainParagraphs:M([M([ep("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:vm},Aw=ro(eo),Bw=n(function(e,t,r){return l(th,e,xo(function(e){return D(e,{logCount:Ii(t)+e.logCount})}),r)}),kw=r(function(e,t){var r=t.a;return yC(f(eh,e,r))}),Nw=r(function(e,t){return xv(Iv(f(Bv,e,t)))}),$w=n(function(e,t,r){var n=e.a,a=f(Gd,t,n.requests);if("Nothing"===a.$)return _(vC(n),Vo);var i=a.a,o=_(i.watchOnce,ov(r));if("Nothing"===o.b.$){o.b;return _(vC(D(n,{requests:l(Bw,t,r,n.requests)})),Vo)}if(o.a){var u=o.b.a;return _(vC(D(n,{requests:l(Bw,t,r,n.requests),watching:f(kw,t,n.watching)})),f(Nw,i.tagger,wh(u)))}return _(vC(D(n,{requests:l(Bw,t,r,n.requests)})),Fo(f(Ua,function(e){return f(Nw,i.tagger,wh(e))},r)))}),Rw=Le,xw=r(function(e,t){return f(Lv,f(tu,gC,t),f(Bh,function(t){return nC(e)},Rw(2e3)))}),_w=n(function(e,t,r){var n=r.a,a=r.b;return f(ZC,e,D(t,{fromBlock:eE(n),toBlock:eE(a)}))}),Lw=n(function(e,t,r){for(;;){if("RBEmpty_elm_builtin"===r.$)return t;var n=r.b,a=r.c,i=r.d,o=r.e,u=e,s=l(e,n,a,l(Lw,e,t,i)),c=o;e=u,t=s,r=c}}),Pw=r(function(e,t){return l(Lw,Kd,t,e)}),Dw=r(function(e,t){var r=e.a,n=t.a;return yC(f(Pw,r,n))}),Uw=r(function(e,t){var r=t.a;if("BlockNumber"===e.$){if("Ok"===e.a.$){var a=e.a.a,i=n(function(e,t,n){return Fo(f(Ua,function(t){return f(Lv,f(tu,NC(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},$T(f(Ua,function(e){return f(Gd,e,r.requests)},$a(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?_(vC(D(r,{blockNumber:fi(a)})),Fo(M([f(xw,r.nodePath,r.tagger),l(i,_(u+1,a),r.watching,_w)]))):_(t,f(xw,r.nodePath,r.tagger))}return _(vC(D(r,{blockNumber:fi(a),pending:mC,watching:f(Dw,r.watching,r.pending)})),Fo(M([f(xw,r.nodePath,r.tagger),l(i,_(a,a),r.pending,tE),l(i,_(a,a),r.watching,_w)])))}var s=e.a.a;return _(vC(D(r,{errors:f(Ra,s,r.errors)})),f(xw,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l($w,t,c,d)}var s=e.b.a;return _(vC(D(r,{errors:f(Ra,s,r.errors)})),Vo)}),Ow=function(e){return M([e])},Mw=r(function(e,t){e:for(;;)switch(e.$){case"Refresh":var r=(e.a,function(){var e=t.trade;if("PartiallyLoadedTrade"===e.$){var r=e.a;return"Nothing"===r.creationInfo.$?f(hC,r.factory,r.id):Vo}}(),function(){var e=L(Sm(t.wallet),jp(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return $(jp(t.wallet),fi(a.factory))?d(Pv,n,r.address,a.creationInfo.address,oE):Vo}return Vo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(nw,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1,vr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?XT(t):Vo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(IC,u,Fo(M([l(FS,p.factory,p.creationInfo.address,Ew),s,r])),zo,o)}return uE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return uE(D(t,{blocknumOnInit:fi(v)}))}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:fi(m)}),b=L(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if($(f(cs,m,cg(rS(C.parameters))),Sa))return uE(u);var S=l(GT,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(IC,D(u,{txChainStatus:T}),Vo,w,vr)}return uE(u)}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:KS(I.blocknum)},B=l(aE,kC,t.eventSentry,{address:A.address,fromBlock:eE(A.blocknum),toBlock:Tv,topics:vr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(cS,A,t.trade)}),R=f(Kc,Aw,nS(u.trade)),x=Fo(M([N,h(VS,R,A.address,gw,Ew,vw)]));return d(IC,u,x,zo,vr)}if("BadBody"===g.a.$){g.a.a;return d(IC,t,Vo,zo,M([ya(Tw)]))}var y=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(dS,P,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,t,Vo,zo,M([ya(f(ww,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(aS(F)){var u=D(t,{trade:f(fS,F,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,D(t,{trade:vE}),Vo,zo,M([ya(Iw)]))}var V=g.a.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(IC,t,Vo,zo,M([ya(f(ym,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(lS,H,t.trade)});return d(IC,u,XT(u),zo,vr)}return d(IC,t,Vo,zo,M([ya(f(ww,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(iv,tS,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error decoding contract event",z))]))}var W=G.a,Y=function(){switch(W.$){case"InitiatedEvent":var e=W.a;return f(eT,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=W.a;return f(tT,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===W.$){var e=W.a,r=BE(e.terms);if("Ok"===r.$){var n=r.a;return _(f(hS,n,t.trade),li)}var a=r.a;return _(t.trade,fi(f(up,"Couldn't decode payment methods!",a)))}return _(t.trade,li)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return L(fi(r),!1,vr)}return d(nw,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return _(function(e){var t=e.a,r=e.b,n=e.c;return L(fi(t),r||te,f(co,re,f(Ua,Xi(rw),n)))}(l(RT,q.blockNumber,W,e)),vr)}return _(L(li,!1,re),f(co,t.eventsWaitingForChatHistory,M([_(q.blockNumber,W)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=D(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:Y,trade:Q}),x=oe?XT(u):Vo;return d(IC,u,x,zo,f(co,f(Ua,ya,$T(M([X]))),ue));case"ExpandPhase":var ce=e.a;return uE(D(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return uE(D(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return uE(D(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var C=de.a;return d(IC,t,Vo,zo,M([ga(pb(C.parameters.initiatorAddress))]))}return d(IC,t,Vo,zo,M([ya(f(up,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,he=e.c;return uE(D(t,{txChainStatus:fi(f(pw,E,he))}));case"AbortAction":return uE(D(t,{txChainStatus:li}));case"ConfirmCommit":var C=e.a,E=e.b,he=e.c,pe=function(){var e=C.factory;if("Native"===e.$)return l(GT,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=rp(l(ug,rg(r),C.creationInfo.address,he)),t={onBroadcast:li,onMined:li,onSign:fi(cw)};return f(Zo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(cs,i,cg(rS(C.parameters))),Sa)?_(fi(sw),n):l(GT,C,E.address,E.commPubkey)}return _(fi(sw),n)}(),T=pe.a,w=pe.b;return d(IC,D(t,{txChainStatus:T}),Vo,w,vr);case"ContractActionClicked":var ge=e.a;if($(ge,yw)||$(ge,mw)){var ve=Cw(ge),ye=t;e=ve,t=ye;continue e}return uE(D(t,{txChainStatus:fi(hw(ge))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return L(t.txChainStatus,zo,M([ya(f(up,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=rp(hE(n.creationInfo.address));return L(fi(ow(mw)),f(Zo,MT(mw),a),vr);case"Claim":var a=rp(lE(n.creationInfo.address));return L(fi(ow(lw)),f(Zo,MT(lw),a),vr);case"Abort":var a=rp(cE(n.creationInfo.address));return L(fi(ow(aw)),f(Zo,MT(aw),a),vr);case"Release":var a=rp(pE(n.creationInfo.address));return L(fi(ow(bw)),f(Zo,MT(bw),a),vr);case"Burn":var a=rp(fE(n.creationInfo.address));return L(fi(ow(fw)),f(Zo,MT(fw),a),vr);default:var a=rp(tl(n.creationInfo.address));return L(fi(ow(yw)),f(Zo,MT(yw),a),vr)}}(),T=be.a,w=be.b,o=be.c;return d(IC,D(t,{txChainStatus:T}),Vo,w,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(uw(Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(dw(Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,"commit",V))]));case"CommitMined":return uE(D(t,{txChainStatus:li}));case"ActionSigned":var ge=e.a,Ce=e.b;if("Ok"===Ce.$){var Ee=Ce.a;return uE(D(t,{txChainStatus:fi(f(iw,ge,Ee))}))}var V=Ce.a;return d(IC,D(t,{txChainStatus:li}),Vo,zo,M([ya(f(bm,Sw(ge),V))]));case"ActionMined":var ge=e.a;return uE(D(t,{txChainStatus:li}));case"EventSentryMsg":var Se=e.a,Te=f(Uw,Se,t.eventSentry),we=Te.a,x=Te.b;return d(IC,D(t,{eventSentry:we}),x,zo,vr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(DT,Ie,Be),Ne=D(t,{chatHistoryModel:fi(ke.model)}),s=ke.shouldCallDecrypt?XT(t):Vo,$e=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return _(FT(f(JS,r,a)),li)}return _(Vo,fi(f(up,"Trying to encrypt, but commInfo is not loaded",n)))}return _(Vo,li)}(),Re=$e.a,xe=$e.b;return d(IC,Ne,Fo(M([s,Re])),zo,U(f(Zi,rw,ke.cmdUps),f(Kc,vr,f(xo,Ow,f(xo,ya,xe)))))}return d(IC,t,Vo,zo,M([ya(f(up,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var _e=e.a,Le=f(uv,YS,zS(_e)),Pe=L(t.wallet,t.trade,Le);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var E=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(Ro,p,E.address);if("Nothing"===Ue.$)return d(IC,t,Vo,zo,M([ya(f(up,"Trying to encrypt, but the user is not involved in this trade.",li))]));var Oe=Ue.a,Me=function(){return rp("Initiator"===Oe.$?f(dE,p.creationInfo.address,De):f(gE,p.creationInfo.address,De))}();return d(IC,t,Vo,f(Zo,{onBroadcast:li,onMined:li,onSign:li},Me),vr)}var Fe=Pe.a,Ve=Pe.b;return d(IC,t,Vo,zo,M([ya(f(up,"Encryption successful, but the user or trade is no longer valid.",_(Fe,Ve)))]))}var Ke=Pe.c.a;return d(IC,t,Vo,zo,M([ya(f(up,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return uE(t)}var V=e.a.a;return d(IC,t,Vo,zo,M([ya(f(mm,"message",V))]));case"Web3Connect":return d(IC,t,Vo,zo,M([ma]));default:return uE(t)}}),Fw=r(function(e,t){return{address:e,blocknum:t}}),Vw=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return fi(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return li}},Kw=n(function(e,t,r){return function(e){return _(e.a,e.b)}(d(nE,!0,e,t,r))}),Hw=n(function(e,t,r){var n=function(e){return r(f(iv,OE,e).returnData)},a={address:t.address,fromBlock:eE(t.blocknum),toBlock:eE(t.blocknum),topics:M([fi(eS("Initiated(string,string)"))])};return l(Kw,n,e,a)}),jw=function(e){return{data:fi(f(el,"numTrades()",vr)),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},qw=r(function(e,t){return f(Lv,t,f(wv,fv(e),jw(tg(e))))}),Gw=function(e){return{data:fi(f(el,"phase()",vr)),decoder:wu(tv),from:li,gas:li,gasPrice:li,nonce:li,to:fi(e),value:li}},zw=n(function(e,t,r){return f(Lv,r,f(Bv,DS,f(wv,fv(e),Gw(t))))}),Ww=function(e){return f(_h,function(e){if("LoadedTrade"===e.$){var t=e.a;return fi(t)}return li},Ia(e.trades))},Yw=function(e){return f(_a,r(function(t,r){return e(t)?r+1:r}),0)},Jw=function(e){return f(Yw,Za(vE),Ia(e.trades))},Qw=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:Jw(e),loaded:Ii(Ww(e))})})},Xw=n(function(e,t,r){return{cmd:t,cmdUps:r,tradeCache:e}}),Zw=r(function(e,t){var r=f(sf,e,t.trades);if("Just"===r.$){var n=(r.a,l(hf,e,vE,t.trades));return l(Xw,Qw(D(t,{trades:n})),Vo,vr)}return l(Xw,t,Vo,M([ya(f(up,"markTradeInvalid ran into an out-of-range error",_(e,t.trades)))]))}),eI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(cS,t,a),o=l(hf,e,i,r.trades);return _(Qw(D(r,{trades:o})),vr)}return _(r,M([f(up,"updateTradeAddress ran into an out-of-range error",_(e,r.trades))]))}),tI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(fS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradeParameters ran into an out-of-range error",_(e,r.trades)))]))}),rI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(hf,e,BC(D(a,{state:D(i,{phase:t})})),r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhase is trying to update a partially loaded trade",_(e,r.trades)))]))}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhase ran into an out-of-range error",_(e,r.trades)))]))}),nI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(lS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradePhaseTimeInfo ran into an out-of-range error",_(e,r.trades)))]))}),aI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(dS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTradeState ran into an out-of-range error",_(e,r.trades)))]))}),iI=n(function(e,t,r){var n=f(sf,e,r.trades);if("Just"===n.$){var a=n.a,i=f(hS,t,a),o=l(hf,e,i,r.trades);return l(Xw,Qw(D(r,{trades:o})),Vo,vr)}return l(Xw,r,Vo,M([ya(f(up,"updateTTPaymentMethods ran into an out-of-range error",_(e,r.trades)))]))}),oI=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),uI=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),sI=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),cI=function(e){return{$:"NumTradesFetchedAgain",a:e}},fI=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),lI=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),dI=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),hI=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),pI=function(e){return l(Xw,e,Vo,vr)},gI=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=KS(n),i=qS(f(Ua,eC(t.factory),f(ki,0,a-1))),o=Fo(f(Ua,function(e){return l(lC,t.factory,Zu(e),oI(e))},f(ki,0,a-1)));return l(Xw,D(t,{dataFetchState:l(uI,fi(a),0,0),trades:i}),o,vr)}var u=r.a;return l(Xw,t,Vo,M([ya(f(ym,"Factory numTrades",u))]));case"CheckForNewTrades":return l(Xw,t,f(qw,t.factory,cI),vr);case"UpdateTradePhases":var s=Fo($T(f(Ua,function(e){return"Closed"===e.state.phase.$?li:fi(l(zw,e.factory,e.creationInfo.address,f(lI,e.factory,e.id)))},Ww(t))));return l(Xw,t,s,vr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(rI,d,p,t),v=function(){var e=_(p,f(sf,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=Vw(r);if("Just"===n.$){var a=n.a;return _(l(FS,c,a.address,hI(d)),vr)}return _(Vo,M([ya(f(up,"Phase fetched for a trade that has no creationInfo",r))]))}return _(Vo,vr)}e.b;return _(Vo,M([ya(f(up,"Phase fetched for a trade, but then ran into an out-of-range error",li))]))}(),y=v.a,m=v.b;return l(Xw,g.tradeCache,Fo(M([g.cmd,y])),f(co,g.cmdUps,m))};return l(Xw,t,Vo,M([ya(f(ww,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=_(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=KS(n);if(x(C,E)<0){var S=t.dataFetchState,o=Fo(f(Ua,function(e){return l(lC,t.factory,Zu(e),oI(e))},f(ki,C,E-1))),T=qS(f(Ua,eC(t.factory),f(ki,C,E-1)));return l(Xw,D(t,{dataFetchState:D(S,{total:fi(E)}),trades:f(kT,t.trades,T)}),o,vr)}return pI(t)}b.b;return l(Xw,t,Vo,M([ya(f(up,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(Xw,t,Vo,M([ya(f(ym,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(Fw,w.address_,KS(w.blocknum)),A=l(Hw,t.eventSentry,I,sI(d)),B=A.a,k=A.b,y=Fo(M([h(VS,t.factory,I.address,fI(d),hI(d),dI(d)),k])),N=l(eI,d,I,t),$=N.a,R=N.b;return l(Xw,Qw(D($,{eventSentry:B})),y,f(Ua,ya,R))}var u=r.a;return l(Xw,t,Vo,M([ya(f(ym,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var L=r.a;return l(Xw,t,Vo,M([ya(f(ym,"parameters",L))]))}if("Ok"===r.a.$){var P=r.a.a;return l(tI,d,P,t)}var U=r.a.a;return l(Xw,t,Vo,M([ya(f(up,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(aI,d,O,t)}return l(Xw,t,Vo,M([ya(f(ww,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(nI,d,F,t)}return l(Xw,t,Vo,M([ya(f(ww,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=BE(V.terms);if("Ok"===K.$){var H=K.a;return l(iI,d,H,t)}var j=K.a;return f(Zw,d,t)}var j=r.a;return l(Xw,t,Vo,M([ya(f(up,"Error decoding initiated event",j))]));default:var q=e.a,G=f(Uw,q,t.eventSentry),z=G.a,y=G.b;return l(Xw,D(t,{eventSentry:z}),y,vr)}}),vI=function(e){return{$:"AgentHistoryModel",a:e}},yI=function(e){return{$:"AgentHistoryMsg",a:e}},mI=function(e){return{$:"CmdUp",a:e}},bI={$:"ConnectToWeb3"},CI=function(e){return{$:"CreateModel",a:e}},EI=function(e){return{$:"CreateMsg",a:e}},SI=function(e){return{$:"GotoRoute",a:e}},TI=function(e){return{$:"MarketplaceModel",a:e}},wI=function(e){return{$:"MarketplaceMsg",a:e}},II=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),AI=function(e){return{$:"TradeModel",a:e}},BI=function(e){return{$:"TradeMsg",a:e}},kI=r(function(e,t){return f(Nn,e,cp(t))}),NI=function(e){return f(kI,"href",nt(e))},$I=$n("rel"),RI=kI("target"),xI=function(e){return{$:"Height",a:e}},_I=xI,LI={$:"Content"},PI=LI,DI=function(e){return{$:"Width",a:e}},UI=DI,OI=function(e){return{$:"Attr",a:e}},MI=function(e){return{$:"NodeName",a:e}},FI=function(e){return{$:"Unkeyed",a:e}},VI={$:"AsEl"},KI=VI,HI=r(function(e,t){return{$:"Field",a:e,b:t}}),jI=f(HI,0,0),qI={$:"NoNearbyChildren"},GI={above:"a",active:"atv",alignBottom:"ab",alignCenterX:"cx",alignCenterY:"cy",alignContainerBottom:"acb",alignContainerCenterX:"accx",alignContainerCenterY:"accy",alignContainerRight:"acr",alignLeft:"al",alignRight:"ar",alignTop:"at",alignedHorizontally:"ah",alignedVertically:"av",any:"s",behind:"bh",below:"b",bold:"w7",borderDashed:"bd",borderDotted:"bdt",borderNone:"bn",borderSolid:"bs",capturePointerEvents:"cpe",clip:"cp",clipX:"cpx",clipY:"cpy",column:"c",container:"ctr",contentBottom:"cb",contentCenterX:"ccx",contentCenterY:"ccy",contentLeft:"cl",contentRight:"cr",contentTop:"ct",cursorPointer:"cptr",cursorText:"ctxt",focus:"fcs",focusedWithin:"focus-within",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightExact:"he",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputMultilineFiller:"imlf",inputMultilineParent:"imlp",inputMultilineWrapper:"implw",inputText:"it",italic:"i",link:"lnk",nearby:"nb",noTextSelection:"notxt",onLeft:"ol",onRight:"or",opaque:"oq",overflowHidden:"oh",page:"pg",paragraph:"p",passPointerEvents:"ppe",root:"ui",row:"r",scrollbars:"sb",scrollbarsX:"sbx",scrollbarsY:"sby",seButton:"sbt",single:"e",sizeByCapital:"cap",spaceEvenly:"sev",strike:"sk",text:"t",textCenter:"tc",textExtraBold:"w8",textExtraLight:"w2",textHeavy:"w9",textJustify:"tj",textJustifyAll:"tja",textLeft:"tl",textLight:"w3",textMedium:"w5",textNormalWeight:"w4",textRight:"tr",textSemiBold:"w6",textThin:"w1",textUnitalicized:"tun",transition:"ts",transparent:"clr",underline:"u",widthContent:"wc",widthExact:"we",widthFill:"wf",widthFillPortion:"wfp",wrapped:"wrp"},zI=GI.any+" "+GI.column,WI=GI.any+" "+GI.grid,YI=GI.any+" "+GI.page,JI=GI.any+" "+GI.paragraph,QI=GI.any+" "+GI.row,XI=GI.any+" "+GI.single,ZI=function(e){switch(e.$){case"AsRow":return QI;case"AsColumn":return zI;case"AsEl":return XI;case"AsGrid":return WI;case"AsParagraph":return JI;default:return YI}},eA=function(e){return{$:"Keyed",a:e}},tA={$:"NoStyleSheet"},rA=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),nA=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(Ua,function(t){return _(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(Ua,function(t){return _(e,t)},a));default:var n=r.a,a=r.b;return U(f(Ua,function(t){return _(e,t)},n),U(t,f(Ua,function(t){return _(e,t)},a)))}}),aA={$:"AsParagraph"},iA=aA,oA=Tn("div"),uA=Tn("p"),sA=Tn("s"),cA=Tn("u"),fA=kI("className"),lA=function(e){return In(et(e))},dA=function(e){return Tn(et(e))},hA=function(e){return{$:"Flag",a:e}},pA=function(e){return{$:"Second",a:e}},gA=function(e){return e>31?pA(1< .ctr > ."+GI.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",vB="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+DA(GI.any)+DA(GI.row)+" > "+DA(GI.any)+" { flex-basis: auto !important; } "+DA(GI.any)+DA(GI.row)+" > "+DA(GI.any)+DA(GI.container)+' { flex-basis: auto !important; }}\ninput[type="search"],\ninput[type="search"]::-webkit-search-decoration,\ninput[type="search"]::-webkit-search-cancel-button,\ninput[type="search"]::-webkit-search-results-button,\ninput[type="search"]::-webkit-search-results-decoration {\n -webkit-appearance:none;\n}\n\ninput[type=range] {\n -webkit-appearance: none; \n background: transparent;\n position:absolute;\n left:0;\n top:0;\n z-index:10;\n width: 100%;\n outline: dashed 1px;\n height: 100%;\n opacity: 0;\n}\n\ninput[type=range]::-moz-range-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-ms-track {\n background: transparent;\n cursor: pointer;\n}\ninput[type=range]::-webkit-slider-runnable-track {\n background: transparent;\n cursor: pointer;\n}\n\ninput[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-moz-range-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range]::-ms-thumb {\n opacity: 0.5;\n width: 80px;\n height: 80px;\n background-color: black;\n border:none;\n border-radius: 5px;\n}\ninput[type=range][orient=vertical]{\n writing-mode: bt-lr; /* IE */\n -webkit-appearance: slider-vertical; /* WebKit */\n}\n'+gB,yB=function(e){return{$:"Intermediate",a:e}},mB=r(function(e,t){return yB({closing:t,others:vr,props:vr,selector:e})}),bB=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(Ra,_(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(Ra,yB({closing:"\n}",others:vr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(Ra,f(bB,f(mB,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(Ra,f(bB,f(mB,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(Ra,f(bB,f(mB,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(Ra,f(bB,f(mB,n.selector,""),v),t.others)})}});return yB(l(Da,a,n,t))}),CB=U(vB,function(e){var t=function(e){return qy(f(Ua,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),qy(f(Ua,a,t.others)))};return qy(f(Ua,a,l(Da,r(function(e,t){var r=e.a,n=e.b;return f(Ra,f(bB,f(mB,r,""),n),t)}),vr,e)))}(U(dB,pB))),EB=function(e){switch(e.mode.$){case"Layout":return l(dA,"div",vr,M([l(dA,"style",vr,M([MA(CB)]))]));case"NoStaticStyleSheet":return MA("");default:return l(dA,"elm-ui-static-rules",M([f(OA,"rules",cp(CB))]),vr)}},SB=function(e){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return'"'+t+'"';case"ImportFont":var t=e.a;e.b;return'"'+t+'"';default:var t=e.a.name;return'"'+t+'"'}},TB=function(e){switch(e.$){case"VariantActive":var t=e.a;return"smcp"===t;case"VariantOff":var t=e.a;return!1;default:var t=e.a,r=e.b;return"smcp"===t&&1===r}},wB=function(e){if("FontWith"===e.$){var t=e.a;return f(fo,TB,t.variants)}return!1},IB=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),AB=a(function(e,t,r,n){if("Nothing"===t.$)return M([r+"{"+l(_a,IB(!1),"",n)+"\n}"]);switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return vr;case"ForceHover":return M([r+"-hv {"+l(_a,IB(!0),"",n)+"\n}"]);default:return M([r+"-hv:hover {"+l(_a,IB(!1),"",n)+"\n}"])}case"Focus":var a=l(_a,IB(!1),"",n);return M([r+"-fs:focus {"+a+"\n}","."+GI.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+GI.any+":focus "+r+"-fs {"+a+"\n}",r+"-fs:focus-within {"+a+"\n}",".focusable-parent:focus ~ ."+GI.any+" "+r+"-fs {"+a+"\n}"]);default:return M([r+"-act:active {"+l(_a,IB(!1),"",n)+"\n}"])}}),BB=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+Ri(r)}},kB=function(e){if("FontWith"===e.$){var t=e.a;return fi(f(xi,", ",f(Ua,BB,t.variants)))}return li},NB=function(e){switch(e.$){case"Untransformed":return li;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return fi("translate3d("+uy(r)+"px, "+uy(n)+"px, "+uy(a)+"px)");default:var i=e.a,o=i.a,u=i.b,s=i.c,c=e.b,f=c.a,l=c.b,d=c.c,h=e.c,p=h.a,g=h.b,v=h.c,y=e.d,m="translate3d("+uy(o)+"px, "+uy(u)+"px, "+uy(s)+"px)",b="scale3d("+uy(f)+", "+uy(l)+", "+uy(d)+")",C="rotate3d("+uy(p)+", "+uy(g)+", "+uy(v)+", "+uy(y)+"rad)";return fi(m+" "+b+" "+C)}},$B=n(function(e,t,r){switch(t.$){case"Style":var a=t.a,i=t.b;return d(AB,e,r,a,i);case"Shadows":var o=t.a,u=t.b;return d(AB,e,r,"."+o,M([f(xA,"box-shadow",u)]));case"Transparency":var o=t.a,s=t.b,c=f(ni,0,f(Rc,1,1-s));return d(AB,e,r,"."+o,M([f(xA,"opacity",uy(c))]));case"FontSize":var h=t.a;return d(AB,e,r,".font-size-"+Ri(h),M([f(xA,"font-size",Ri(h)+"px")]));case"FontFamily":var o=t.a,p=t.b,g=f(xi,", ",f(_h,kB,p)),v=M([f(xA,"font-family",f(xi,", ",f(Ua,SB,p))),f(xA,"font-feature-settings",g),f(xA,"font-variant",f(fo,wB,p)?"small-caps":"normal")]);return d(AB,e,r,"."+o,v);case"Single":var y=t.a,u=t.b,m=t.c;return d(AB,e,r,"."+y,M([f(xA,u,m)]));case"Colored":var y=t.a,u=t.b,b=t.c;return d(AB,e,r,"."+y,M([f(xA,u,LA(b))]));case"SpacingStyle":var C=t.a,E=t.b,S=t.c,T=Ri(S)+"px",w=Ri(E)+"px",I="."+GI.row,A="."+(GI.wrapped+I),B="."+GI.alignRight,k="."+GI.paragraph,N="."+GI.page,$="."+GI.alignLeft,R=uy(S/2)+"px",x=uy(E/2)+"px",L="."+GI.column,y="."+C,P="."+GI.any;return kb(M([d(AB,e,r,y+(I+" > ")+P+" + "+P,M([f(xA,"margin-left",w)])),d(AB,e,r,y+(A+" > ")+P,M([f(xA,"margin",R+" "+x)])),d(AB,e,r,y+(L+" > ")+P+" + "+P,M([f(xA,"margin-top",T)])),d(AB,e,r,y+(N+" > ")+P+" + "+P,M([f(xA,"margin-top",T)])),d(AB,e,r,y+(N+" > ")+$,M([f(xA,"margin-right",w)])),d(AB,e,r,y+(N+" > ")+B,M([f(xA,"margin-left",w)])),d(AB,e,r,U(y,k),M([f(xA,"line-height","calc(1em + "+Ri(S)+"px)")])),d(AB,e,r,"textarea"+(P+y),M([f(xA,"line-height","calc(1em + "+Ri(S)+"px)"),f(xA,"height","calc(100% + "+Ri(S)+"px)")])),d(AB,e,r,y+(k+" > ")+$,M([f(xA,"margin-right",w)])),d(AB,e,r,y+(k+" > ")+B,M([f(xA,"margin-left",w)])),d(AB,e,r,y+(k+"::after"),M([f(xA,"content","''"),f(xA,"display","block"),f(xA,"height","0"),f(xA,"width","0"),f(xA,"margin-top",Ri(-1*(S/2|0))+"px")])),d(AB,e,r,y+(k+"::before"),M([f(xA,"content","''"),f(xA,"display","block"),f(xA,"height","0"),f(xA,"width","0"),f(xA,"margin-bottom",Ri(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=t.a,D=t.b,B=t.c,O=t.d,$=t.e,y="."+C;return d(AB,e,r,y,M([f(xA,"padding",Ri(D)+"px "+Ri(B)+"px "+Ri(O)+"px "+Ri($)+"px")]));case"BorderWidth":var C=t.a,D=t.b,B=t.c,O=t.d,$=t.e,y="."+C;return d(AB,e,r,y,M([f(xA,"border-width",Ri(D)+"px "+Ri(B)+"px "+Ri(O)+"px "+Ri($)+"px")]));case"GridTemplateStyle":var F=t.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ri(n)+"px";case"Content":var a=_(e,t);if("Nothing"===a.a.$){if("Nothing"===a.b.$){a.a,a.b;return"max-content"}var i=(a.a,a.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ri(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Fill":var u=r.a,s=_(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Ri(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ri(o)+"px, "+Ri(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Min":var c=r.a,f=r.b,l=fi(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=fi(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,li,li,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(xi," ",f(Ua,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(xi,H,f(Ua,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(xi,H,f(Ua,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",W="grid-column-gap:"+K(F.spacing.a)+";",Y=function(e){return"grid-template-columns: "+e+";"}(f(xi," ",f(Ua,K,F.columns))),y=".grid-rows-"+f(xi,"-",f(Ua,BA,F.rows))+"-cols-"+f(xi,"-",f(Ua,BA,F.columns))+"-space-x-"+BA(F.spacing.a)+"-space-y-"+BA(F.spacing.b),J=y+"{"+Y+j+W+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return M([X,Q]);case"GridPosition":var Z=t.a,ee=f(xi," ",M(["-ms-grid-row: "+Ri(Z.row)+";","-ms-grid-row-span: "+Ri(Z.height)+";","-ms-grid-column: "+Ri(Z.col)+";","-ms-grid-column-span: "+Ri(Z.width)+";"])),te=f(xi," ",M(["grid-row: "+Ri(Z.row)+" / "+Ri(Z.row+Z.height)+";","grid-column: "+Ri(Z.col)+" / "+Ri(Z.col+Z.width)+";"])),y=".grid-pos-"+Ri(Z.row)+"-"+Ri(Z.col)+"-"+Ri(Z.width)+"-"+Ri(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return M([X,Q]);case"PseudoSelector":var y=t.a,re=t.b;return f(Nb,function(t){return l($B,e,t,fi(y))},re);default:var ne=t.a,m=NB(ne),y=NA(ne),ae=_(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return d(AB,e,r,"."+C,M([f(xA,"transform",ie)]))}return vr}}),RB=r(function(e,t){return vp(f(Ua,function(t){var r=l($B,e,t,li);return _($A(t),f(av,cp,r))},t))}),xB=r(function(e,t){return e+" {"+f(xi,"",f(Ua,function(e){return e.a+": "+e.b+";"},t))+"}"}),_B=n(function(e,t,r){var n=r.a,a=r.b;return M([f(xB,"."+e+"."+t+", ."+e+" ."+t,n),f(xB,"."+e+"."+t+"> ."+GI.text+", ."+e+" ."+t+" > ."+GI.text,a)])}),LB=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(xi," ",U(l(_B,i,GI.sizeByCapital,a),l(_B,i,GI.fullSize,n)))}),PB=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(xi," ",M([f(xB,"."+r+"."+GI.sizeByCapital+", ."+r+" ."+GI.sizeByCapital,M([_("line-height","1")])),f(xB,"."+r+"."+GI.sizeByCapital+"> ."+GI.text+", ."+r+" ."+GI.sizeByCapital+" > ."+GI.text,M([_("vertical-align","0"),_("line-height","1")]))]))}),DB=function(e){if(e.b){var t=e.a,r=e.b;return fi(l(_a,ni,t,r))}return li},UB=function(e){if(e.b){var t=e.a,r=e.b;return fi(l(_a,Rc,t,r))}return li},OB=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),MB=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(Kc,e.descender,UB(t)),n=f(Kc,e.baseline,UB(f(pp,function(e){return!$(e,r)},t))),a=f(Kc,e.capital,DB(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(OB,i,a-n,o),full:l(OB,u,a-r,s)}},FB=function(e){return _(M([_("display","block")]),M([_("display","inline-block"),_("line-height",uy(e.height)),_("vertical-align",uy(e.vertical)+"em"),_("font-size",uy(e.size)+"em")]))},VB=function(e){return l(_a,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return fi(_(FB(function(e){return e.full}(MB(a))),FB(function(e){return e.capital}(MB(a)))))}return t}return t}),li,e)},KB=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return fi("@import url('"+t+"');")}return li},r=function(e){var r=(e.a,e.b);return f(xi,"\n",f(_h,t,r))},n=f(Ua,ei,e),a=function(e){var t=e.a,r=e.b,a=VB(r);if("Nothing"===a.$)return f(xi,"",f(Ua,PB(t),n));var i=a.a;return f(xi,"",f(Ua,f(LB,t,i),n))};return U(f(xi,"\n",f(Ua,r,e)),f(xi,"\n",f(Ua,a,e)))},HB=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return fi(_(t,r))}return li},jB=r(function(e,t){var n=r(function(t,r){return{rules:U(r.rules,l($B,e,t,li)),topLevel:function(){var e=HB(t);if("Nothing"===e.$)return r.topLevel;var n=e.a;return f(Ra,n,r.topLevel)}()}}),a=l(_a,n,{rules:vr,topLevel:vr},t),i=a.topLevel,o=a.rules;return U(KB(i),qy(o))}),qB=r(function(e,t){switch(e.mode.$){case"Layout":case"NoStaticStyleSheet":return l(dA,"div",vr,M([l(dA,"style",vr,M([MA(f(jB,e,t))]))]));default:return l(dA,"elm-ui-rules",M([f(OA,"rules",f(RB,e,t))]),vr)}}),GB=a(function(e,t,r,n){var a=f(qB,t,l(_a,RA,_(mC,UA(t.focus)),r).b);return e?f(Ra,_("static-stylesheet",EB(t)),f(Ra,_("dynamic-stylesheet",a),n)):f(Ra,_("dynamic-stylesheet",a),n)}),zB=a(function(e,t,r,n){var a=f(qB,t,l(_a,RA,_(mC,UA(t.focus)),r).b);return e?f(Ra,EB(t),f(Ra,a,n)):f(Ra,a,n)}),WB=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(lA,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(GB,!1,e,t,r);default:var e=i.a,t=i.b;return d(GB,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return oA;case"p":return uA;default:return dA(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(zB,!1,e,t,n);default:var e=i.a,t=i.b;return d(zB,!0,e,t,n)}}())}),s=function(){switch(t.$){case"Generic":return f(u,"div",n);case"NodeName":var e=t.a;return f(u,e,n);default:var e=t.a,r=t.b;return l(dA,e,n,M([f(u,r,M([fA(GI.any+" "+GI.single)]))]))}}();switch(o.$){case"AsRow":return f(SA,wA,e)&&!f(SA,TA,e)?s:f(SA,yA,e)?f(cA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.contentCenterY,GI.alignContainerRight])))]),M([s])):f(SA,mA,e)?f(sA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.contentCenterY,GI.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(SA,EA,e)&&!f(SA,CA,e)?s:f(SA,bA,e)?f(sA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.alignContainerCenterY])))]),M([s])):f(SA,vA,e)?f(cA,M([fA(f(xi," ",M([GI.any,GI.single,GI.container,GI.alignContainerBottom])))]),M([s])):s;default:return s}}),YB=MA,JB=GI.any+" "+GI.text+" "+GI.widthContent+" "+GI.heightContent,QB=function(e){return f(oA,M([fA(JB)]),M([YB(e)]))},XB=GI.any+" "+GI.text+" "+GI.widthFill+" "+GI.heightFill,ZB=function(e){return f(oA,M([fA(XB)]),M([YB(e)]))},ek=n(function(e,t,n){var a=r(function(t,r){var n=t.a,a=t.b,i=r.a,o=r.b;switch(a.$){case"Unstyled":var u=a.a;return $(e,iA),_(f(Ra,_(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,iA),_(f(Ra,_(n,f(s.html,tA,e)),i),_u(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return _(f(Ra,_(n,$(e,KI)?ZB(c):QB(c)),i),o);default:return _(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,iA),_(f(Ra,i(e),n),a);case"Styled":var o=t.a;return $(e,iA),_(f(Ra,f(o.html,tA,e),n),_u(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return _(f(Ra,$(e,KI)?ZB(u):QB(u),n),a);default:return _(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Da,a,_(vr,vr),o),s=u.a,c=u.b,p=_u(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return Gi({html:d(WB,n.has,n.node,n.attributes,eA(l(nA,"nearby-element-pls",s,n.children))),styles:g})}return Wi(h(WB,n.has,n.node,n.attributes,eA(l(nA,"nearby-element-pls",s,n.children)),tA))}var v=t.a,y=l(Da,i,_(vr,vr),v),m=y.a,c=y.b,p=_u(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return Gi({html:d(WB,n.has,n.node,n.attributes,FI(f(rA,m,n.children))),styles:g})}return Wi(h(WB,n.has,n.node,n.attributes,FI(f(rA,m,n.children)),tA))}),tk=r(function(e,t){return f($n,tt(e),at(t))}),rk=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(HI,a|r,n)}var i=e.a;return f(HI,r,i|n)}),nk=gA(7),ak=gA(36),ik=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(HI,r|a,n|i)}),ok=gA(6),uk=gA(38),sk=gA(30),ck=gA(29),fk=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),lk=function(e){return{$:"Transform",a:e}},dk=function(e){return{$:"ChildrenBehind",a:e}},hk=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),pk=function(e){return{$:"ChildrenInFront",a:e}},gk=r(function(e,t){return f(oA,M([fA(function(){switch(e.$){case"Above":return f(xi," ",M([GI.nearby,GI.single,GI.above]));case"Below":return f(xi," ",M([GI.nearby,GI.single,GI.below]));case"OnRight":return f(xi," ",M([GI.nearby,GI.single,GI.onRight]));case"OnLeft":return f(xi," ",M([GI.nearby,GI.single,GI.onLeft]));case"InFront":return f(xi," ",M([GI.nearby,GI.single,GI.inFront]));default:return f(xi," ",M([GI.nearby,GI.single,GI.behind]))}}())]),M([function(){switch(t.$){case"Empty":return MA("");case"Text":var e=t.a;return QB(e);case"Unstyled":return(0,t.a)(KI);default:return f(t.a.html,tA,KI)}}()]))}),vk=n(function(e,t,r){var n=f(gk,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?dk(M([n])):pk(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?dk(f(Ra,n,a)):f(hk,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(hk,M([n]),i):pk(f(Ra,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(hk,f(Ra,n,a),i):f(hk,a,f(Ra,n,i))}}),yk=r(function(e,t){return{$:"Embedded",a:e,b:t}}),mk=r(function(e,t){switch(t.$){case"Generic":return MI(e);case"NodeName":var r=t.a;return f(yk,r,e);default:var n=t.a,a=t.b;return f(yk,n,a)}}),bk=function(e){switch(e.$){case"Left":return GI.alignedHorizontally+" "+GI.alignLeft;case"Right":return GI.alignedHorizontally+" "+GI.alignRight;default:return GI.alignedHorizontally+" "+GI.alignCenterX}},Ck=function(e){switch(e.$){case"Top":return GI.alignedVertically+" "+GI.alignTop;case"Bottom":return GI.alignedVertically+" "+GI.alignBottom;default:return GI.alignedVertically+" "+GI.alignCenterY}},Ek=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),Sk=function(e){return{$:"Moved",a:e}},Tk=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return Sk(L(r,0,0));case"MoveY":var n=t.a;return Sk(L(0,n,0));case"MoveZ":var a=t.a;return Sk(L(0,0,a));case"MoveXYZ":var i=t.a;return Sk(i);case"Rotate":var i=t.a,o=t.b;return d(Ek,L(0,0,0),L(1,1,1),i,o);default:var i=t.a;return d(Ek,L(0,0,0),i,L(0,0,1),0)}case"Moved":var u=e.a,r=u.a,n=u.b,a=u.c;switch(t.$){case"MoveX":var s=t.a;return Sk(L(s,n,a));case"MoveY":var c=t.a;return Sk(L(r,c,a));case"MoveZ":var f=t.a;return Sk(L(r,n,f));case"MoveXYZ":var i=t.a;return Sk(i);case"Rotate":var i=t.a,o=t.b;return d(Ek,u,L(1,1,1),i,o);default:var l=t.a;return d(Ek,u,l,L(0,0,1),0)}default:var u=e.a,r=u.a,n=u.b,a=u.c,h=e.b,p=e.c,o=e.d;switch(t.$){case"MoveX":var s=t.a;return d(Ek,L(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(Ek,L(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(Ek,L(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(Ek,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(Ek,u,h,v,y);default:var m=t.a;return d(Ek,u,m,p,o)}}}),wk=function(e){switch(e.$){case"Px":var t=e.a,r=Ri(t),n="height-px-"+r;return L(jI,GI.heightExact+" "+n,M([l(fk,n,"height",r+"px")]));case"Content":return L(f(rk,ak,jI),GI.heightContent,vr);case"Fill":var a=e.a;return 1===a?L(f(rk,EA,jI),GI.heightFill,vr):L(f(rk,EA,jI),GI.heightFillPortion+" height-fill-"+Ri(a),M([l(fk,GI.any+"."+GI.column+" > "+DA("height-fill-"+Ri(a)),"flex-grow",Ri(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ri(i),s=l(fk,u,"min-height",Ri(i)+"px"),c=wk(o),d=c.a,h=c.b,p=c.c;return L(f(rk,CA,d),u+" "+h,f(Ra,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ri(g),s=l(fk,u,"max-height",Ri(g)+"px"),v=wk(o),d=v.a,h=v.b,p=v.c;return L(f(rk,CA,d),u+" "+h,f(Ra,s,p))}},Ik=function(e){switch(e.$){case"Px":var t=e.a;return L(jI,GI.widthExact+" width-px-"+Ri(t),M([l(fk,"width-px-"+Ri(t),"width",Ri(t)+"px")]));case"Content":return L(f(rk,uk,jI),GI.widthContent,vr);case"Fill":var r=e.a;return 1===r?L(f(rk,wA,jI),GI.widthFill,vr):L(f(rk,wA,jI),GI.widthFillPortion+" width-fill-"+Ri(r),M([l(fk,GI.any+"."+GI.row+" > "+DA("width-fill-"+Ri(r)),"flex-grow",Ri(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ri(n),o=l(fk,i,"min-width",Ri(n)+"px"),u=Ik(a),s=u.a,c=u.b,d=u.c;return L(f(rk,TA,s),i+" "+c,f(Ra,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ri(h),o=l(fk,i,"max-width",Ri(h)+"px"),p=Ik(a),s=p.a,c=p.b,d=p.c;return L(f(rk,TA,s),i+" "+c,f(Ra,o,d))}},Ak=gA(27),Bk=r(function(e,t){if($(e,Ak)){if("Single"!==t.$)return!1;switch(t.c){case"0px":case"1px":case"2px":case"3px":case"4px":case"5px":case"6px":return!0;default:return!1}}else switch(t.$){case"FontSize":var r=t.a;return r>=8&&r<=32;case"PaddingStyle":var n=(t.a,t.b),a=t.c,i=t.d,o=t.e;return $(n,i)&&$(n,a)&&$(n,o)&&n>=0&&n<=24;default:return!1}}),kk=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=NA(n);if("Nothing"===s.$)return{attributes:f(Ra,fA(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Ra,fA(e+" "+c),i),children:o,has:r,node:t,styles:f(Ra,lk(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(SA,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(rk,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(Ra,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(SA,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(Bk,S,I)){var p=$A(I)+" "+e,g=t,v=f(rk,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=$A(I)+" "+e,g=t,v=f(rk,S,r),y=n,m=f(Ra,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(rk,S,r),y=f(Tk,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(SA,ok,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=GI.widthExact+" width-px-"+Ri(k)+" "+e,g=t,v=f(rk,ok,r),y=n,m=f(Ra,l(fk,"width-px-"+Ri(k),"width",Ri(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+GI.widthContent,g=t,v=f(rk,uk,f(rk,ok,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+GI.widthFill,g=t,v=f(rk,wA,f(rk,ok,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+GI.widthFillPortion+" width-fill-"+Ri(N),g=t,v=f(rk,wA,f(rk,ok,r)),y=n,m=f(Ra,l(fk,GI.any+"."+GI.row+" > "+DA("width-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var $=Ik(B),R=$.a,x=$.b,_=$.c,p=e+" "+x,g=t,v=f(ik,R,f(rk,ok,r)),y=n,m=U(_,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var L=d.a;if(f(SA,nk,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(L.$){case"Px":var k=L.a,P=Ri(k)+"px",D="height-px-"+P,p=GI.heightExact+" "+D+" "+e,g=t,v=f(rk,nk,r),y=n,m=f(Ra,l(fk,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=GI.heightContent+" "+e,g=t,v=f(rk,ak,f(rk,nk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=L.a;if(1===N){var p=GI.heightFill+" "+e,g=t,v=f(rk,EA,f(rk,nk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+GI.heightFillPortion+" height-fill-"+Ri(N),g=t,v=f(rk,EA,f(rk,nk,r)),y=n,m=f(Ra,l(fk,GI.any+"."+GI.column+" > "+DA("height-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=wk(L),R=O.a,x=O.b,_=O.c,p=e+" "+x,g=t,v=f(ik,R,f(rk,nk,r)),y=n,m=U(_,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(mk,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(mk,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(mk,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(mk,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(mk,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(mk,"h"+Ri(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(mk,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var V=M.a,p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-label",V),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(Ra,f(tk,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var K=d.a,H=d.b,_=function(){switch(H.$){case"Empty":return a;case"Text":H.a;return a;case"Unstyled":H.a;return a;default:var e=H.a;return U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(vk,K,H,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var j=d.a;if(f(SA,sk,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=bk(j)+" "+e,g=t,v=function(e){switch(j.$){case"CenterX":return f(rk,mA,e);case"Right":return f(rk,yA,e);default:return e}}(f(rk,sk,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var q=d.a;if(f(SA,ck,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=Ck(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterY":return f(rk,bA,e);case"Bottom":return f(rk,vA,e);default:return e}}(f(rk,ck,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),Nk={$:"Untransformed"},$k=Nk,Rk=a(function(e,t,r,n){return l(ek,e,n,v(kk,ZI(e),t,jI,$k,vr,vr,qI,La(r)))}),xk=function(e){return OI(fA(e))},_k=r(function(e,t){var r=t.url,n=t.label;return d(Rk,KI,MI("a"),f(Ra,OI(NI(r)),f(Ra,OI($I("noopener noreferrer")),f(Ra,OI(RI("_blank")),f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.link),e)))))),FI(M([n])))}),Lk=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),Pk=n(function(e,t,r){return d(Lk,e,t,r,1)}),Dk=gA(14),Uk=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),Ok=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),Mk=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return kA(t)+"-"+kA(r)+"-"+kA(n)+"-"+kA(a)},Fk=function(e){return f(Ok,Dk,l(Uk,"fc-"+Mk(e),"color",e))},Vk={align:Xh,label:"cantConnectNoWeb3",mainParagraphs:M([M([ep("You need a web3 provider (such as "),f(_k,M([Fk(l(Pk,0,0,1))]),{label:ep("Metamask"),url:"https://metamask.io/"}),ep(") to Connect.")]),M([ep("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:Zh},Kk={align:Xh,label:"invalidUrl",mainParagraphs:M([M([ep("I don't understand that URL...")]),M([ep("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:vm},Hk=function(e){return{$:"Active",a:e}},jk=function(e){return{$:"OnlyNetwork",a:e}},qk=Tu(f(tu,Xf,f(tu,Zg,ev("Error decoding hex to BigInt")))),Gk=function(){return Tu(function(e){switch(e){case"0x0":return hi(!1);case"0x1":return hi(!0);default:return di("Error decoding "+e+"as bool.")}})}(),zk=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,contractAddress:o,cumulativeGasUsed:i,gasUsed:a,hash:e,index:t,logs:u,logsBloom:s,root:c,status:f}}}}}}}}}}}},Wk=function(e){return RC(M([f(Fi,fi,e),Ki(li)]))},Yk=f(bg,Wk(f(hl,"status",Gk)),f(bg,Wk(f(hl,"root",Su)),l(PC,"logsBloom",Su,l(PC,"logs",YC(JC),f(bg,Wk(f(hl,"contractAddress",DC)),l(PC,"cumulativeGasUsed",qk,l(PC,"gasUsed",qk,l(PC,"blockNumber",rC,l(PC,"blockHash",FC,l(PC,"transactionIndex",rC,l(PC,"transactionHash",GC,Ki(zk)))))))))))),Jk=function(e){var t=e.a;return Xf(t)},Qk=f(tu,Jk,cp),Xk=r(function(e,t){return Ev({decoder:Yk,method:"eth_getTransactionReceipt",params:M([Qk(t)]),url:e})}),Zk=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),eN=r(function(e,t){return{$:"TxMined",a:e,b:t}}),tN=r(function(e,t){return{$:"TxSent",a:e,b:t}}),rN=r(function(e,t){return f(xo,function(e){return e.toMsg},f($o,function(e){return e.b},f($o,function(e){return e.onMinedTagger},f(Gd,t,e))))}),nN=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},aN=function(e){return RC(M([$C(li),f(Fi,fi,e)]))},iN=l(PC,"input",Su,l(PC,"gas",rC,l(PC,"gasPrice",qk,l(PC,"value",qk,l(PC,"to",aN(DC),l(PC,"from",DC,l(PC,"transactionIndex",rC,l(PC,"blockNumber",aN(rC),l(PC,"blockHash",function(e){return f(Cu,function(t){return"0x"===t||"0x0"===t?Ki(li):f($i,function(e){return $(e,P("0"))},yu(t))?Ki(li):f(Fi,fi,e)},Su)}(FC),l(PC,"nonce",rC,l(PC,"hash",GC,Ki(nN)))))))))))),oN=r(function(e,t){return Ev({decoder:iN,method:"eth_getTransactionByHash",params:M([Qk(t)]),url:e})}),uN=r(function(e,t){return{attempts:e,sleep:t}}),sN=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(_v,function(e){return a>0?f(Bh,function(e){return f(sN,f(uN,a,n),t)},Rw(1e3*n)):mv(e)},t)}),cN=r(function(e,t){return f(Bh,function(r){return f(sN,{attempts:30,sleep:1},f(oN,e,t))},Rw(250))}),fN=r(function(e,t){return f(sN,{attempts:60,sleep:5},f(Xk,e,t))}),lN=function(e){return{$:"Mined",a:e}},dN=function(e){return xo(function(t){return D(t,{status:lN(e)})})},hN=function(e){return{$:"Sent",a:e}},pN=function(e){return xo(function(t){return D(t,{status:hN(e)})})},gN=function(e){return{$:"Signed",a:e}},vN=function(e){return xo(function(t){return D(t,{status:gN(e)})})},yN=function(e){return"Nothing"!==e.$},mN=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return _(bp(r),Vo);case"TxSigned":var n=e.a,a=e.b,i=f(Gd,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(Nw,t,wh(a))}return Vo}(),s=function(e){var t=L(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Vo;if("Just"===t.b.$){var r=t.b.a;return f(Nw,r,wh(di(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Nw,a,wh(di(e)))}t.a,t.b,t.c;return Vo};if("Ok"===a.$){var c=a.a,d=yN(o.onBroadcastTagger)||yN(o.onMinedTagger)?f(np,r.tagger,f(Lv,tN(n),f(cN,r.nodePath,c))):Vo;return _(bp(D(r,{txs:l(th,n,vN(c),r.txs)})),Fo(M([u,d])))}var h=a.a;return _(bp(r),Fo(M([u,s(h)])))}return _(bp(r),Vo);case"TxSent":var n=e.a,p=e.b,g=f(Gd,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(np,r.tagger,f(Lv,eN(n),f(fN,r.nodePath,v.hash))):Vo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Nw,t,wh(hi(v)))}return Vo}();return _(bp(D(r,{txs:l(th,n,pN(v),r.txs)})),Fo(M([d,y])))}var h=p.a,s=function(){var e=_(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Nw,t,wh(di("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Nw,n,wh(di("Error with TxSent stuff")))}e.a,e.b;return Vo}();return _(bp(r),s)}return _(bp(r),Vo);case"TxMined":var n=e.a,m=e.b,b=f(Gd,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Nw,a,wh(hi(C)))}var i=e.a,a=i.a,u=i.b.a,s={currentDepth:1,doneWatching:!1,lastCheckedBlock:C.blockNumber,minedInBlock:C.blockNumber,reOrg:!1,stopWatchingAtBlock:C.blockNumber+(u.confirmations-1),txHash:C.hash};return Fo(M([f(np,r.tagger,f(Lv,f(Zk,n,s),nC(r.nodePath))),f(Nw,a,wh(hi(C))),f(Nw,u.toMsg,wh(s))]))}return Vo}();return _(bp(D(r,{txs:l(th,n,dN(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Nw,r,wh(di("TxReceipt decoding failure")))}return Vo}();return _(bp(r),S)}return _(bp(r),Vo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(rN,r.txs,n);if("Just"===A.$){var B=A.a;return _(bp(r),f(Nw,B,f(_v,function(e){return wh(D(I,{doneWatching:!0,reOrg:!0}))},f(Bh,function(e){return wh(D(I,{doneWatching:!0}))},f(Xk,r.nodePath,T.txHash)))))}return _(bp(r),Vo)}if($(w,T.lastCheckedBlock))return _(bp(r),f(np,r.tagger,f(Lv,f(Zk,n,T),f(Bh,function(e){return nC(r.nodePath)},Rw(2e3)))));var k=f(rN,r.txs,n);if("Just"===k.$){var B=k.a;return _(bp(r),Fo(M([f(np,r.tagger,f(Lv,f(Zk,n,I),f(Bh,function(e){return nC(r.nodePath)},Rw(2e3)))),f(Nw,B,wh(I))])))}return _(bp(r),Vo)}var n=e.a,h=e.c.a;return _(bp(r),Vo);default:var h=e.a;return _(bp(r),Vo)}}),bN=function(e){return{$:"External",a:e}},CN=function(e){return{$:"Internal",a:e}},EN=function(e){return{$:"NotFound",a:e}},SN=function(e){for(;;){e=e.a}},TN={$:"Http"},wN={$:"Https"},IN=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),AN=i(function(e,t,r,n,a){if(jl(a)||f(Om,"@",a))return li;var i=f(Jy,":",a);if(i.b){if(i.b.b)return li;var o=i.a,u=cd(f(uu,o+1,a));if("Nothing"===u.$)return li;var s=u;return fi(p(IN,e,f(fu,o,a),s,t,r,n))}return fi(p(IN,e,a,li,t,r,n))}),BN=a(function(e,t,r,n){if(jl(n))return li;var a=f(Jy,"/",n);if(a.b){var i=a.a;return h(AN,e,f(uu,i,n),t,r,f(fu,i,n))}return h(AN,e,"/",t,r,n)}),kN=n(function(e,t,r){if(jl(r))return li;var n=f(Jy,"?",r);if(n.b){var a=n.a;return d(BN,e,fi(f(uu,a+1,r)),t,f(fu,a,r))}return d(BN,e,li,t,r)}),NN=r(function(e,t){if(jl(t))return li;var r=f(Jy,"#",t);if(r.b){var n=r.a;return l(kN,e,fi(f(uu,n+1,t)),f(fu,n,t))}return l(kN,e,li,t)}),$N=function(e){return f(vu,"http://",e)?f(NN,TN,f(uu,7,e)):f(vu,"https://",e)?f(NN,wN,f(uu,8,e)):li},RN=Jt,xN=ca,_N=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ri(r)}),LN=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),PN=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(LN,"#",e.fragment,l(LN,"?",e.query,U(f(_N,e.port_,U(t,e.host)),e.path)))},DN=r(function(e,t){return e<0?li:ov(f(Wg,e,t))}),UN=r(function(e,t){if(e<0)return t;var r=_g(f(Wg,e,t)),n=f(bc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(co,n,a)}),ON=n(function(e,t,r){if(e<0)return r;var n=f(Wg,e,r),a=f(bc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(Ra,t(i),o))}return r}),MN=r(function(e,t){return f(ON,e,As(t))}),FN=r(function(e,t){var r=function(e){var r=f(Bm,t.wallet,e),n=f(Ap,t.txSentry,f(ru,EI,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(HN,U(f(Zi,EI,r.cmdUps),f(Ua,ya,o)),_(D(t,{submodel:CI(r.model),txSentry:a}),Fo(M([f(np,EI,r.cmd),i]))))};return f(Fu,function(t){return D(t,{currentRoute:e})},function(){switch(e.$){case"InitialBlank":return _(t,Vo);case"CreateFiat":return r(Mp);case"CreateCrypto":return r(Dp(yo));case"Trade":var n=e.a,a=e.b,i=function(){var e=l(Yb,n,a,t.tradeCaches);if("Just"===e.$&&"LoadedTrade"===e.a.$){var r=e.a.a;return f(iE,t.wallet,r)}return l(AC,t.wallet,n,a)}(),o=f(Ap,t.txSentry,f(ru,BI,i.chainCmd)),u=o.a,s=o.b,c=o.c;return f(HN,U(f(Zi,BI,i.cmdUps),f(Ua,ya,c)),_(D(t,{submodel:AI(i.model),txSentry:u}),Fo(M([f(np,BI,i.cmd),s]))));case"Marketplace":var d=Wm(t.wallet),h=d.a,p=d.b;return _(D(t,{submodel:TI(h)}),Fo(M([f(np,wI,p)])));case"AgentHistory":var g=e.a,v=f(jo,t.wallet,g),y=v.a,m=v.b;return _(D(t,{submodel:vI(y)}),Fo(M([f(np,yI,m)])));default:return _(f(ho,Kk,t),Vo)}}())}),VN=r(function(e,t){var r=t.submodel;switch(r.$){case"InitialBlank":return _(t,Vo);case"CreateModel":var n=r.a,a=f(Nm,e,n),i=f(Ap,t.txSentry,f(ru,EI,a.chainCmd)),o=i.a,u=i.b,s=i.c;return f(HN,U(f(Zi,EI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:CI(a.model),txSentry:o}),Fo(M([f(np,EI,a.cmd),u]))));case"TradeModel":var c=r.a,a=f(sE,e,c),l=f(Ap,t.txSentry,f(ru,BI,a.chainCmd)),o=l.a,u=l.b,s=l.c;return f(HN,U(f(Zi,BI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:AI(a.model),txSentry:o}),Fo(M([f(np,BI,a.cmd),u]))));case"MarketplaceModel":var d=r.a,a=f(ob,e,d),h=f(Ap,t.txSentry,f(ru,wI,a.chainCmd)),o=h.a,u=h.b,s=h.c;return f(HN,U(f(Zi,wI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:TI(a.model),txSentry:o}),Fo(M([f(np,wI,a.cmd),u]))));default:var p=r.a,a=f(Yo,e,p),g=f(Ap,t.txSentry,f(ru,yI,a.chainCmd)),o=g.a,u=g.b,s=g.c;return f(HN,U(f(Zi,yI,a.cmdUps),f(Ua,ya,s)),_(D(t,{submodel:vI(a.model),txSentry:o}),Fo(M([f(np,yI,a.cmd),u]))))}}),KN=r(function(e,t){var r=t.a,n=t.b,a=f(jN,mI(e),r),i=a.a,o=a.b;return _(i,Fo(M([n,o])))}),HN=r(function(e,t){var r=t.a,n=t.b;return l(_a,KN,_(r,n),e)}),jN=r(function(e,t){switch(e.$){case"CmdUp":var r=e.a;switch(r.$){case"Web3Connect":return f(jN,bI,t);case"GotoRoute":var n=r.a;return f(jN,SI(n),t);case"GTag":var a=r.a;return _(t,Gb(jb(a)));case"UserNotice":var i=r.a;return _(f(ho,i,t),Gb(jb(d(Np,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return _(t,d(ub,Jb,o,u,s));default:return _(t,Qb(pr))}case"DismissNotice":var c=e.a;return _(D(t,{userNotices:f(UN,c,t.userNotices)}),Vo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(xN,t.key,PN(e))}var r=h.a;return RN(r)}();return _(t,p);case"UrlChanged":var g=e.a;return f(qN,g,t);case"GotoRoute":var v=e.a;return f(Jh,function(e){return Fo(M([e,Gb(jb(d(Np,"GotoRoute","navigation",db(v),0))),f(xN,t.key,db(v))]))},f(FN,v,t));case"Tick":var y=e.a;return _(D(t,{time:y}),Vo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?_(f(ho,Vk,t),Vo):_(t,Hb(pr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Vo;var t=e.a;return zb(f(qb,t,"Deriving keypair for encrypted communication on the DAIHard exchange. ONLY SIGN THIS on https://burnable-tech.github.io/DAIHard/. If you sign this elsewhere, you risk revealing any of your encrypted communication on DAIHard to an attacker."))}();return _(D(t,{userAddress:m.account,wallet:jk(m.networkId)}),b);case"UserPubkeySet":var C=e.a,E=f(nv,Su,C);if("Ok"!==E.$){var S=E.a;return _(l(Oa,ho,f(up,"error decoding commPubkey from JS",S),t),Vo)}var T=E.a,w=_(t.userAddress,t.wallet);if("Just"!==w.a.$){w.a;return _(f(ho,f(up,"User pubkey set, but I can no longer find the user address!",li),t),Vo)}switch(w.b.$){case"OnlyNetwork":var I=w.a.a,A=w.b.a,B=Hk(l($p,A,I,T));return f(VN,kp(B),D(t,{wallet:B}));case"Active":var k=w.b.a,B=Hk(D(k,{commPubkey:T}));f(op,"User pubkey set, but there's already an active userInfo! Overwriting commpubkey.",k);return f(VN,kp(B),D(t,{wallet:B}));default:return _(f(ho,f(up,"Unexpected wallet state encounted when setting commPubkey!",_(t.userAddress,t.wallet)),t),Vo)}case"CreateMsg":var N=e.a,$=t.submodel;if("CreateModel"===$.$){var R=$.a,x=f(Tm,N,R),L=f(Ap,t.txSentry,f(ru,EI,x.chainCmd)),P=L.a,O=L.b,F=L.c;return f(HN,U(f(Zi,EI,x.cmdUps),f(Ua,ya,F)),_(D(t,{submodel:CI(x.model),txSentry:P}),Fo(M([f(np,EI,x.cmd),O]))))}return _(t,Vo);case"TradeMsg":var V=e.a,K=t.submodel;if("TradeModel"===K.$){var H=K.a,x=f(Mw,V,H),j=f(Ap,t.txSentry,f(ru,BI,x.chainCmd)),P=j.a,O=j.b,F=j.c;return f(HN,U(f(Zi,BI,x.cmdUps),f(Ua,ya,F)),_(D(t,{submodel:AI(x.model),txSentry:P}),Fo(M([f(np,BI,x.cmd),O]))))}return _(t,Vo);case"MarketplaceMsg":var q=e.a,G=t.submodel;if("MarketplaceModel"===G.$){var z=G.a,x=f(ab,q,z);return f(HN,f(Zi,wI,x.cmdUps),_(D(t,{submodel:TI(x.model)}),f(np,wI,x.cmd)))}return _(t,Vo);case"AgentHistoryMsg":var W=e.a,Y=t.submodel;if("AgentHistoryModel"===Y.$){var J=Y.a,x=f(ap,W,J),Q=f(Ap,t.txSentry,f(ru,yI,x.chainCmd)),P=Q.a,O=Q.b,F=Q.c;return f(HN,U(f(Zi,yI,x.cmdUps),f(Ua,ya,F)),_(D(t,{submodel:vI(x.model),txSentry:P}),Fo(M([f(np,yI,x.cmd),O]))))}return _(t,Vo);case"TxSentryMsg":var X=e.a,Z=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Fu,fi,f(mN,X,r))}return _(li,Vo)}(),P=Z.a,ee=Z.b;return _(D(t,{txSentry:P}),ee);case"TradeCacheMsg":var te=e.a,re=e.b,ne=f(DN,te,t.tradeCaches);if("Nothing"===ne.$)return f(KN,ya(f(up,"Encountered an out-of-range error when trying to route a TradeCacheMsg",li)),_(t,Vo));var ae=ne.a,x=f(gI,re,ae);return _(D(t,{tradeCaches:l(MN,te,x.tradeCache,t.tradeCaches)}),f(np,II(te),x.cmd));case"ClickHappened":return f(VN,Bp,t);case"NoOp":return _(t,Vo);default:var S=e.a;f(op,"test",S);return _(t,Vo)}}),qN=r(function(e,t){return $(db(t.currentRoute),e.path)?_(t,Vo):f(FN,Kb(e),t)}),GN=We("txIn",xC),zN=Ge("txOut",Fa),WN=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},YN=function(e){return{$:"EventSentryMsg",a:e}},JN=function(e){var t=f(bC,YN,fv(e)),r=t.a,n=t.b;return L({dataFetchState:l(uI,li,0,0),eventSentry:r,factory:e,trades:Wa},n,M([d(Yp,"tradeCache init","processing",WN(e),0)]))},QN=function(e){return{$:"InitialNumTradesFetched",a:e}},XN=function(e){return f(qw,e.factory,QN)},ZN=function(e){var t=JN(e),r=t.a,n=t.b,a=t.c;return L(r,Fo(M([n,XN(r)])),a)},e$={$:"InitialBlank"},t$=function(e){return{$:"TxSentryMsg",a:e}},r$={align:Xh,label:"noWeb3Provider",mainParagraphs:M([M([ep("No web3 provider detected. Is "),f(_k,M([Fk(l(Pk,0,0,1))]),{label:ep("Metamask"),url:"https://metamask.io/"}),ep(" or some other web3 provider installed and unlocked?")])]),noticeType:Zh},n$={$:"TopLeft"},a$={align:n$,label:"screenToSmall",mainParagraphs:M([M([ep("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:Zh},i$={align:Xh,label:"wrongWeb3Network",mainParagraphs:M([M([ep("Make sure your wallet is set to a compatible network.")]),M([ep(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:vm},o$={$:"NoneDetected"},u$=function(e){return f(xo,fv,jp(e))},s$={$:"ETCMain"},c$={$:"ETCTest"},f$={$:"Expanse"},l$={$:"Kovan"},d$={$:"Mainnet"},h$=function(e){return{$:"Private",a:e}},p$={$:"Rinkeby"},g$={$:"Ropsten"},v$={$:"RskMain"},y$={$:"RskTest"},m$=function(e){switch(e){case 1:return d$;case 2:return f$;case 3:return g$;case 4:return p$;case 30:return v$;case 31:return y$;case 42:return l$;case 41:return s$;case 62:return c$;default:return h$(e)}},b$=n(function(e,t,r){var n=e.a,a=e.b;return bp({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Dd})}),C$=n(function(e,t,n){var a=e.networkId?jk(m$(e.networkId)):o$,i=f(xo,function(e){return l(b$,_(zN,GN),t$,e)},u$(a)),o=e.width<1024?fi(a$):li,u=f(Ua,ZN,ao),s=function(){return $(a,o$)?fi(r$):"Nothing"===jp(a).$?fi(i$):li}(),c=$T(M([o,s])),d=L(f(Ua,io,u),f(Ua,oo,u),f(Ua,uo,u)),h=d.a,p=d.b,g=d.c,v=kb(f(Ni,r(function(e,t){return f(Zi,II(e),t)}),g)),y=Fo(f(Ni,r(function(e,t){return f(np,II(e),t)}),p)),m=f(HN,v,f(qN,t,{currentRoute:so,key:n,screenWidth:e.width,submodel:e$,time:Ho(0),tradeCaches:h,txSentry:i,userAddress:li,userNotices:vr,wallet:a})),b=m.a,C=m.b;return _(f(po,c,b),Fo(M([y,C])))}),E$={$:"Refresh"},S$=function(e){return{$:"UpdateNow",a:e}},T$=Fe,w$=r(function(e,t){return{$:"Every",a:e,b:t}}),I$=r(function(e,t){return{processes:t,taggers:e}}),A$=wh(f(I$,Dd,Dd)),B$=o(function(e,t,a,i,o,u){var s=n(function(r,n,i){e:for(;;){var o=i.a,u=i.b;if(o.b){var s=o.a,c=s.a,f=s.b,h=o.b;if(x(c,r)<0){var p=r,g=n,v=_(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return x(c,r)>0?_(o,l(a,r,n,u)):_(h,d(t,c,f,n,u))}return _(o,l(a,r,n,u))}}),c=l(Lw,s,_(ka(i),u),o),f=c.a,h=c.b;return l(_a,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),k$=r(function(e,t){var r=e.a,n=e.b,a=f(Gd,r,t);if("Nothing"===a.$)return l(Kd,r,M([n]),t);var i=a.a;return l(Kd,r,f(Ra,n,i),t)}),N$=r(function(e,t){return{$:"Zone",a:e,b:t}}),$$=da,R$=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=Nh(f($$,n,f(ah,e,n)));return f(Bh,function(t){return l(R$,e,a,l(Kd,n,t,r))},i)}return wh(r)}),x$=n(function(e,t,r){var i=r.processes,o=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return L(n,a,f(Bh,function(e){return i},kh(t)))}),u=l(_a,k$,Dd,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return L(f(Ra,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return L(a,l(Kd,e,r,i),o)}),d=p(B$,s,c,o,u,i,L(vr,Dd,wh(pr))),h=d.a,g=d.b,v=d.c;return f(Bh,function(e){return wh(f(I$,u,e))},f(Bh,function(t){return l(R$,e,h,g)},v))}),_$=function(e){return Ae(function(t){t(we(e(Date.now())))})}(Ho),L$=n(function(e,t,r){var n=f(Gd,t,r.taggers);if("Nothing"===n.$)return wh(r);var a=n.a,i=function(t){return Ph(f(Ua,function(r){return f(nh,e,r(t))},a))};return f(Bh,function(e){return wh(r)},f(Bh,i,_$))}),P$=r(function(e,t){var r=t.a,n=t.b;return f(w$,r,f(Ma,e,n))});gn.Time=Ue(A$,x$,L$,0,P$);var D$=Me("Time"),U$=r(function(e,t){return D$(f(w$,e,t))}),O$=function(e){return T$(M([f(U$,500,S$),f(U$,5e3,As(E$))]))},M$=function(e){return{$:"UpdateNow",a:e}},F$=function(e){return T$(M([f(U$,2e3,As(wm)),f(U$,500,M$)]))},V$={$:"Refresh"},K$=function(e){return{$:"UpdateNow",a:e}},H$=function(e){return T$(M([f(U$,500,K$),f(U$,5e3,As(V$))]))},j$=function(e){return{$:"DecryptionFinished",a:e}},q$=We("decryptionFinished",xC),G$=We("encryptionFinished",xC),z$=function(e){return{$:"EncryptionFinished",a:e}},W$=function(e){return{$:"Refresh",a:e}},Y$=function(e){return T$(M([f(U$,3e3,W$),G$(z$),q$(function(e){return rw(j$(e))})]))},J$=mn,Q$=T$(vr),X$=function(e){var t=e.submodel;switch(t.$){case"InitialBlank":return Q$;case"CreateModel":t.a;return f(J$,EI,F$());case"TradeModel":t.a;return f(J$,BI,Y$());case"MarketplaceModel":t.a;return f(J$,wI,H$());default:t.a;return f(J$,yI,O$())}},Z$=We("userPubkeyResult",xC),eR=We("walletSentryPort",xC),tR={$:"CheckForNewTrades"},rR={$:"UpdateTradePhases"},nR=function(e){return T$(M([f(U$,5e3,function(e){return tR}),f(U$,3e3,function(e){return rR})]))},aR=function(e){return{$:"Tick",a:e}},iR=function(e){return{$:"UserPubkeySet",a:e}},oR=function(e){return{$:"WalletStatus",a:e}},uR=function(e){return f(up,"Error decoding JS walletSentry: "+e,li)},sR=function(e){return{$:"ErrorDecoding",a:e}},cR=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),fR=l(Vi,r(function(e,t){return{ref:e,txHash:t}}),f(hl,"ref",xT),f(hl,"txHash",Wk(GC))),lR=function(e){var t=f(nv,fR,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(cR,r.ref,hi(a))}return f(cR,r.ref,di("Problem signing/broadcasting Tx. Ref #"+Ri(r.ref)))}t.a;return sR("Error decoding tx data")},dR=function(e){var t=e.a;return f(J$,t.tagger,t.inPort(lR))},hR=f(Fi,m$,xT),pR=Tu(f(tu,cd,f(tu,ev("Failure decoding stringy int"),du(m$)))),gR=RC(M([pR,hR])),vR=r(function(e,t){return{account:e,networkId:t}}),yR=l(Vi,vR,f(hl,"account",Wk(DC)),f(hl,"networkId",gR)),mR=n(function(e,t,r){var n=f(nv,yR,r);if("Err"===n.$){var a=n.a;return e(Oi(a))}return t(n.a)}),bR=function(e){var t=f(tu,uR,f(tu,ya,mI));return T$(U(M([f(U$,1e3,aR),eR(f(mR,t,oR)),f(Kc,Q$,f(xo,dR,e.txSentry)),Z$(iR),T$(f(Ni,r(function(e,t){return f(J$,II(e),t)}),f(Ua,nR,e.tradeCaches)))]),M([X$(e)])))},CR=function(e){return{$:"LinkClicked",a:e}},ER=function(e){return{$:"UrlChanged",a:e}},SR={$:"ClickHappened"},TR={$:"Generic"},wR=TR,IR=r(function(e,t){return d(Rk,KI,wR,f(Ra,UI(PI),f(Ra,_I(PI),e)),FI(M([t])))}),AR=function(e){return{$:"Fill",a:e}},BR=AR(1),kR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),NR={$:"NoAttribute"},$R=r(function(e,t){return"Empty"===t.$?NR:f(kR,e,t)}),RR={$:"InFront"},xR=function(e){return f($R,RR,e)},_R=qi,LR=function(e){return{$:"Px",a:e}},PR=LR,DR=n(function(e,t,r){return d(Lk,e/255,t/255,r/255,1)}),UR=gA(8),OR=function(e){return f(Ok,UR,l(Uk,"bg-"+Mk(e),"background-color",e))},MR=function(){var e=l(DR,7,27,92),t=l(DR,10,33,108);return f(IR,M([UI(BR),_I(PR(600)),OR(t),xR(f(IR,M([UI(BR),_I(PR(80)),OR(e)]),_R))]),_R)}(),FR=function(e){return{$:"JustImage",a:e}},VR=FR({description:"marketplace",src:"/DAIHard/static/img/farmer-s-market-kiosk-1.svg"}),KR=FR({description:"myTrades",src:"/DAIHard/static/img/diamond.svg"}),HR=FR({description:"newTrade",src:"/DAIHard/static/img/add-circle-bold.svg"}),jR={$:"Active"},qR={$:"Important"},GR={$:"Normal"},zR=l(DR,255,0,110),WR=l(Pk,1,1,1),YR=kI("alt"),JR=function(e){return f(kI,"src",at(e))},QR=r(function(e,t){var r=t.src,n=t.description,a=f(pp,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(Rk,KI,wR,f(Ra,xk(GI.imageContainer),e),FI(M([d(Rk,KI,MI("img"),U(M([OI(JR(r)),OI(YR(n))]),a),FI(vr))])))}),XR=r(function(e,t){if("None"===t.$)return f(IR,e,_R);var r=t.a;return f(QR,e,r)}),ZR=function(e){return{$:"AlignY",a:e}},ex={$:"CenterY"},tx=ZR(ex),rx=gA(2),nx=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),ax=r(function(e,t){return $(e,t)?f(Ok,rx,h(nx,"p-"+Ri(e),e,e,e,e)):f(Ok,rx,h(nx,"p-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),ix=gA(21),ox=r(function(e,t){return{$:"Class",a:e,b:t}}),ux=f(ox,ix,GI.cursorPointer),sx={$:"AsRow"},cx=sx,fx=r(function(e,t){return d(Rk,cx,wR,f(Ra,xk(GI.contentLeft+" "+GI.contentCenterY),f(Ra,UI(PI),f(Ra,_I(PI),e))),FI(t))}),lx=gA(3),dx=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),hx=r(function(e,t){return"spacing-"+Ri(e)+"-"+Ri(t)}),px=function(e){return f(Ok,lx,l(dx,f(hx,e,e),e,e))},gx=gA(17),vx=function(e){return f(Ok,gx,l(fk,"br-"+Ri(e),"border-radius",Ri(e)+"px"))},yx=function(e){return{$:"Normal",a:e}},mx=Bn,bx=r(function(e,t){return f(mx,e,yx(t))}),Cx=function(e){return f(bx,"click",Ki(e))},Ex=f(Ma,OI,Cx),Sx=gA(13),Tx=f(ox,Sx,GI.textSemiBold),wx=gA(4),Ix=function(e){return{$:"FontSize",a:e}},Ax=function(e){return f(Ok,wx,Ix(e))},Bx=a(function(e,t,r,n){var a=function(){switch(n.$){case"Normal":return vr;case"Active":return M([vx(4),OR(l(DR,2,172,214))]);default:return M([vx(4),OR(zR)])}}();return f(fx,U(M([f(ax,23,12),Ax(21),Tx,Fk(WR),ux,Ex(r),px(13)]),a),M([f(Kc,_R,f(xo,XR(M([_I(PR(26))])),e)),f(IR,M([tx,_I(PR(26))]),ep(t))]))}),kx=function(e){return{$:"AlignX",a:e}},Nx={$:"CenterX"},$x=kx(Nx),Rx=function(e){return{$:"Describe",a:e}},xx={$:"Paragraph"},_x=r(function(e,t){return d(Rk,iA,wR,f(Ra,Rx(xx),f(Ra,UI(BR),f(Ra,px(5),e))),FI(t))}),Lx=f(ox,Sx,GI.bold),Px=f(IR,M([Ax(29),Fk(WR),Lx,$x,ux,Ex(SI(vb))]),f(_x,vr,M([ep("DAI"),f(IR,M([Fk(zR)]),ep("Hard"))]))),Dx={$:"Right"},Ux=kx(Dx),Ox={$:"AsColumn"},Mx=Ox,Fx=r(function(e,t){return d(Rk,Mx,wR,f(Ra,xk(GI.contentTop+" "+GI.contentLeft),f(Ra,_I(PI),f(Ra,UI(PI),e))),FI(t))}),Vx=function(e){return f(fx,M([UI(BR),px(30),f(ax,30,17)]),M([d(Bx,fi(VR),"Marketplace",SI(yb),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return jR}return GR}()),function(){var t=Sm(e.wallet);if("Just"===t.$){var r=t.a;return d(Bx,fi(KR),"My Trades",SI(pb(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?jR:GR}return GR}())}return d(Bx,li,"Connect to Wallet",bI,qR)}(),d(Bx,fi(HR),"Create New Trade",SI(vb),function(){return"CreateModel"===e.submodel.$?jR:GR}()),f(Fx,M([Ux,px(0),f(ax,8,0)]),M([Px]))]))},Kx=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,fi(e.agentAddress))}},Hx=function(e){return pp(e)},jx=r(function(e,t){return f(pp,$m(e),t)}),qx=function(e){return f(pp,function(e){return aS(e.parameters)},Ww(e))},Gx={$:"BurnWindow"},zx={$:"Offer"},Wx={$:"PaymentWindow"},Yx={$:"Price"},Jx={$:"ResponderProfit"},Qx=gA(20),Xx=f(ox,Qx,GI.clip),Zx=AR,e_=function(e){return f(Ok,rx,h(nx,"p-"+Ri(e),e,e,e,e))},t_=r(function(e,t){return f(IR,M([UI(Zx(e)),_I(PR(60)),Xx]),f(IR,M([e_(12),tx,UI(BR)]),t))}),r_=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"Price":return 2;case"ResponderProfit":return 1;case"PaymentWindow":default:return 2}},n_=FR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),a_=FR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),i_=function(e){return{$:"ChangeSort",a:e}},o_=f(ox,Sx,GI.textMedium),u_=function(e){return f(IR,M([o_,Ax(17)]),ep(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"Price":return"For";case"ResponderProfit":return"Responder Profit";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},s_=r(function(e,t){return f(fx,M([px(5),ux,Ex(i_(e))]),M([u_(e),function(){if("Just"===t.$){var e=t.a;return f(IR,M([tx]),f(XR,M([UI(PR(8))]),function(){return"Ascending"===e.$?n_:a_}()))}return _R}()]))}),c_=r(function(e,t){return f(t_,r_(t),f(s_,t,e))}),f_=r(function(e,t){return f(fx,M([UI(BR)]),f(Ua,function(t){var r=$(e.a,t)?fi(e.b):li;return f(c_,r,t)},t))}),l_=l(DR,150,150,150),d_=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},h_=r(function(e,t){return $(e.symbol,t.symbol)?f(Ju,e.amount,t.amount):f(Ju,e.symbol,t.symbol)}),p_=function(e){if("Ok"===e.$){var t=e.a;return fi(t)}return li},g_=r(function(e,t){return f(xo,function(e){var r=t.terms.price.amount*e,n=gm(t.parameters.tradeAmount),a=function(){return"Buyer"===t.parameters.initiatorRole.$?_(n,r):_(r,n)}(),i=a.a;return(a.b-i)/i},f($o,p_,f(cy,t.terms.price.symbol,e)))}),v_=n(function(e,t,r){return f(e,r,t)}),y_=r(function(e,t){var n=t.a;return($(t.b,Oo)?Fa:v_)(function(){switch(n.$){case"Phase":return r(function(t,r){return $(t.state.phase,r.state.phase)?d(y_,e,_(zm,zh),t,r):f(Ju,d_(t.state.phase),d_(r.state.phase))});case"Expires":return r(function(e,t){return f(ol,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Km,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"Price":return r(function(e,t){return f(h_,e.terms.price,t.terms.price)});case"ResponderProfit":return r(function(t,r){return f(Kc,Ea,l(aT,Ju,f(g_,e,t),f(g_,e,r)))});case"PaymentWindow":return r(function(e,t){return f(ol,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(ol,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())}),m_=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),b_=function(e){return f(IR,M([UI(BR),_I(BR),Xx]),f(_x,M([Ax(12)]),M([ep(e.info)])))},C_=function(e){return f(Kc,_R,f(xo,b_,ov(e)))},E_=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"(k)Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"(k)ETH";default:e.a;return"xDai"}},S_=function(e){return{$:"TimeLeft",a:e}},T_=function(e){return{$:"TimeUp",a:e}},w_=r(function(e,t){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ho(0)}}),I_=r(function(e,t){var r=f(w_,t.state.phase,t),n=f(ul,e,t.state.phaseStartTime),a=f(ul,r,n);return il(a)>0?S_(_(a,r)):T_(r)}),A_=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},B_=l(Pk,0,0,0),k_=l(DR,51,183,2),N_=function(e){return U(e>0?"+":"",function(e){return e+"%"}(e<.1?uy(function(e){return e/10}(Yl(1e3*e))):Ri(Yl(100*e))))},$_=r(function(e,t){var r=N_(t);if("0%"===r)return f(IR,M([Ax(16)]),ep("0%"));var n=r;return f(IR,M([Fk(t>=0===e?k_:zR),Ax(16)]),ep(n))}),R_=function(e){return il(e)<0},x_=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),__=function(e){var t=Qv(e);return function(e){var t=e.a,r=e.b;return function(e){var r=e.a,n=e.b;return function(e){var n=e.a,a=e.b;return d(x_,KS(t),KS(r),KS(n),KS(a))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,n,Zu(60))))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,r,Zu(3600))))}(f(Kc,_(Zu(0),Zu(0)),f(Rs,t,Zu(86400))))},L_=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!R_(a)){var u=r(function(e,t){return U(l(Os,2,P("0"),Ri(e)),t)}),s=il(a)>0?i:o,c=__(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(fx,U(M([px(5)]),e),M([f(IR,U(M([Fk(h)]),t),ep(f(u,c.days,"d"))),f(IR,U(M([Fk(d)]),t),ep(f(u,c.hours,"h"))),f(IR,U(M([Fk(s)]),t),ep(f(u,c.min,"m")))]))}var p=e,g=t,v=_(i,o),y=Ho(0);e=p,t=g,n=v,a=y}}),P_=l(DR,233,237,242),D_={$:"Behind"},U_=function(e){return f($R,D_,e)},O_=r(function(e,t){var r=Yl(200*e),n=200-r,a=f(IR,M([UI(Zx(n))]),_R),i=M([_I(PR(3)),vx(20)]),o=f(IR,U(i,M([UI(Zx(r)),OR(t)])),_R),u=f(IR,U(i,M([UI(BR),OR(P_)])),_R);return f(fx,M([UI(BR),U_(u)]),M([o,a]))}),M_=l(Pk,1,1,0),F_=r(function(e,t){return il(e)/il(t)}),V_=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(F_,o,u),c=(f(IR,M([$x]),d(L_,vr,vr,_(a,i),o)),s<.1?zR:s<.2?M_:k_);return f(Fx,U(M([px(5)]),e),M([d(L_,M([$x]),t,_(a,i),o),f(O_,1-s,c)]))}),K_=M(["BTC","ZEC","XMR","DASH"]),H_=FR,j_=Hd(f(Ua,function(e){return _(e,H_({description:e,src:"/DAIHard/static/img/currencies/crypto/"+e+".png"}))},U(K_,M(["DAI","XDAI"])))),q_=Hd(f(Ua,function(e){var t=e.a;return _(t,_(e.b,H_({description:t,src:"/DAIHard/static/img/currencies/fiat/"+t+".svg"})))},M([_("AUD","$"),_("CLP","$"),_("EUR","€"),_("IDR","Rp"),_("KRW","₩"),_("NZD","$"),_("RUB","₽"),_("TRY","₺"),_("BRL","R$"),_("CNY","¥"),_("GBP","£"),_("ILS","₪"),_("MXN","$"),_("PHP","₱"),_("SEK","kr"),_("TWD","NT$"),_("CAD","$"),_("CZK","Kč"),_("HKD","$"),_("INR","₹"),_("MYR","RM"),_("PKR","₨"),_("SGD","$"),_("USD","$"),_("CHF","Fr"),_("DKK","kr"),_("HUF","Ft"),_("JPY","¥"),_("NOK","kr"),_("PLN","zł"),_("THB","฿"),_("ZAR","R"),_("VND","₫")]))),G_=FR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),z_=r(function(e,t){return"Nothing"===e.$?t:e}),W_=function(e){return"DAI"===e?fi(G_):f(z_,f(Gd,e,j_),f(xo,mu,f(Gd,e,q_)))},Y_=function(e){return f(xo,XR(M([_I(PR(26))])),W_(e))},J_=function(e){return f(xo,ei,f(Gd,e,q_))},Q_=i(function(e,t,r,n,a){return{decimals:r,integers:t,original:e,prefix:n,suffix:a}}),X_={$:"Negative"},Z_={$:"Positive"},eL={$:"Zero"},tL=function(e){return f($i,function(e){return $(e,P("0"))},qy(f(co,e.integers,Ow(e.decimals))))?eL:e.original<0?X_:Z_},rL=function(e){var t=function(e){return iu(e)>3?f(Ra,f(pu,3,e),t(f(um,3,e))):M([e])};return La(t(e))},nL=K,aL=xr,iL=n(function(e,t,r){return U(r,f(Us,e-iu(r),Ls(t)))}),oL=Y,uL=r(function(e,t){var r=f(fo,function(e){return!$(e,P("0"))&&!$(e,P("."))},uc(t));return U(e&&r?"-":"",t)}),sL=function(e){var t=e.a,r=e.b;if($(t,P("9"))){var n=_i(r);if("Nothing"===n.$)return"01";var a=n.a;return f(_s,P("0"),sL(a))}var i=bi(t);return i>=48&&i<57?f(_s,xE(i+1),r):"0"},cL=function(e){var t=f(Li,".",e);if(t.b){if(t.b.b){var r=t.a;return _(r,t.b.a)}var r=t.a;return _(r,"0")}return _("0","0")},fL=function(e){var t=f(Li,"e",uy(Xu(e)));if(t.b){if(t.b.b){var r=t.a,n=t.b,a=n.a,i=f(Kc,0,cd(f(vu,"+",a)?f(uu,1,a):a)),o=cL(r),u=o.a,s=o.b,c=U(u,s),d=i<0?f(Kc,"0",f(xo,function(e){return e.a+"."+e.b},f(xo,Fu(Ls),_i(U(f(Us,Xu(i),"0"),c))))):l(iL,i+1,P("0"),c);return U(e<0?"-":"",d)}var r=t.a;return U(e<0?"-":"",r)}return""},lL=n(function(e,t,r){if(nL(r)||aL(r))return uy(r);var n=r<0,a=cL(fL(Xu(r))),i=a.a,o=a.b,u=iu(i)+t,s=U(f(Us,1-u,"0"),l(iL,u,P("0"),U(i,o))),c=iu(s),d=f(ni,1,u),h=f(e,n,l(ou,d,c,s)),p=l(ou,0,d,s),g=h?oL(f(Kc,"1",f(xo,sL,_i(oL(p))))):p,v=iu(g),y="0"===g?g:t<=0?U(g,f(Us,Xu(t),"0")):x(t,iu(o))<0?l(ou,0,v-t,g)+"."+l(ou,v-t,v,g):U(i+".",l(iL,t,P("0"),o));return f(uL,n,y)}),dL=lL(r(function(e,t){var r=_i(t);if("Nothing"===r.$)return!1;if("5"===r.a.a.valueOf()){if(""===r.a.b){r.a;return!e}r.a;return!0}var n=r.a,a=n.a;return function(t){return t>53&&e||t>=53&&!e}(bi(a))})),hL=r(function(e,t){var r=f(Li,".",f(dL,e.decimals,t)),n=rL(f(Cm,Ti,f(Kc,"0",ov(r)))),a=f(Kc,"",ov(f(Wg,1,r))),i=h(Q_,t,n,a,"","");switch(tL(i).$){case"Negative":return D(i,{prefix:e.negativePrefix,suffix:e.negativeSuffix});case"Positive":return D(i,{prefix:e.positivePrefix,suffix:e.positiveSuffix});default:return i}}),pL=r(function(e,t){return""===t?"":U(e.decimalSeparator,t)}),gL=function(e){return"0"!==f(pu,1,e)?e:gL(f(um,1,e))},vL=n(function(e,t,r){return""===r||$(f(Us,e.decimals,"0"),r)?"":"KeepZeros"===t.$?U(e.decimalSeparator,r):f(pL,e,gL(r))}),yL=n(function(e,t,r){var n=function(){if("Just"===t.$){var r=t.a;return f(vL,e,r)}return pL(e)}(),a=f(xi,e.thousandSeparator,r.integers),i=n(r.decimals);return qy(M([r.prefix,a,i,r.suffix]))}),mL=n(function(e,t,r){return l(yL,e,fi(t),f(hL,e,r))}),bL={$:"RemoveZeros"},CL=u(function(e,t,r,n,a,i,o){return{decimalSeparator:r,decimals:e,negativePrefix:n,negativeSuffix:a,positivePrefix:i,positiveSuffix:o,thousandSeparator:t}}),EL=g(CL,2,",",".","−","","",""),SL=function(e){return f(mL,D(EL,{decimals:e}),bL)},TL=function(e){return f(Kc,"",J_(e.symbol))+(f(SL,8,e.amount)+" ")+e.symbol},wL=Lk,IL=function(e){return f(fx,M([px(4)]),M([f(Kc,_R,Y_(e.symbol)),f(IR,M([Fk(d(wL,0,0,0,.5)),o_,UI(PR(50))]),ep(e.symbol)),ep(TL(e))]))},AL=function(e){var t=ri(f(ja,10,e)+1),r=f(ni,3-t,0);return f(SL,r,e)},BL=function(e){return AL(gm(e))},kL=a(function(e,t,r,n){return f(t_,r_(r),function(){switch(r.$){case"Phase":var a=A_(n.state.phase),i=_(f(I_,e,n),n.state.phase);e:for(;;){if("TimeLeft"===i.a.$){if("Closed"===i.b.$)break e;var o=i.a.a,u=f(F_,o.a,o.b)<.05?zR:B_;return f(Fx,M([px(3)]),M([ep(a),d(V_,M([UI(BR)]),M([Ax(16)]),_(u,P_),o)]))}if("Closed"===i.b.$)break e;var s=i.a.a;return f(fx,M([px(6),Fk(l_)]),M([ep(a),f(IR,M([Ax(16)]),ep("(stale)"))]))}i.b;return ep(a);case"Expires":if("Open"===n.state.phase.$){var c=f(I_,e,n);if("TimeLeft"===c.$){var o=c.a,u=f(F_,o.a,o.b)<.05?zR:B_;return d(V_,M([UI(BR)]),M([Ax(16)]),_(u,P_),o)}var s=c.a;return d(V_,M([UI(BR)]),M([Ax(16)]),_(zR,P_),_(Ho(0),s))}return _R;case"Offer":return f(fx,M([px(5)]),M([ep(function(){return"Buyer"===n.parameters.initiatorRole.$?"Buying ":"Selling "}()+(BL(n.parameters.tradeAmount)+" ")+E_(n.factory))]));case"Price":return IL(n.terms.price);case"ResponderProfit":return f(Kc,_R,f(xo,$_(!0),f(g_,t,n)));case"PaymentWindow":var l=function(){return"Seller"===n.parameters.initiatorRole.$?zR:k_}(),h=x(il(n.parameters.autoabortInterval),216e5)<0?l:B_;return d(L_,vr,vr,_(h,P_),n.parameters.autoabortInterval);default:var l=function(){return"Seller"===n.parameters.initiatorRole.$?k_:zR}(),h=x(il(n.parameters.autoabortInterval),216e5)<0?l:B_;return d(L_,vr,vr,_(h,P_),n.parameters.autoreleaseInterval)}}())}),NL=a(function(e,t,r,n){return f(Fx,M([UI(BR),px(1),OR(WR),ux,Ex(f(m_,n.factory,n.id))]),M([f(fx,M([UI(BR),px(1)]),f(Ua,function(r){return d(kL,e,t,r,n)},r)),f(t_,1,C_(n.terms.paymentMethods))]))}),$L=Cr,RL=gA(28),xL=function(e){return f(Ok,RL,l(Uk,"bc-"+Mk(e),"border-color",e))},_L=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),LL=function(e){return f(Ok,Ak,h(_L,"b-"+Ri(e),e,e,e,e))},PL=i(function(e,t,r,n,a){return f(Fx,M([UI(BR),LL(2),vx(8),xL(l_),px(2),OR(l_),Xx]),f(Ua,l(NL,e,r,n),f($L,f(y_,r,t.orderBy),a)))}),DL=i(function(e,t,r,n,a){return f(Fx,M([UI(BR),_I(BR),px(5)]),M([f(f_,t.orderBy,n),h(PL,e,t,r,n,a)]))}),UL=a(function(e,t,r,n){return"pad-"+Ri(e)+"-"+Ri(t)+"-"+Ri(r)+"-"+Ri(n)}),OL=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(Ok,rx,h(nx,"p-"+Ri(t),t,t,t,t)):f(Ok,rx,h(nx,d(UL,t,r,n,a),t,r,n,a))},ML=xk(GI.italic),FL=a(function(e,t,r,n){var a=f(jx,n.filters,kb(f(Ua,function(e){return f(Hx,Kx(n),qx(e))},r)));return $(a,vr)?f(IR,M([$x,Ax(24),OL({bottom:0,left:0,right:0,top:30}),ML]),ep(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Ji,Qo,h(DL,e,n.tradeTable,n.prices,M([Mo,zx,Yx,Jx,Wx,Gx]),a))}),VL=function(e){return{$:"FiltersMsg",a:e}},KL=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},HL=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),jL=tk,qL={$:"Left"},GL=kx(qL),zL=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(Rk,Mx,MI("label"),e,FI(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(Rk,KI,wR,a,FI(M([i])));switch(n.$){case"Above":return d(Rk,Mx,MI("label"),e,FI(M([o,r])));case"Below":return d(Rk,Mx,MI("label"),e,FI(M([r,o])));case"OnRight":return d(Rk,cx,MI("label"),e,FI(M([r,o])));default:return d(Rk,cx,MI("label"),e,FI(M([o,r])))}}),WL=function(e){return{$:"Label",a:e}},YL=function(e){if("HiddenLabel"===e.$){var t=e.a;return Rx(WL(t))}return NR},JL=function(e){return"HiddenLabel"===e.$},QL=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return Eu("No key matched");var n=r.a;return Ki(n)},r=f(Cu,t,f(hl,"key",Su));return OI(f(bx,"keyup",r))},XL=function(e){return f($n,"tabIndex",Ri(e))},ZL=f(Ma,OI,XL),eP={$:"LivePolite"},tP=Rx(eP),rP=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([JL(r)?NR:px(6),OI(Cx(i(!a))),tP,QL(function(e){return $(e,"Enter")?fi(i(!a)):$(e," ")?fi(i(!a)):li}),ZL(0),ux,GL,UI(BR)]),e);return l(zL,o,r,d(Rk,KI,wR,M([OI(f(jL,"role","checkbox")),OI(f(jL,"aria-checked",a?"true":"false")),YL(r),tx,_I(BR),UI(PI)]),FI(M([n(a)]))))}),nP=Ir,aP=function(e){return e*nP/180},iP=gA(26),oP=function(e){return{$:"MoveY",a:e}},uP=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),sP=function(e){return f(uP,iP,oP(-e))},cP=gA(24),fP=r(function(e,t){return{$:"Rotate",a:e,b:t}}),lP=function(e){return f(uP,cP,f(fP,L(0,0,1),e))},dP=gA(19),hP=function(e){return qy(M([e.inset?"box-inset":"box-",kA(e.offset.a)+"px",kA(e.offset.b)+"px",kA(e.blur)+"px",kA(e.size)+"px",Mk(e.color)]))},pP=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(Ok,dP,l(fk,hP(t),"box-shadow",PA(t)))},gP=r(function(e,t){return f(Ok,Ak,h(_L,"b-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),vP=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?LL(r):f(gP,n,r):f(Ok,Ak,h(_L,"b-"+Ri(r)+"-"+Ri(a)+"-"+Ri(t)+"-"+Ri(n),r,a,t,n))},yP=gA(12),mP=f(ox,yP,GI.textCenter),bP=l(Pk,1,1,1),CP=function(e){return f(IR,M([xk("focusable"),UI(PR(14)),_I(PR(14)),Fk(bP),tx,Ax(9),mP,vx(3),xL(e?l(Pk,59/255,.6,252/255):l(Pk,211/255,211/255,211/255)),pP({blur:1,color:e?d(wL,238/255,238/255,238/255,0):l(Pk,238/255,238/255,238/255),offset:_(0,0),size:1}),OR(e?l(Pk,59/255,.6,252/255):bP),LL(e?0:1)]),e?f(IR,M([xL(bP),_I(PR(6)),UI(PR(9)),lP(aP(-45)),$x,tx,sP(1),vP({bottom:2,left:2,right:0,top:0})]),_R):_R)},EP=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),SP={$:"OnRight"},TP=EP(SP),wP=r(function(e,t){return f(rP,vr,{checked:t.checked,icon:CP,label:f(TP,vr,ep(t.label)),onChange:f(HL,e,t.label)})}),IP={$:"Top"},AP=ZR(IP),BP=function(e){return f(Fx,M([px(15),AP]),M([f(IR,M([Ax(28),o_]),ep(KL(e.type_))),f(Fx,M([px(5)]),f(Ua,wP(e.type_),e.options))]))},kP=function(e){return f(fx,M([px(20)]),f(Ua,BP,e))},NP={$:"NoneFound"},$P={$:"AllFetched"},RP={$:"FetchingTrades"},xP={$:"QueryingNumTrades"},_P=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return xP;if(t.a){var r=t.a;return x(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?RP:$P}return NP},LP=r(function(e,t){var r=function(e){return f(IR,M([Ax(20),Tx,Fk(l_),$x]),ep(e))},n=f(Bg,Za(NP),f(Ua,_P,e))?M([r("No trades found.")]):f(Ua,r,$T(f(Ua,function(e){switch(_P(e).$){case"QueryingNumTrades":return fi("Querying "+WN(e.factory)+" Factory...");case"NoneFound":return li;case"FetchingTrades":return fi("Fetching "+WN(e.factory)+" Trades...");default:return li}},e)));return f(IR,M([UI(BR),xR(f(Fx,M([px(5),GL]),n))]),f(IR,M([$x]),f(Ji,VL,kP(t.filters))))}),PP=r(function(e,t){return f(IR,M([vx(4),OR(d(wL,0,0,1,.1)),Fk(l(DR,16,7,234)),Ax(e),Tx,f(ax,15,13)]),ep(sp(t)))}),DP=function(e){return function(){var t=Sm(e.wallet);return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?_R:f(fx,M([px(10),$x,OL({bottom:20,left:20,right:20,top:10})]),M([f(IR,M([Ax(24),Tx]),ep("Trade History for User")),f(PP,18,e.agentAddress)]))},UP=r(function(e,t){return{$:"Max",a:e,b:t}}),OP=r(function(e,t){return f(UP,e,t)}),MP=r(function(e,t){return f(IR,M([OL({bottom:40,left:0,right:0,top:60}),UI(BR)]),f(IR,M([OR(WR),vx(8),$x,UI(f(OP,e,BR)),pP({blur:20,color:d(wL,0,0,0,.06),offset:_(0,3),size:0})]),t))}),FP=n(function(e,t,r){return f(MP,1800,f(Fx,M([UI(BR),e_(30)]),M([DP(r),f(LP,t,r),function(){var n=f(Bg,f(tu,_P,Za($P)),t);return d(FL,e,n,t,r)}()])))}),VP=function(e){return{$:"AmountInChanged",a:e}},KP={$:"InTypeClicked"},HP=function(e){return{$:"InTypeSelected",a:e}},jP=function(e){return{$:"SearchInputChanged",a:e}},qP={$:"NoOp"},GP=function(e){return{$:"MayStopPropagation",a:e}},zP=r(function(e,t){return f(mx,e,GP(t))}),WP=OI,YP=function(e){return WP(f(zP,"click",Ki(_(e,!0))))},JP=kn,QP=JP,XP=a(function(e,t,r,n){return f(IR,M([U_(f(IR,M([OR(e),WP(f(QP,"position","fixed")),WP(f(QP,"z-index","1000")),WP(f(QP,"top","0")),WP(f(QP,"left","0")),WP(f(QP,"width","100%")),WP(f(QP,"height","100%")),Ex(r)]),_R)),UI(BR),_I(BR),YP(t)]),n)}),ZP=gA(33),eD={$:"Hover"},tD=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),rD=xn,nD=r(function(e,t){switch(t.$){case"NoAttribute":return NR;case"Describe":var r=t.a;return Rx(r);case"AlignX":var n=t.a;return kx(n);case"AlignY":var a=t.a;return ZR(a);case"Width":var n=t.a;return DI(n);case"Height":var n=t.a;return xI(n);case"Class":var n=t.a,a=t.b;return f(ox,n,a);case"StyleClass":var i=t.a,o=t.b;return f(Ok,i,o);case"Nearby":var u=t.a,s=t.b;return f(kR,u,f(Yi,e,s));case"Attr":var c=t.a;return OI(f(rD,e,c));default:var l=t.a,d=t.b;return f(uP,l,d)}}),aD=function(e){return f(nD,SN,e)},iD=r(function(e,t){var r=t.a,n=t.b,a=aD(e);switch(a.$){case"StyleClass":var i=a.b;return _(f(Ra,i,r),n);case"TransformComponent":var o=(a.a,a.b);return _(r,f(Tk,n,o));default:return _(r,n)}}),oD=function(e){var t=l(_a,iD,_(vr,Nk),e),r=t.a,n=t.b;return f(Ra,lk(n),r)},uD=function(e){return f(Ok,ZP,f(tD,eD,oD(e)))},sD=f(ox,Qx,GI.scrollbarsY),cD=n(function(e,t,r){return f(IR,U(e,M([OR(WR),vx(6),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0})])),f(Fx,M([OR(P_),px(1),UI(BR),_I(f(OP,340,PI))]),M([f(Kc,_R,t),f(Fx,M([sD,UI(BR),_I(BR),OR(P_),px(1)]),f(Ua,function(e){var t=e.a,r=e.b;return f(IR,M([f(ax,14,10),OR(WR),UI(BR),Ex(r),ux,uD(M([OR(d(wL,0,0,1,.15))]))]),t)},r))])))}),fD=l(DR,213,217,222),lD=FR({description:"search",src:"/DAIHard/static/img/search.svg"}),dD=function(e){return{$:"HiddenLabel",a:e}},hD=dD,pD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),gD=pD,vD=Tn("span"),yD=kI("type"),mD=function(e){return _(e,!0)},bD=r(function(e,t){return l(Da,hl,t,e)}),CD=f(bD,M(["target","value"]),Su),ED=function(e){return f(zP,"input",f(Fi,mD,f(Fi,e,CD)))},SD={$:"TextArea"},TD=f(Ma,OI,jL("autocomplete")),wD=function(e){var t=r(function(e,t){if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,n=(r.b,r.c);return"Nothing"===t.$?fi(n):t}return t}),n=l(Da,t,li,e);if("Nothing"===n.$)return NR;var a=n.a;return sP(ri(a/2))},ID=l(Pk,186/255,189/255,182/255),AD=f(ax,12,12),BD=M([AD,vx(3),xL(ID),OR(bP),LL(1),px(5),UI(BR),_I(PI)]),kD=function(e){if("Height"===e.$){var t=e.a;return fi(t)}return li},ND=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},$D=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":case"Fill":return!0;case"Min":var t=e.b,r=t;e=r;continue e;default:var t=e.b;return!0}},RD=function(e){if("Label"!==e.$)return!0;switch(e.a.$){case"OnRight":case"OnLeft":return!1;case"Above":default:return!0}},xD=function(e){return{bottom:-e.bottom,left:-e.left,right:-e.right,top:-e.top}},_D=function(e){e:for(;;)switch(e.$){case"Fill":return!0;case"Content":case"Px":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},LD=function(e){e:for(;;)switch(e.$){case"Content":return!1;case"Px":return!0;case"Fill":return!1;case"Min":default:var t=e.b,r=t;e=r;continue e}},PD=a(function(e,t,r,n){switch(r.$){case"Nearby":return D(n,{parent:f(Ra,r,n.parent)});case"Width":var a=r.a;return _D(a)?D(n,{fullParent:f(Ra,r,n.fullParent),input:f(Ra,r,n.input),parent:f(Ra,r,n.parent)}):t?D(n,{fullParent:f(Ra,r,n.fullParent)}):D(n,{parent:f(Ra,r,n.parent)});case"Height":var i=r.a;return t?_D(i)?D(n,{fullParent:f(Ra,r,n.fullParent),parent:f(Ra,r,n.parent)}):(LD(i),D(n,{parent:f(Ra,r,n.parent)})):D(n,{fullParent:f(Ra,r,n.fullParent),parent:f(Ra,r,n.parent)});case"AlignX":case"AlignY":return D(n,{fullParent:f(Ra,r,n.fullParent)});case"StyleClass":switch(r.b.$){case"SpacingStyle":r.b;return D(n,{fullParent:f(Ra,r,n.fullParent),input:f(Ra,r,n.input),parent:f(Ra,r,n.parent),wrapper:f(Ra,r,n.wrapper)});case"PaddingStyle":var o=(r.a,r.b),u=(o.a,o.b),s=o.c,c=o.d,l=o.e;if(e)return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});var d=OL({bottom:c-f(Rc,u,c),left:l,right:s,top:u-f(Rc,u,c)}),h=WP(f(QP,"line-height","calc(1.0em + "+Ri(2*f(Rc,u,c))+"px)")),p=WP(f(QP,"height","calc(1.0em + "+Ri(2*f(Rc,u,c))+"px)"));return D(n,{cover:f(Ra,r,n.cover),input:f(Ra,p,f(Ra,h,n.input)),parent:f(Ra,d,n.parent)});case"BorderWidth":r.b;return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});case"Transform":return D(n,{cover:f(Ra,r,n.cover),parent:f(Ra,r,n.parent)});case"FontSize":return D(n,{fullParent:f(Ra,r,n.fullParent)});case"FontFamily":r.b;return D(n,{fullParent:f(Ra,r,n.fullParent)});default:r.a,r.b;return D(n,{parent:f(Ra,r,n.parent)})}case"NoAttribute":return n;case"Attr":r.a;return D(n,{input:f(Ra,r,n.input)});case"Describe":return D(n,{input:f(Ra,r,n.input)});case"Class":return D(n,{parent:f(Ra,r,n.parent)});default:return D(n,{input:f(Ra,r,n.input)})}}),DD=n(function(e,t,r){return function(e){return{cover:La(e.cover),fullParent:La(e.fullParent),input:La(e.input),parent:La(e.parent),wrapper:La(e.wrapper)}}(l(_a,f(PD,e,t),{cover:vr,fullParent:vr,input:vr,parent:vr,wrapper:vr},r))}),UD=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return Ri(t)+"px "+Ri(r)+"px "+Ri(n)+"px "+Ri(a)+"px"},OD=gA(0),MD=r(function(e,t){return{$:"Transparency",a:e,b:t}}),FD=function(e){var t=function(e){return 1-e}(f(Rc,1,f(ni,0,e)));return f(Ok,OD,f(MD,"transparency-"+kA(t),t))},VD=l(Pk,136/255,138/255,133/255),KD=n(function(e,t,r){var n=e.a,a=e.b;return f(IR,U(t,U(M([Fk(VD),xk(GI.noTextSelection+" "+GI.passPointerEvents),Xx,xL(d(wL,0,0,0,0)),OR(d(wL,0,0,0,0)),_I(BR),UI(BR),FD(r?1:0)]),n)),a)}),HD=be,jD=r(function(e,t){return f(Nn,e,HD(t))}),qD=jD("spellcheck"),GD=f(Ma,OI,qD),zD=kI("value"),WD=f(Ma,OI,zD),YD=f(Ma,Wi,As),JD=n(function(e,t,r){var n=U(BD,t),a=l(DD,$(e.type_,SD),RD(r.label),n),i=function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return!1}return f(Kc,!1,f(xo,$D,ov(La(f(_h,kD,n)))))}(),o=function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=(e.a,e.b),r=(t.a,t.b),n=t.c,a=t.d,i=t.e;return fi({bottom:f(ni,0,ri(a-3)),left:f(ni,0,ri(i-3)),right:f(ni,0,ri(n-3)),top:f(ni,0,ri(r-3))})}return li},u=f(Kc,{bottom:0,left:0,right:0,top:0},ov(La(f(_h,o,n)))),s=d(Rk,KI,function(){var t=e.type_;if("TextInputNode"===t.$){t.a;return MI("input")}return MI("textarea")}(),U(function(){var t=e.type_;if("TextInputNode"===t.$){var r=t.a;return M([OI(yD(r)),xk(GI.inputText)])}return M([Xx,_I(BR),xk(GI.inputMultiline),wD(n),OL(u),OI(f(QP,"margin",UD(xD(u)))),OI(f(QP,"box-sizing","content-box"))])}(),U(M([WD(r.text),OI(ED(r.onChange)),YL(r.label),GD(e.spellchecked),f(Kc,NR,f(xo,TD,e.autofill))]),a.input)),FI(vr)),c=function(){var t=e.type_;if("TextArea"===t.$)return d(Rk,KI,wR,U((i?Ra(sD):Fa)(M([UI(BR),f(fo,ND,n)?NR:xk(GI.focusedWithin),xk(GI.inputMultilineWrapper)])),a.parent),FI(M([d(Rk,iA,wR,f(Ra,UI(BR),f(Ra,_I(BR),f(Ra,xR(s),f(Ra,xk(GI.inputMultilineParent),a.wrapper)))),FI(function(){if(""===r.text){var e=r.placeholder;if("Nothing"===e.$)return M([ep(" ")]);var t=e.a;return M([l(KD,t,vr,""===r.text)])}return M([YD(f(vD,M([fA(GI.inputMultilineFiller)]),M([YB(r.text+" ")])))])}()))])));t.a;return d(Rk,KI,wR,f(Ra,UI(BR),f(Ra,f(fo,ND,n)?NR:xk(GI.focusedWithin),kb(M([a.parent,function(){var e=r.placeholder;if("Nothing"===e.$)return vr;var t=e.a;return M([U_(l(KD,t,a.cover,""===r.text))])}()])))),FI(M([s])))}();return l(zL,f(Ra,f(ox,ix,GI.cursorText),f(Ra,JL(r.label)?NR:px(5),f(Ra,tP,a.fullParent))),r.label,c)}),QD=JD({autofill:li,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),XD=i(function(e,t,r,n,a){var i=""===n?f(Ua,function(e){var t=e.a;e.b;return _(t,e.c)},r):f(_h,function(e){var t=e.a,r=e.b,a=e.c;return f(fo,Om(Zp(n)),f(Ua,Zp,r))?fi(_(t,a)):li},r);return l(cD,e,fi(f(IR,M([UI(BR),f(ax,9,15),OR(WR)]),f(fx,M([UI(BR),OR(l(Pk,.98,.98,.98)),f(ax,13,0),px(13),vx(4)]),M([f(XR,M([UI(PR(21))]),lD),f(QD,M([LL(0),UI(BR),OR(l(Pk,.98,.98,.98))]),{label:hD("search"),onChange:a,placeholder:fi(f(gD,M([Fk(fD)]),ep(t))),text:n})])))),i)}),ZD=function(e){return f(uP,iP,oP(e))},eU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,h(XD,M([UI(PR(300)),ZD(18),Ux]),"search cryptocurrencies",f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),M([e]),r(e))},K_),e,t))}),tU=M([to(no),ro(eo)]),rU=function(e){return d(XP,d(wL,0,0,0,.1),qP,km,l(cD,M([UI(PR(300)),ZD(10),Ux]),li,f(Ua,function(t){return _(f(fx,M([UI(BR),px(18)]),$T(M([Y_($y(t)),fi(ep(E_(t)))]))),e(t))},tU)))},nU=Na(q_),aU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,h(XD,M([UI(PR(300)),ZD(18),Ux]),"search currencies",f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),$T(M([fi(e),J_(e)])),r(e))},nU),e,t))}),iU=function(e){var t=e.mode;switch(t.$){case"OffRamp":return rU(f(Ma,HP,Up));case"CryptoSwap":if("Seller"===t.a.$){t.a;return rU(f(Ma,HP,Up))}t.a;return l(eU,e.inputs.currencySearch,jP,f(Ma,HP,Op));default:return l(aU,e.inputs.currencySearch,jP,f(Ma,HP,Op))}},oU=function(e){return fx(U(M([OR(P_),_I(PR(55)),vx(4),LL(1),xL(P_),px(1)]),e))},uU=n(function(e,t,r){return f(fx,M([OR(l(Pk,.98,.98,.98)),_I(BR),e_(13),px(13),ux,YP(r)]),M([f(Kc,_R,Y_(Ry(t))),ep(Ry(t)),f(XR,M([UI(PR(12))]),e?a_:n_)]))}),sU=a(function(e,t,r,n){return f(Fx,U(e,M([px(10)])),M([f(fx,M([px(20)]),M([f(IR,M([Ax(18),Tx,Fk(l(DR,1,31,52)),GL]),ep(t)),function(){if("Just"===r.$){var e=r.a;return f(IR,M([Ax(12),Fk(zR)]),ep(e))}return _R}()])),n]))}),cU={$:"Below"},fU=function(e){return f($R,cU,e)},lU=function(e){return d(sU,M([UI(BR)]),"I want to Sell",e.errors.amountIn,f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("amount in"),onChange:VP,placeholder:fi(f(gD,M([Fk(fD)]),ep("0"))),text:e.inputs.amountIn}),f(IR,U(M([_I(BR)]),e.showInTypeDropdown?M([fU(iU(e))]):vr),l(uU,e.showInTypeDropdown,e.inputs.inType,KP))])))},dU=function(e){return{$:"AmountOutChanged",a:e}},hU={$:"OutTypeClicked"},pU=function(e){return{$:"OutTypeSelected",a:e}},gU=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Seller"===t.a.$){t.a;return l(eU,e.inputs.currencySearch,jP,f(Ma,pU,Op))}t.a;return rU(f(Ma,pU,Up));case"OffRamp":return l(aU,e.inputs.currencySearch,jP,f(Ma,pU,Op));default:return rU(f(Ma,pU,Up))}},vU=function(e){return d(sU,M([UI(BR)]),"In Exchange for",e.errors.amountOut,f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("amount out"),onChange:dU,placeholder:fi(f(gD,M([Fk(fD)]),ep("0"))),text:e.inputs.amountOut}),f(IR,U(M([_I(BR)]),e.showOutTypeDropdown?M([fU(gU(e))]):vr),l(uU,e.showOutTypeDropdown,e.inputs.outType,hU))])))},yU={$:"MarginBoxClicked"},mU=function(e){return f(IR,M([Ax(20),Tx]),ep(f(SL,2,Xu(100*e))+"%"))},bU=function(e){return f(IR,M([Ux,_I(BR),OR(l(Pk,.98,.98,.98)),e_(13)]),f(XR,M([tx]),e?a_:n_))},CU=function(e){return d(Lk,e.red,e.green,e.blue,e.alpha)},EU=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},SU=r(function(e,t){var r=EU(t);return CU(D(r,{alpha:e}))}),TU=d(wL,1,0,0,.2),wU=a(function(e,t,r,n){return d(Lk,e/255,t/255,r/255,n)}),IU=function(e){var t=e?e>0?L("Profit",d(wU,0,188,137,.05),l(DR,0,188,137)):L("Loss",f(SU,.5,TU),TU):L("Even",d(wU,16,7,234,.05),l(DR,16,7,234)),r=t.a,n=t.b,a=t.c;return f(IR,M([e_(7)]),f(IR,M([f(ax,15,9),OR(n),vx(4),Fk(a),Ax(20),Tx]),ep(r)))},AU=n(function(e,t,r){return d(sU,e,t,li,r)}),BU=function(e){return l(AU,M([UI(BR)]),"Margin",f(oU,M([UI(BR),ux,YP(yU)]),M([f(fx,M([_I(BR),UI(BR),OR(WR),px(13)]),M([IU(e.margin),mU(e.margin)])),bU(e.showMarginModal)])))},kU=function(e){return{$:"MarginButtonClicked",a:e}},NU=function(e){return{$:"MarginInputChanged",a:e}},$U={$:"Profit"},RU=a(function(e,t,r,n){return f(IR,U(M([OR(e),vx(4),f(ax,22,16),Fk(t),Ax(20)]),function(){if("Just"===n.$){var e=n.a;return M([ux,Ex(e)])}return vr}()),ep(r))}),xU={$:"Above"},_U=function(e){return f($R,xU,e)},LU=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),qP,km,f(Fx,M([Ux,sP(10),vx(8),OR(P_),Xx,px(1),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0})]),M([f(IR,M([f(ax,23,18),OR(WR)]),f(Fx,M([UI(BR),px(10)]),M([f(IR,M([Ax(20),Tx,Fk(l(DR,16,7,234))]),ep("Margin")),f(_x,M([Ax(16),Fk(d(wL,0,0,0,.75))]),M([ep("This is how much you want to either make as a profit or loss from this trade. Trading at a loss can help to find a buyer fast, but it's possible to trade at a profit if your payment method is highly convenient to the other party.")]))]))),function(){var n=l(DR,10,33,108),a=d(wU,10,33,108,.04);return f(fx,M([UI(PI),OR(WR),f(ax,23,18),px(12)]),M([f(oU,M([UI(PR(140)),_U(function(){if("Just"===r.$){var e=r.a;return f(IR,M([Ax(12),Fk(zR),sP(16),GL,OR(WR),vP({bottom:0,left:1,right:1,top:0}),f(ax,5,0),xL(P_)]),ep(e))}return _R}())]),M([f(QD,M([LL(0),UI(BR),_I(BR)]),{label:hD("margin"),onChange:NU,placeholder:li,text:t+"%"})])),e<0?d(RU,TU,WR,"Loss",li):d(RU,a,n,"Loss",fi(kU(iy))),e?d(RU,a,n,"Even",fi(kU(Gp))):d(RU,l(DR,16,7,234),WR,"Even",li),e>0?d(RU,l(DR,0,188,137),WR,"Profit",li):d(RU,a,n,"Profit",fi(kU($U)))]))}()])))}),PU={$:"Bottom"},DU=ZR(PU),UU=function(e){return f(fx,M([UI(BR),px(25)]),U(M([f(IR,M([UI(Zx(2))]),vU(e))]),function(){return"CryptoSwap"===e.mode.$?M([f(IR,M([Ax(28),Fk(d(wL,.05,.1,.3,.25)),Tx,DU,OL({bottom:14,left:0,right:0,top:0})]),ep("@")),f(IR,M([UI(Zx(1)),_U(e.showMarginModal?l(LU,e.margin,e.inputs.margin,e.errors.margin):_R)]),BU(e))]):vr}()))},OU={$:"Expiry"},MU={$:"Judgment"},FU={$:"Payment"},VU=function(e){return{$:"IntervalInputChanged",a:e}},KU=function(e){return{$:"IntervalUnitChanged",a:e}},HU={$:"Minute"},jU={$:"Week"},qU=i(function(e,t,n,a,i){var o=function(){switch(e.$){case"Expiry":return _("Offer Expiry","This is how long your offer remains valid and visible in the marketplace. Note that you can manually recall the trade at any time, as long as no one has yet committed to it.");case"Payment":return _("Payment Due",function(){return"Buyer"===t.$?'Once a Seller commits, this is how long you to work with the Seller to complete the payment, and click "confirm payment". We recommend setting this to about 2X or 3X more than you expect you\'ll need!':'Once a Buyer commits, this is how long they have to work with you to complete the payment and click "confirm payment". We recommend setting this to about 2X or 3X more than you expect you\'ll need!'}());default:return _("Burn Window",function(){return"Buyer"===t.$?"Once you confirm payment, this is how long the Seller will have the option to burn the entire Dai/xDai balance (or manually release early). If the Seller makes no decision before this timer expires, the Dai/xDai balance is yours to claim.":"Once the Buyer confirms payment, this is how long you will have the option to burn the entire Dai/xDai balance (or manually release early). If you don't make a decision before this timer expires, the Buyer can then claim the Dai/xDai balance."}())}}(),u=o.a,s=o.b;return d(XP,d(wL,0,0,0,.1),qP,km,f(Fx,M([sP(10),vx(8),OR(P_),px(1),Xx,pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,3),size:0}),$(e,MU)?Ux:GL]),M([f(IR,M([f(ax,23,18),OR(WR),UI(BR)]),f(Fx,M([UI(BR),px(10)]),M([f(IR,M([Ax(20),Tx,Fk(l(DR,16,7,234))]),ep(u)),f(_x,M([Ax(16),Fk(d(wL,0,0,0,.75))]),M([ep(s)]))]))),function(){var e=r(function(e,t){return d(RU,t?l(DR,16,7,234):d(wU,10,33,108,.04),t?WR:l(DR,10,33,108),Zp(_y(e)+"s"),t?li:fi(KU(e)))});return f(fx,M([f(ax,23,18),OR(WR),px(12)]),M([f(oU,M([UI(PR(140)),_U(function(){if("Just"===i.$){var e=i.a;return f(IR,M([Ax(12),Fk(zR),sP(16),GL,OR(WR),vP({bottom:0,left:1,right:1,top:0}),f(ax,5,0),xL(P_)]),ep(e))}return _R}())]),M([f(QD,M([LL(0),UI(BR),_I(BR)]),{label:hD(u+" input"),onChange:VU,placeholder:li,text:a})])),f(e,HU,$(n.unit,HU)),f(e,_p,$(n.unit,_p)),f(e,xp,$(n.unit,xp)),f(e,jU,$(n.unit,jU))]))}()])))}),GU=function(e){return{$:"WindowBoxClicked",a:e}},zU=function(e){return f(IR,M([Ax(20),o_]),ep(Ri(e.num)+" "+_y(e.unit)+(1===e.num?"":"s")))},WU=n(function(e,t,r){return l(AU,M([UI(BR)]),function(){switch(e.$){case"Expiry":return"Offer Expiry";case"Payment":return"Payment Due";default:return"Burn Window"}}(),f(oU,M([UI(BR),ux,YP(GU(e))]),M([f(IR,M([_I(BR),UI(BR),OR(WR),f(ax,15,17)]),zU(t)),bU(r)])))}),YU=r(function(e,t){var r=$(t.showIntervalModal,fi(e));return f(IR,M([UI(BR),_U(r?h(qU,e,ly(t.mode),f(xy,e,t),t.inputs.interval,t.errors.interval):_R)]),l(WU,e,f(xy,e,t),r))}),JU=function(e){return f(fx,M([UI(BR),px(23)]),M([f(YU,OU,e),f(YU,FU,e),f(YU,MU,e)]))},QU=function(e){return{$:"ReceiveAddressChanged",a:e}},XU=r(function(e,t){return l(AU,M([UI(BR)]),e+" Receive Address",f(oU,M([UI(BR)]),M([f(QD,M([UI(BR),_I(BR),LL(0)]),{label:hD("receive address"),onChange:QU,placeholder:li,text:t})])))}),ZU=function(e){return{$:"PaymentMethodChanged",a:e}},eO=r(function(e,t){return l(JD,{autofill:li,spellchecked:t.spellcheck,type_:SD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),tO=r(function(e,t){return l(AU,M([UI(BR)]),function(){return"Buyer"===e.$?"Making the Payment":"Accepting the Payment"}(),f(oU,M([_I(PR(134)),UI(BR)]),M([f(eO,M([UI(BR),_I(BR),LL(0),sD]),{label:hD("payment method"),onChange:ZU,placeholder:fi(f(gD,M([Fk(fD)]),f(Fx,M([px(5)]),function(){return M("Buyer"===e.$?[ep("Indicate here how you will send payment to the Seller. Some examples:"),ep('"I can send to any EU bank"'),ep('"I\'ll reveal a hidden cash drop within 10 km of Grand Central Station"'),ep('"Can send via ecocash"')]:[ep("Indicate here how you will send payment to the Buyer. Some examples:"),ep('"I have TransferWise"'),ep('"I can pick up a cash drop within 10 km of Grand Central Station"'),ep('"I can pick up a WorldRemit payment to Zimbabwe"')])}()))),spellcheck:!0,text:t})])))}),rO=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Seller"===t.a.$){var r=(t.a,e.inputs.outType);if("External"===r.$){var n=r.a;return f(XU,n,e.inputs.receiveAddress)}f(op,"Unexpected currency type for outType!",e.inputs.outType);return _R}t.a;return _R;case"OffRamp":return f(tO,yo,e.inputs.paymentMethod);default:return f(tO,vo,e.inputs.paymentMethod)}},nO=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Ethereum"}e.a;return"Kovan"}switch(e.a.$){case"Eth":e.a;return"Ethereum";case"Kovan":e.a;return"Kovan";default:e.a;return"xDai"}},aO=function(e){return{$:"CmdUp",a:e}},iO=n(function(e,t,r){return{$:"PlaceOrderClicked",a:e,b:t,c:r}}),oO=function(e){return f(xo,cm,f(xo,function(){return"Seller"===ly(e.mode).$?function(e){return e/1.01}:Fa}(),e.dhTokenAmount))},uO=function(e){return f(xo,yE(e.foreignCurrencyType),e.foreignCurrencyAmount)},sO=function(e){var t=e.mode;switch(t.$){case"CryptoSwap":if("Buyer"===t.a.$){t.a;return fi(M([f(CE,TE,"Provide your "+e.foreignCurrencyType+" address immediately upon commitment, via chat.")]))}t.a;return""===e.inputs.receiveAddress?li:fi(M([f(CE,TE,"Pay to "+e.inputs.receiveAddress+" immediately upon commitment.")]));case"OffRamp":default:return""===e.inputs.paymentMethod?li:fi(M([f(CE,TE,e.inputs.paymentMethod)]))}},cO=function(e){return Ho(e.num*function(){switch(e.unit.$){case"Minute":return 60;case"Hour":return 3600;case"Day":return 86400;default:return 604800}}()*1e3)},fO=function(e){return d(OS,n(function(t,r,n){return{autoabortInterval:cO(oo(e.intervals)),autorecallInterval:cO(io(e.intervals)),autoreleaseInterval:cO(uo(e.intervals)),initiatorRole:ly(e.mode),paymentMethods:n,price:r,tradeAmount:t}}),oO(e),uO(e),sO(e))},lO=function(e){var t=i(function(e,t,r,n,a){return f(IR,U(M([UI(BR),e_(17),vx(4),Ax(20),Tx,mP,OR(e),Fk(t),_U(function(){if("Just"===a.$){var e=a.a;return f(IR,M([Ax(12),Fk(zR),sP(16),$x]),ep(e))}return _R}())]),function(){if("Just"===n.$){var e=n.a;return M([ux,Ex(e)])}return vr}()),ep(r))}),r=Sm(e.wallet);if("Just"===r.$){var n=r.a;if($(jp(e.wallet),fi(e.dhTokenType))){var a=fO(e);if("Just"===a.$){var o=a.a;return h(t,l(DR,255,0,110),WR,"Review Terms and Place Order",fi(l(iO,e.dhTokenType,n,o)),li)}return h(t,P_,B_,"Review Terms and Place Order",li,li)}return f(_x,M([Ax(18),ML,Fk(l_),$x]),M([ep("You must switch your wallet to the "+nO(e.dhTokenType)+" network to create a trade with "+E_(e.dhTokenType)+".")]))}return h(t,zR,WR,"Connect to Wallet",fi(aO(ma)),li)},dO={$:"SwapClicked"},hO=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),pO=a(function(e,t,r,n){return d(hO,e,t,r,n)}),gO=function(e){return function(e){return d(pO,e.red,e.green,e.blue,e.alpha)}(EU(e))},vO=YD,yO=function(e){return{$:"Circle",a:e}},mO=yO,bO=d(hO,0,0,0,1),CO={$:"Flat"},EO={$:"Sharp"},SO=function(e){return{$:"Uniform",a:e}},TO=SO,wO={cap:CO,dashPattern:vr,dashPhase:0,fill:TO(bO),join:EO,thickness:2},IO=n(function(e,t,r){return D(wO,{dashPattern:e,fill:r,thickness:t})}),AO=IO(vr),BO={$:"Transparent"},kO=BO,NO=f(AO,0,kO),$O=r(function(e,t){return{$:"Shape",a:e,b:t}}),RO=function(e){return{basic:e,handlers:vr,name:li,opacity:1,rotation:0,scale:_(1,1),shift:_(0,0)}},xO=function(e){return f(Ma,RO,$O(e))},_O=function(e){return xO(_(e,NO))},LO=function(e){return _(-e.a,-e.b)},PO=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:_(a.a+r,a.b+n)})}),DO=r(function(e,t){return f(PO,LO(e(t)),t)}),UO=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return _(f(Ra,r,a),f(Ra,n,i))});return l(Da,t,_(vr,vr),e)},OO=r(function(e,t){return{$:"Path",a:e,b:t}}),MO=Ar,FO=Br,VO=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=FO(n),i=MO(n);return _(i*t-a*r,a*t+i*r)},i=r,o=i.a,u=i.b,s=function(e){var t=e.a,r=e.b;return _(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Ma,f(Ma,function(e){var t=e.a,r=e.b;return _(t+l,r+d)},s),a)},KO=function(e){return Ua(function(t){var r=t.a,n=t.b,a=e/2;return _(r<0?r-a:r+a,n<0?n-a:n+a)})},HO=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(KO,e,M([_(-i,-a),_(i,-a),_(i,a),_(-i,a)]))}),jO=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([_(-a,-r),_(n,-r),_(n,t),_(-a,t)])},qO=function(e){var t=GO(e.basic),r=UO(f(Ua,VO(e),t)),n=r.a,a=r.b;return{toBottom:-f(Kc,0,UB(a)),toLeft:-f(Kc,0,UB(n)),toRight:f(Kc,0,DB(n)),toTop:f(Kc,0,DB(a))}},GO=function(e){e:for(;;)switch(e.$){case"Shape":switch(e.b.$){case"Circle":var t=e.a,r=t.b.thickness,n=e.b.a,a=2*n;return f(HO,r,_(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(HO,r,_(2*u,2*s));case"Rectangle":var c=e.a,r=c.b.thickness,l=e.b,d=l.a,h=l.b;return f(HO,r,_(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(KO,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(OO,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(KO,$(C,CO)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(HO,0,E);case"Group":var S=e.a;return f(KO,0,kb(f(Ua,f(tu,qO,jO),S)));default:var T=e.b;return f(KO,0,jO(qO(T)))}},zO=function(e){var t=qO(e);return t.toTop+t.toBottom},WO=function(e){var t=qO(e);return _(-t.toLeft,t.toTop)},YO=function(e){var t=qO(e);return t.toLeft+t.toRight},JO=Sn("http://www.w3.org/2000/svg"),QO=JO("svg"),XO=$n("height"),ZO=$n("version"),eM=$n("width"),tM=JO("circle"),rM=JO("ellipse"),nM=JO("foreignObject"),aM=JO("g"),iM=JO("image"),oM=JO("polygon"),uM=JO("polyline"),sM=JO("rect"),cM=MA,fM=JO("text"),lM=$n("id"),dM=$n("points"),hM=$n("r"),pM=$n("rx"),gM=$n("ry"),vM=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",nt(e))},yM=function(e){return{$:"Group",a:e}},mM=$n("dominant-baseline"),bM=$n("fill"),CM=$n("fill-opacity"),EM=$n("font-family"),SM=$n("font-size"),TM=$n("font-style"),wM=$n("font-variant"),IM=$n("font-weight"),AM=$n("opacity"),BM=$n("stroke"),kM=$n("stroke-dasharray"),NM=$n("stroke-dashoffset"),$M=$n("stroke-linecap"),RM=$n("stroke-linejoin"),xM=$n("stroke-opacity"),_M=$n("stroke-width"),LM=$n("text-anchor"),PM=$n("text-decoration"),DM=$n("transform"),UM=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},OM=function(e){return f(xi," ",f(Ua,function(e){var t=e.a,r=e.b;return f(xi,",",M([Ri(t),Ri(r)]))},e))},MM=n(function(e,t,r){return d(hO,e,t,r,1)}),FM=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Yl(1e4*e)/100};return qy(M(["rgba(",uy(i(t)),"%,",uy(i(r)),"%,",uy(i(n)),"%,",uy(function(e){return Yl(1e3*e)/1e3}(a)),")"]))},VM=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},KM=function(e){var t=VM(e),r=t.red,n=t.green,a=t.blue;return FM(l(MM,r,n,a))},HM=function(e){if("Uniform"===e.$){var t=e.a;return KM(t)}return"none"},jM=function(e){var t=VM(e),r=t.alpha;return uy(r)},qM=function(e){if("Uniform"===e.$){var t=e.a;return jM(t)}return"0"},GM=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},zM=function(e){var t=uy(e.scale.b),r=uy(e.scale.a),n=uy(-e.rotation/2/nP*360),a=uy(-e.shift.b),i=uy(e.shift.a);return qy(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},WM=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([BM(HM(r.fill)),xM(qM(r.fill)),_M(uy(r.thickness)),$M(UM(r.cap)),RM(GM(r.join)),bM("none"),AM(uy(e.opacity)),DM(zM(e)),NM(Ri(r.dashPhase)),kM(OM(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([bM(HM(a)),CM(qM(a)),BM(HM(r.fill)),xM(qM(r.fill)),_M(uy(r.thickness)),$M(UM(r.cap)),RM(GM(r.join)),AM(uy(e.opacity)),DM(zM(e)),NM(Ri(r.dashPhase)),kM(OM(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([bM(HM(SO(o.color))),EM(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),SM(Ri(o.size)),IM(function(){switch(o.weight.$){case"Thin":return"200";case"Light":return"300";case"Regular":return"normal";case"Medium":return"500";case"SemiBold":return"600";case"Bold":return"bold";default:return"800"}}()),TM(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),wM(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),PM(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),LM("middle"),mM("middle"),DM(zM(e))]);default:return M([DM(zM(e))])}},YM=$n("x"),JM=$n("y"),QM=r(function(e,t){return M([eM(uy(e)),XO(uy(t)),YM(uy(-e/2)),JM(uy(-t/2))])}),XM=function(e){return f(xi," ",f(Ua,function(e){var t=e.a,r=e.b;return f(xi,",",M([uy(t),uy(-r)]))},e))},ZM=bx,eF=r(function(e,t){return f(e,t.a,t.b)}),tF=function(e){return f(Ua,eF(ZM),e)},rF=function(e){e:for(;;){var t=f(Kc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(uM,U(M([lM(t),dM(XM(i))]),U(WM(e),tF(e.handlers))),vr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(oM,U(M([lM(t),dM(XM(i))]),U(WM(e),tF(e.handlers))),vr);case"Circle":var c=s.a;return f(tM,U(M([lM(t),hM(uy(c))]),U(WM(e),tF(e.handlers))),vr);case"Ellipse":var d=s.a,h=s.b;return f(rM,U(M([lM(t),pM(uy(d)),gM(uy(h))]),U(WM(e),tF(e.handlers))),vr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(sM,U(M([lM(t),pM(uy(c)),gM(uy(c))]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),vr);default:var a=s.a,v=D(e,{basic:f(OO,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(fM,U(M([lM(t)]),U(WM(e),tF(e.handlers))),M([cM(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(iM,U(M([lM(t),vM(C)]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),vr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(nM,U(M([lM(t)]),U(f(QM,p,g),U(WM(e),tF(e.handlers)))),M([S]));case"Group":var T=n.a;return f(aM,f(Ra,lM(t),U(WM(e),tF(e.handlers))),l(_a,r(function(e,t){return f(Ra,rF(e),t)}),vr,T));default:var w=n.a,I=n.b,v=D(e,{basic:yM(M([w,I]))});e=v;continue e}}},nF=r(function(e,t){var r=e.a,n=e.b,a=uy(r),i=uy(n);return f(oA,vr,M([f(QO,M([eM(a),XO(i),ZO("1.1")]),M([rF(t)]))]))}),aF=function(e){return f(nF,_(YO(e),zO(e)),f(DO,WO,e))},iF=a(function(e,t,r,n){var a=vO(aF(f(_O,TO(gO(r)),mO(t/2))));return f(IR,U(M([xR(f(IR,M([$x,tx]),n))]),e),a)}),oF=FR({description:"swap",src:"/DAIHard/static/img/vertical-swap.svg"}),uF=d(iF,M([ux,Ex(dO)]),52,d(wL,.05,.03,.92,.05),f(XR,M([_I(PR(30))]),oF)),sF=function(e){return f(Fx,M([UI(BR),e_(20),px(25)]),M([lU(e),function(){return"CryptoSwap"===e.mode.$?f(IR,M([$x]),uF):_R}(),UU(e),rO(e),JU(e),lO(e)]))},cF=function(e){return{$:"ChangeMode",a:e}},fF=r(function(e,t){var r=function(){switch(t.$){case"CryptoSwap":return"Crypto Portal";case"OffRamp":return"Get Fiat";default:return"Get More Dai"}}(),n=e?1:.15;return f(IR,M([Ax(28),Tx,Fk(d(wL,0,0,0,n)),ux,Ex(cF(t))]),ep(r))}),lF=function(e){var t=function(){switch(e.$){case"CryptoSwap":if("Seller"===e.a.$){e.a;return"Trade Dai/xDai for another crypto. Choose the amounts and types of crypto, and fill in your crypto receive address. Advanced users may wish to change the three trade windows."}e.a;return"Trade another crypto for Dai/xDai. Choose the amounts and types of crypto, and advanced users may wish to change the three trade windows.";case"OffRamp":return"Turn your Dai/xDai into any local currency. Choose your amounts and fiat type, describe how you can accept the fiat payment from a Buyer, and if necessary edit the three trade windows.";default:return"Deposit Dai/xDai to begin a fiat purchase to get 3X more Dai/xDai than your deposit. Choose your amounts and fiat type, describe how you can make the fiat payment to a Seller, and if necessary edit the three trade windows."}}();return f(Fx,M([UI(BR),px(20),e_(30)]),M([f(fx,M([px(40),$x]),M([f(fF,$(e,Dp(yo))||$(e,Dp(vo)),Dp(yo)),f(fF,$(e,Mp),Mp),f(fF,$(e,Fp),Fp)])),f(_x,M([Ax(16)]),M([ep(t)]))]))},dF=l(Pk,0,0,1),hF=r(function(e,t){var r=t.url,n=t.label;return d(Rk,KI,MI("a"),f(Ra,OI(NI(r)),f(Ra,OI($I("noopener noreferrer")),f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.link),e))))),FI(M([n])))}),pF=f(hF,M([vx(4),UI(BR),ux,f(ax,22,15),OR(dF),Fk(WR),Tx,Ax(20),$x,UI(PI),_I(PI)]),{label:f(_x,M([mP]),M([ep("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"}),gF=function(e){return f(yg,vg(e.tradeAmount),f(lg,e.tradeAmount,200))},vF=function(e){return{abortPunishment:e.abortPunishment,autoabortInterval:e.autoabortInterval,autorecallInterval:e.autorecallInterval,autoreleaseInterval:e.autoreleaseInterval,buyerDeposit:e.buyerDeposit,initiatorAddress:e.initiatorAddress,initiatorRole:e.initiatorRole,pokeReward:e.pokeReward,tradeAmount:e.tradeAmount}},yF=function(e){return"Buyer"===e.initiatorRole.$?yo:vo},mF=function(e){return"Buyer"===yF(vF(e)).$?e.buyerDeposit:e.tradeAmount},bF={$:"AbortCreate"},CF=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),EF=function(e){return Ri(e.num)+" "+_y(e.unit)+(1!==e.num?"s":"")},SF=Ls(xE(8226)),TF=FR({description:"close",src:"/DAIHard/static/img/remove-circle.svg"}),wF=function(e){return f(IR,M([e_(10),Ex(e),ux]),f(XR,M([UI(PR(22))]),TF))},IF=a(function(e,t,r,n){return d(XP,d(wL,0,0,.3,.6),r,n,f(IR,U(M([$x,tx,UI(f(OP,700,BR)),OR(WR),vx(8),xR(f(IR,M([Ux,AP]),wF(n)))]),e),t))}),AF=r(function(e,t){if("Nothing"===t.$)return _R;var r=t.a;return f(IR,U(M([vx(5),xL(zR),LL(1),OR(l(Pk,1,.4,.4)),e_(5),$x,tx,UI(f(OP,200,PI)),Ax(14)]),e),f(_x,vr,M([ep(r)])))}),BF=r(function(e,t){return f(IR,M([vx(4),f(ax,25,17),Ax(18),Tx,OR(P_),_U(f(AF,M([sP(5)]),t))]),ep(e))}),kF=gA(32),NF={$:"Active"},$F=function(e){return f(Ok,kF,f(tD,NF,oD(e)))},RF=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(IR,M([vx(4),ux,Ex(n),f(ax,25,17),Fk(t),Ax(18),Tx,OR(a),$F(M([OR(o)])),uD(M([OR(i)]))]),ep(r))}),xF=r(function(e,t){return d(RF,L(d(wL,1,0,0,1),d(wL,1,0,0,.8),d(wL,1,0,0,.6)),WR,e,t)}),_F=n(function(e,t,r){return d(XP,d(wL,0,0,.3,.6),t,r,f(Fx,M([px(10),$x,tx,OR(d(wL,0,0,0,.5)),vx(8),e_(20)]),f(Ua,function(e){return f(_x,M([$x,tx,Ax(20),Tx,Fk(WR),mP]),M([e]))},e)))}),LF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+Jk(t)}e.a;return"https://kovan.etherscan.io/tx/"+Jk(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+Jk(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+Jk(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+Jk(t)}}),PF=xk(GI.underline),DF=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=f(IR,M([ux,Ex(bF),f(ax,25,17),Fk(WR),Ax(18),Tx]),ep("I'm not ready yet. Go back.")),i=f(Ma,IR(M([Lx,Fk(B_)])),ep),o=i(EF(f(xy,OU,t))),u=i(EF(f(xy,MU,t))),s=i(EF(f(xy,FU,t))),c=f(Ma,IR(M([Tx,Fk(dF)])),ep),h=c(BL(n.buyerDeposit)+" "+E_(r)),p=c(BL(gF(n))+" "+E_(r)),g=c(TL(n.price)),v=c(BL(f(yg,n.tradeAmount,n.buyerDeposit))+" "+E_(r)),y=c(BL(n.tradeAmount)+" "+E_(r)),m=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a,i=BL(f(yg,gF(n),f(yg,a,mF(n))))+" "+E_(r),o=BL(a)+" "+E_(r);return L(c(o),c(i),f(xF,"Understood. Deposit "+o+" and open this trade.",l(CF,r,n,a)))}return L(c("??"),c("??"),f(BF,"(loading exact fees...)",li))}(),b=m.a,C=m.b,E=m.c;return d(IF,M([UI(PR(1200))]),f(fx,M([UI(BR)]),M([f(Fx,M([e_(90),_I(BR),OR(l(DR,10,33,108))]),M([f(Fx,M([UI(BR),px(18),Fk(WR)]),M([f(IR,M([Ax(38),Tx]),ep("Are you Ready?")),f(_x,M([Ax(16),o_]),M([ep("DAIHard is different than other exchanges. If this is your first trade here, carefully read the details to the right before proceeding with opening this trade.")])),f(_x,M([Ax(16),o_]),M([ep("You can't edit a trade once it's live (but you can abort and re-deploy, as described in point 2).")]))])),f(Fx,M([$x,px(15),DU]),M([f(IR,M([$x]),E),f(IR,M([$x]),a)]))])),f(Fx,M([px(23),e_(40),UI(BR)]),f(Ua,function(e){return f(fx,M([UI(BR),_I(BR),LL(2),xL(P_),e_(16),px(20)]),M([f(IR,M([Ax(40),tx]),ep(SF)),f(_x,M([Ax(16)]),e)]))},function(){return"Buyer"===n.initiatorRole.$?U(M([M([ep("To open this offer, you must deposit "),b,ep(". Your offer to buy "),y,ep(" for "),g,ep(" will then be listed on the marketplace.")]),M([ep("You can abort the offer any time before a Seller commits for a full refund. If no Seller commits within "),o,ep(" your offer will automatically expire. In both these cases, the full "),b,ep(" is returned to you.")]),M([ep("A Seller can commit to the trade by depositing the full "),y,ep(" into the contract, and is expected to immediately post his "),c(n.price.symbol),ep(" address in the DAIHard chat.")]),function(){return M("CryptoSwap"===t.mode.$?[ep("You will then have "),s,ep(" to send "),g,ep(' to that address and click "Confirm Payment".')]:[ep("You are then expected to send "),g,ep(' and click "Confirm Payment" within '),s,ep(".")])}(),M([ep("Once you've confirmed payment, for "),u,ep(", the Seller has the option of burning the trade's full balance of "),C,ep(". He is expected to do this if and only if you failed to send the "),g,ep(" to the address he posted.")]),M([ep("If the Seller has not burned the "),ep(E_(r)),ep(" within the "),u,ep(", "),v,ep(" is yours to claim and we take a 1% fee ("),p,ep(").")])]),function(){return"Token"===r.$?M([M([ep("(Trade creation ususally requires two Metamask signatures. Your "+E_(r)+" will not be deposited until the final transaction has been mined.)")])]):vr}()):U(M([M([ep("Of your "),b,ep(", ~1% ("),p,ep(") will be set aside, and the remaining "),y,ep(" will be listed as selling for "),g,ep(".")]),M([ep("You can abort the offer at any time before a Buyer commits, and if no Buyer commits within "),o,ep(" your offer will automatically expire. In both these cases, the full "),b,ep(" is returned to you.")])]),U(function(){return M("CryptoSwap"===t.mode.$?[M([ep("A Buyer must deposit "),h,ep(" into this contract to commit. He is then expected to send the "),g,ep(" to your receive address "),c(t.inputs.receiveAddress),ep(", and mark the payment as complete, all within "),s,ep(".")]),M([i("Make sure the above address is correct! DAIHard does not do refunds!")])]:[M([ep("A Buyer must deposit "),h,ep(" into this contract to commit. He is then expected to pay the "),g,ep(" to you, via the method you've descried in your "),i("Payment Methods"),ep(", and mark the payment as complete, all within "),s,ep(".")])])}(),U(M([M([ep("When the Buyer marks the payment complete, for "),u,ep(" you will have the option to burn the trade's balance of "),C,ep(", which you are expected to do if and only if the Buyer has not sent the payment.")]),M([ep("If the trade has resolved successfully, DAIHard takes the 1% fee of "),p,ep(" set aside earlier.")])]),function(){return"Token"===r.$?M([M([ep("(Trade creation ususally requires two Metamask signatures. Your "+E_(r)+" will not be deposited until the final transaction has been mined.)")])]):vr}())))}()))])),qP,bF);case"ApproveNeedsSig":var S=e.a;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),l(_F,M([ep("Waiting for user signature for the approve call."),ep("(check Metamask!)"),ep("Note that there will be a second transaction to sign after this.")]),qP,qP));case"ApproveMining":var S=e.a,n=e.b,T=e.c;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","ApproveMining",0)))]),l(_F,M([ep("Mining the initial approve transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,ro(S),T)}),ep("Funds will not leave your wallet until you sign the next transaction.")]),qP,qP));case"CreateNeedsSig":return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),l(_F,M([ep("Waiting for user signature for the create call."),ep("(check Metamask!)")]),qP,qP));default:var r=e.a,T=e.b;return f(IR,M([$x,tx,Ex(aO(d(Yp,"txChainModal clicked","misclick","CreateMining",0)))]),l(_F,M([ep("Mining the final create call..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,r,T)}),ep("You will be redirected when it's mined.")]),qP,qP))}}),UF=function(e){var t=e.txChainStatus;if("Just"===t.$){var r=t.a;return M([f(DF,r,e)])}return vr},OF=f(IR,M([_I(PR(1)),UI(BR),OR(d(wL,0,0,0,.2))]),_R),MF=function(e){return _(f(Fx,M([UI(BR),OL({bottom:40,left:0,right:0,top:0})]),M([f(MP,800,f(Fx,M([UI(BR),px(20)]),M([lF(e.mode),OF,sF(e)]))),pF])),UF(e))},FF=r(function(e,t){return f(Wb,f(tu,function(e){return e.type_},Za(e)),t)}),VF=r(function(e,t){return pp(t(e))}),KF=i(function(e,t,r,n,a){var i=l(VF,e,a.filterFunc,kb(f(Ua,qx,n)));return $(i,vr)?f(IR,M([$x,Ax(24),OL({bottom:0,left:0,right:0,top:30}),ML]),ep(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Ji,Qm,h(DL,e,a.tradeTable,a.prices,M([t?zm:Mo,zx,Yx,Jx,Wx,Gx]),i))}),HF=function(e){return{$:"FiltersMsg",a:e}},jF={$:"ApplyInputs"},qF=jD("disabled"),GF=function(e){return f(fo,ND,e)?NR:xk("focusable")},zF=function(e){return{$:"MayPreventDefault",a:e}},WF=r(function(e,t){return f(mx,e,zF(t))}),YF=r(function(e,t){var r=function(r){return $(r,e)?Ki(t):Eu("Not the enter key")},n=f(Cu,r,f(hl,"key",Su));return OI(f(WF,"keyup",f(Fi,function(e){return _(e,!0)},n)))}),JF=function(e){return f(YF,"Enter",e)},QF={$:"Button"},XF=r(function(e,t){var r=t.onPress,n=t.label;return d(Rk,KI,wR,f(Ra,UI(PI),f(Ra,_I(PI),f(Ra,xk(GI.contentCenterX+" "+GI.contentCenterY+" "+GI.seButton+" "+GI.noTextSelection),f(Ra,ux,f(Ra,GF(e),f(Ra,Rx(QF),f(Ra,OI(XL(0)),function(){if("Nothing"===r.$)return f(Ra,OI(qF(!0)),e);var t=r.a;return f(Ra,Ex(t),f(Ra,JF(t),e))}()))))))),FI(M([n])))}),ZF=f(XF,M([OR(dF),e_(10),vx(5)]),{label:f(IR,M([Fk(WR),$x,tx]),ep("Apply")),onPress:fi(jF)}),eV=function(e){return f(XR,f(Ra,_I(PR(26)),e),G_)},tV=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(Ok,gx,l(fk,"br-"+Ri(t)+"-"+Ri(r)+Ri(n)+"-"+Ri(a),"border-radius",Ri(t)+"px "+Ri(r)+"px "+Ri(a)+"px "+Ri(n)+"px"))},rV=function(e){return f(bx,"focus",Ki(e))},nV=f(Ma,OI,rV),aV=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return vr;var e=o.a;return M([nV(e(!0)),YP(e(!0))])}();return f(fx,U(e,M([_I(PR(40)),pP({blur:20,color:d(wU,233,237,242,.05),offset:_(0,3),size:0})])),M([f(IR,M([OR(P_),_I(PR(40)),tV({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(IR,M([tx,f(ax,10,0)]),r)),f(QD,U(s,U(t,M([UI(PR(100)),_I(PR(40)),xL(P_),tV({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),vP({bottom:1,left:0,right:1,top:1})]))),{label:hD(n),onChange:u,placeholder:i,text:a})]))}),iV=function(e){return{$:"MaxDaiChanged",a:e}},oV=function(e){return{$:"MinDaiChanged",a:e}},uV=r(function(e,t){return f(Fx,M([UI(BR),px(8)]),M([f(IR,M([Ax(17),o_]),ep(e)),t]))}),sV=gA(25),cV=function(e){return{$:"MoveX",a:e}},fV=function(e){return f(uP,sV,cV(-e))},lV={$:"OnLeft"},dV=function(e){return f($R,lV,e)},hV=n(function(e,t,r){var n=eV(M([tx])),a=f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("max"))])),i=f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("min"))]));return f(uV,"Dai Range",f(Fx,M([px(5),UI(PR(200))]),M([v(aV,M([dV(f(AF,M([fV(5),UI(PR(200))]),r.minDai))]),M([nV(ib(!1))]),i,"min Dai",e,li,li,oV),v(aV,M([dV(f(AF,M([fV(5),UI(PR(200))]),r.maxDai))]),M([nV(ib(!1))]),a,"max Dai",t,li,li,iV)])))}),pV=function(e){return{$:"FiatTypeInputChanged",a:e}},gV=function(e){return{$:"FiatTypeSelected",a:e}},vV=n(function(e,t,r){return f(fx,M([OR(l(Pk,.98,.98,.98)),_I(BR),e_(13),px(13),ux,YP(r),LL(1),xL(P_)]),M([f(Kc,_R,Y_(t)),ep(function(e){return""===e?"[any]":e}(t)),f(XR,M([UI(PR(12))]),e?a_:n_)]))}),yV=WP(f(QP,"z-index","1000")),mV={$:"NoOp"},bV=n(function(e,t,r){return d(XP,d(wL,0,0,0,.1),mV,ib(!1),function(){var n=U(nU,K_);return h(XD,M([UI(PR(300)),ZD(18),Ux,yV]),"search currencies",U(M([L(f(IR,M([UI(BR)]),ep("[any]")),vr,r(""))]),U(f(Ua,function(e){return L(f(fx,M([UI(BR),px(18)]),$T(M([Y_(e),fi(ep(e))]))),$T(M([fi(e),J_(e)])),r(e))},n),f(lo,e,n)?vr:M([L(f(IR,M([UI(BR)]),ep('"'+e+'"')),M([e]),r(e))]))),e,t)}())}),CV=n(function(e,t,r){var n=f(Kc,_R,Y_(t));f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("max"))])),f(fx,M([px(8),tx,UI(PR(60))]),M([n,f(IR,M([Ax(16),tx]),ep("min"))]));return f(IR,M([AP,UI(PR(120)),fU(e?l(bV,t,pV,gV):_R)]),f(uV,"Currency Type",l(vV,e,t,ib(!0))))}),EV={$:"AddSearchTerm"},SV=function(e){return{$:"PaymentMethodInputChanged",a:e}},TV=f(hl,"keyCode",xT),wV=function(e){return f(bx,"keyup",f(Cu,function(t){return 13===t?Ki(e):Eu(Ri(t))},TV))},IV=function(e){return f(uV,"Search Payment Methods",f(QD,M([AP,UI(PR(250)),_I(PR(40)),xL(P_),pP({blur:20,color:d(wU,233,237,242,.05),offset:_(0,3),size:0}),WP(wV(EV))]),{label:hD("payment methods search"),onChange:SV,placeholder:li,text:e}))},AV={$:"ResetSearch"},BV=f(XF,M([OR(dF),e_(10),vx(5)]),{label:f(IR,M([Fk(WR),$x,tx]),ep("Reset")),onPress:fi(AV)}),kV=function(e){return{$:"RemoveTerm",a:e}},NV=function(e){return f(IR,M([e_(3),AP,ux,Ex(kV(e)),Ax(10),Fk(zR)]),ep("x"))},$V=function(e){if(e.b){var t=e;return f(fx,M([UI(BR),e_(10),px(10)]),f(Ua,function(e){return f(fx,M([OR(d(wU,16,7,234,.2)),vx(5),e_(4),px(3)]),M([ep(e),NV(e)]))},t))}return _R},RV=i(function(e,t,r,n,a){var i=function(e){return f(IR,M([Ax(20),Tx,Fk(l_),$x]),ep(e))},o=f(Bg,Za(NP),f(Ua,_P,e))?M([i("No trades found.")]):f(Ua,i,$T(f(Ua,function(e){switch(_P(e).$){case"QueryingNumTrades":return fi("Querying "+WN(e.factory)+" Factory...");case"NoneFound":return li;case"FetchingTrades":return fi("Fetching "+WN(e.factory)+" Trades...");default:return li}},e)));return f(IR,M([UI(BR),xR(f(Fx,M([px(5),GL]),o))]),f(fx,M([$x,px(50)]),M([f(Ji,HF,kP(t)),f(fx,M([UI(PI),px(10)]),M([f(IR,M([UI(PI),AP]),l(hV,r.minDai,r.maxDai,n)),f(IR,M([UI(PI),AP]),l(CV,a,r.fiatType,n)),f(Fx,M([UI(PI),AP,px(5)]),M([IV(r.paymentMethod),$V(r.paymentMethodTerms)])),f(uV," ",f(Fx,M([px(5),UI(PI)]),M([ZF,BV])))]))])))}),xV=n(function(e,t,r){var n=f(Bg,f(tu,_P,Za($P)),t),a=function(){return!f(Kc,0,f(xo,function(e){return f(Yw,function(e){return e.checked&&"Open"!==e.label},e.options)},f(FF,Ao,r.filters)))}();return _(f(MP,1800,f(Fx,M([UI(BR),_I(BR),e_(30)]),M([f(fx,M([UI(BR),px(10)]),M([h(RV,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(KF,e,a,n,t,r)]))),vr)}),_V=l(Pk,.95,.98,1),LV=a(function(e,t,r,n){return f(Fx,M([OL({bottom:40,left:0,right:0,top:60}),px(60),UI(BR)]),M([f(Kc,_R,f(xo,f(Ma,IR(M([Fk(WR),Ax(38),$x])),ep),t)),f(Fx,M([OR(_V),px(20),vx(8),Xx,$x,UI(f(OP,e,BR)),pP({blur:3,color:d(wL,0,0,0,.2),offset:_(0,0),size:1})]),M([f(IR,M([UI(BR),e_(15),OR(WR),pP({blur:30,color:d(wL,0,0,0,.15),offset:_(0,0),size:0})]),f(IR,M([Ax(16),Fk(zR),Lx,$x]),ep(r))),n]))]))}),PV=pP({blur:20,color:d(wU,0,0,0,.04),offset:_(0,3),size:0}),DV=function(e){return{$:"MessageInputChanged",a:e}},UV={$:"MessageSubmit"},OV=function(e){return f(Fx,M([UI(BR),px(10)]),M([f(eO,M([UI(BR),_I(PR(100))]),{label:hD("messageInput"),onChange:DV,placeholder:li,spellcheck:!1,text:e.messageInput}),f(XF,M([$x,Ax(24)]),{label:ep("Submit"),onPress:fi(UV)})]))},MV=r(function(e,t){return f(IR,M([_I(BR),UI(BR)]),f(IR,U(M([WP(f(QP,"position","absolute")),WP(f(QP,"top","0")),WP(f(QP,"right","0")),WP(f(QP,"bottom","0")),WP(f(QP,"left","0")),sD]),e),t))}),FV=l(DR,200,205,210),VV=n(function(e,t,r){var n=M([Ux,OR(dF),Fk(WR),tV({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([GL,OR(FV),Fk(B_),tV({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=$(o.who,t)?n:a;return f(IR,U(M([e_(7)]),u),f(_x,vr,M([ep(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return fi(L(l(Pk,0,0,1),WR,"Initiator opened the trade"));case"Recalled":return fi(L(l(Pk,0,0,1),WR,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(fu,8,sp(t))+"..";return fi(L(l(Pk,1,0,1),WR,r+" committed to the trade"));case"Aborted":return fi(L(l(Pk,1,0,0),WR,"Buyer aborted the trade"));case"Claimed":return fi(L(l(Pk,0,1,0),WR,"Buyer marked the external payment complete"));case"Released":return fi(L(l(Pk,0,0,1),WR,"Seller released the "+E_(e)+" and closed the contract"));default:return fi(L(l(Pk,0,0,1),WR,"Seller burned the "+E_(e)+" and closed the contract"))}}();if("Nothing"===c.$)return _R;var d=c.a,h=d.a,p=d.b,g=d.c;return f(IR,M([vx(3),LL(1),xL(l(Pk,1,0,1)),$x,OR(h)]),f(_x,M([Fk(p)]),M([ep(g)])))}),KV=n(function(e,t,r){if(r.b){var n=r;return f(MV,M([UI(BR),_I(BR),vx(5),LL(1),xL(B_),e_(10)]),f(Fx,M([UI(BR),_I(BR),px(10)]),f(Ua,f(VV,e,t),n)))}return f(IR,M([UI(BR),_I(BR),vx(5),LL(1),xL(B_),$x,Fk(l(Pk,.5,.5,.5)),ML]),ep("no messages found."))}),HV=br,jV=function(e){return f(Fx,M([UI(BR),_I(BR),px(10),LL(1),vx(5),e_(20)]),M([l(KV,e.trade.factory,e.userRole,f(HV,function(e){return e.blocknum},Ia(e.history))),OV(e)]))},qV=function(e){return f(IR,M([OR(WR),vx(8),PV,UI(BR),_I(BR)]),jV(e))},GV={$:"NoOp"},zV={$:"ToggleChat"},WV=function(e){if(e.showChatHistory){var t=f(Kc,_R,f(xo,qV,e.chatHistoryModel));return f(IR,M([_I(BR),UI(PR(500)),e_(20),Ux]),d(IF,M([_I(BR),UI(BR)]),f(Ji,rw,t),GV,zV))}return _R},YV=d(wU,1,31,52,.8),JV={$:"AbortAction"},QV=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),XV=function(e){var t=_(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return _R}if("LoadedTrade"!==t.b.$)return _R;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=TL(n.terms.price),u=BL(Yy(i)),s=BL(n.parameters.tradeAmount)+" "+E_(n.factory),c=function(){return"Buyer"===yF(n.parameters).$?_(f(IR,M([o_,Fk(B_)]),ep("buyer")),M([ep("pay the seller "),f(IR,M([Fk(dF)]),ep(o)),ep(" in exchange for the "),f(IR,M([Fk(dF)]),ep(s)),ep(" held in this contract.")])):_(f(IR,M([o_,Fk(B_)]),ep("seller")),M([ep("accept "),f(IR,M([Fk(dF)]),ep(o)),ep(" from the buyer in exchange for the "),f(IR,M([Fk(dF)]),ep(s)),ep(" held in this contract.")]))}(),h=c.a,p=c.b;return d(IF,vr,f(Fx,M([px(20),e_(20),$x,_I(BR),mP]),M([f(IR,M([Ax(26),Tx,$x,tx]),ep("Just to Confirm...")),f(Fx,M([px(20),$x,tx]),f(Ua,_x(M([$x,Ax(18),o_,Fk(YV)])),U(M([U(M([ep("You will deposit "),f(IR,M([Fk(dF)]),ep(u+" "+E_(n.factory))),ep(", thereby becoming the "),h,ep(" of this trade. By doing so, you are agreeing to ")]),p)]),function(){return"Token"===n.factory.$?M([M([ep("(This ususally requires two Metamask signatures. Your "+E_(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):vr}()))),f(IR,M([DU,$x]),f(xF,"Yes, I definitely want to commit to this trade.",l(QV,n,a,i)))])),GV,JV);case"ApproveNeedsSig":return l(_F,M([ep("Waiting for user signature for the approve call."),ep("(check Metamask!)"),ep("Note that there will be a second transaction to sign after this.")]),GV,GV);case"ApproveMining":var g=r.a;return l(_F,M([ep("Mining the initial approve transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction on Etherscan"),url:f(LF,n.factory,g)}),ep("Funds will not leave your wallet until you sign the next transaction.")]),GV,GV);case"CommitNeedsSig":return l(_F,M([ep("Waiting for user signature for the final commit call."),ep("(check Metamask!)"),ep("This will make the deposit and commit you to the trade.")]),GV,GV);case"CommitMining":var g=r.a;return l(_F,M([ep("Mining the final commit transaction..."),f(_k,M([PF,Fk(dF)]),{label:ep("See the transaction"),url:f(LF,n.factory,g)})]),GV,GV);case"ConfirmingAction":var v=r.a;return d(IF,vr,f(Fx,M([px(20),e_(20),$x,_I(BR),mP]),M([f(IR,M([Ax(26),Tx,$x,tx]),ep("Just to Confirm...")),f(Fx,M([px(20),$x,tx]),f(Ua,_x(M([$x,Ax(18),o_,Fk(YV)])),function(){switch(v.$){case"Poke":case"Recall":return vr;case"Claim":return M([M([ep('By clicking "Confirm Payment", you are claiming that you\'ve paid the Seller in a way they can verify. Only do this if you are sure the Seller will agree that they have the money--otherwise they may burn the '+E_(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([ep("Aborting will incur a small penalty on both parties, and refund the rest of the "+E_(n.factory)+".")])]);case"Release":return M([M([ep("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([ep("This will destroy the "+E_(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(IR,M([DU,$x]),function(e){return f(xF,e,Cw(v))}(function(){switch(v.$){case"Poke":return"Poke";case"Recall":return"Recall";case"Claim":return"I understand. Confirm Payment";case"Abort":return"I understand. Abort the trade.";case"Release":return"I understand. Release the "+E_(n.factory)+".";default:return"I understand. Burn the "+E_(n.factory)+"."}}()))])),GV,JV);case"ActionNeedsSig":var v=r.a;return l(_F,M([ep("Waiting for user signature for the "+Sw(v)+" call."),ep("(check Metamask!)")]),GV,GV);default:var v=r.a,g=r.b;return _R}},ZV=r(function(e,t){return f(Fx,M([px(10)]),M([f(IR,M([Ax(17),Tx]),ep(e)),t]))}),eK=function(e){return f(fx,M([px(8)]),M([f(XR,vr,G_),f(IR,M([Ax(24),o_]),ep(BL(e)))]))},tK=r(function(e,t){var r=f($o,Ro(e),f(xo,function(e){return e.address},Sm(t)));return f(ZV,function(){var t=_(e.parameters.initiatorRole,r);if("Buyer"===t.a.$){if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Buying"}t.a;return"Buying"}if("Just"===t.b.$&&"Initiator"===t.b.a.$){t.a,t.b.a;return"You're Selling"}t.a;return"Selling"}(),eK(e.parameters.tradeAmount))}),rK=function(e){return f(fx,M([px(5)]),M([f(Kc,_R,Y_(e.symbol)),f(IR,M([Ax(24),o_]),ep(TL(e)))]))},nK=function(e){return f(ZV,"For",rK(e.terms.price))},aK=l(DR,250,165,22),iK=l(DR,0,255,0),oK=FR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),uK=FR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),sK=FR({description:"released",src:"/DAIHard/static/img/released.svg"}),cK={$:"ToggleStatsModal"},fK=function(e){return f(HV,Fa,e)},lK=n(function(e,t,n){var a=kb(f(Ua,function(e){return f(pp,function(e){return $(f(_o,e,n),fi(t))},f(_h,function(e){if("LoadedTrade"===e.$){var t=e.a;return fi(t)}return li},Ia(e.trades)))},e)),i=Ii(a),o=l(_a,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(yg,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(yg,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:pg,amountReleased:pg,numAborts:0,numBurns:0,numReleases:0},a),u=f(xo,Ho,ov(fK(f(_h,function(e){return function(e){return e?fi(e):li}(il(e.phaseStartInfo.committedTime))},a))));return{amountBurned:o.amountBurned,amountReleased:o.amountReleased,asRole:t,firstTrade:u,numAborts:o.numAborts,numBurns:o.numBurns,numReleases:o.numReleases,numTrades:i}}),dK=r(function(e,t){return d(RF,L(d(wL,0,0,1,1),d(wL,0,0,1,.8),d(wL,0,0,1,.6)),WR,e,t)}),hK=function(e){return{$:"ViewUserHistory",a:e}},pK=f(N$,0,vr),gK=f(ox,Qx,GI.clipX),vK=f(ox,Qx,GI.clipY),yK=f(ox,Sx,GI.textNormalWeight),mK=r(function(e,t){return ri(e/t)}),bK=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(x(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),CK=r(function(e,t){var r=e.a,n=e.b;return l(bK,r,f(mK,il(t),6e4),n)}),EK=r(function(e,t){return f(Fs,24,f(mK,f(CK,e,t),60))}),SK=r(function(e,t){return f(Fs,1e3,il(t))}),TK=r(function(e,t){return f(Fs,60,f(CK,e,t))}),wK={$:"Apr"},IK={$:"Aug"},AK={$:"Dec"},BK={$:"Feb"},kK={$:"Jan"},NK={$:"Jul"},$K={$:"Jun"},RK={$:"Mar"},xK={$:"May"},_K={$:"Nov"},LK={$:"Oct"},PK={$:"Sep"},DK=function(e){var t=f(mK,e,1440)+719468,r=(t>=0?t:t-146096)/146097|0,n=t-146097*r,a=(n-(n/1460|0)+(n/36524|0)-(n/146096|0))/365|0,i=n-(365*a+(a/4|0)-(a/100|0)),o=(5*i+2)/153|0,u=o+(o<10?3:-9);return{day:i-((153*o+2)/5|0)+1,month:u,year:a+400*r+(u<=2?1:0)}},UK=r(function(e,t){switch(DK(f(CK,e,t)).month){case 1:return kK;case 2:return BK;case 3:return RK;case 4:return wK;case 5:return xK;case 6:return $K;case 7:return NK;case 8:return IK;case 9:return PK;case 10:return LK;case 11:return _K;default:return AK}}),OK=r(function(e,t){return f(Fs,60,f(mK,il(t),1e3))}),MK={$:"Fri"},FK={$:"Mon"},VK={$:"Sat"},KK={$:"Sun"},HK={$:"Thu"},jK={$:"Tue"},qK={$:"Wed"},GK=r(function(e,t){switch(f(Fs,7,f(mK,f(CK,e,t),1440))){case 0:return HK;case 1:return MK;case 2:return VK;case 3:return KK;case 4:return FK;case 5:return jK;default:return qK}}),zK=n(function(e,t,r){return e.toAmPm(f(EK,t,r))}),WK=r(function(e,t){return DK(f(CK,e,t)).day}),YK=WK,JK=M([KK,FK,jK,qK,HK,MK,VK]),QK=r(function(e,t){return function(e){return e.a}(f(Kc,_(0,KK),ov(f(pp,function(r){return $(r.b,f(GK,e,t))},f(Ni,r(function(e,t){return _(e,t)}),JK)))))}),XK=function(e){return l(_a,xa,0,e)},ZK=r(function(e,t){return DK(f(CK,e,t)).year}),eH=function(e){return!f(Fs,4,e)&&(!!f(Fs,100,e)||!f(Fs,400,e))},tH=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return eH(e)?29:28;case"Mar":return 31;case"Apr":return 30;case"May":return 31;case"Jun":return 30;case"Jul":case"Aug":return 31;case"Sep":return 30;case"Oct":return 31;case"Nov":return 30;default:return 31}}),rH=M([kK,BK,RK,wK,xK,$K,NK,IK,PK,LK,_K,AK]),nH=r(function(e,t){return f(Kc,_(0,kK),ov(f(pp,function(r){r.a;return $(r.b,f(UK,e,t))},f(Ni,r(function(e,t){return _(e,t)}),rH))))}),aH=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(nH,e,t))}),iH=r(function(e,t){var r=f(bc,f(aH,e,t)-1,rH);return XK(f(Ua,tH(f(ZK,e,t)),r))+f(YK,e,t)}),oH=r(function(e,t){return f(aH,e,t)/4|0}),uH=r(function(e,t){var r=Ri(t),n=e-iu(r);return U(f(xi,"",f(Ua,function(e){return"0"},f(ki,1,n))),r)}),sH=function(e){return e?e<=12?e:e-12:12},cH=Yl(315576e5),fH=r(function(e,t){return Ho(cH*f(ZK,e,t))}),lH=r(function(e,t){var r=f(fH,e,t),n=f(QK,e,r);return 1+((f(iH,e,t)+n)/7|0)}),dH=r(function(e,t){return Ri(f(ZK,e,t))}),hH=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ri(f(aH,t,r));case"MonthSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(aH,t,r));case"MonthFixed":return f(uH,2,f(aH,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(UK,t,r));case"MonthNameFull":return e.toMonthName(f(UK,t,r));case"QuarterNumber":return Ri(1+f(oH,t,r));case"QuarterSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(1+f(oH,t,r));case"DayOfMonthNumber":return Ri(f(YK,t,r));case"DayOfMonthSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(YK,t,r));case"DayOfMonthFixed":return f(uH,2,f(YK,t,r));case"DayOfYearNumber":return Ri(f(iH,t,r));case"DayOfYearSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(iH,t,r));case"DayOfYearFixed":return f(uH,3,f(iH,t,r));case"DayOfWeekNumber":return Ri(f(QK,t,r));case"DayOfWeekSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(QK,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(GK,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(GK,t,r));case"WeekOfYearNumber":return Ri(f(lH,t,r));case"WeekOfYearSuffix":return function(t){return U(Ri(t),e.toOrdinalSuffix(t))}(f(lH,t,r));case"WeekOfYearFixed":return f(uH,2,f(lH,t,r));case"YearNumberLastTwo":return f(pu,2,f(dH,t,r));case"YearNumber":return f(dH,t,r);case"AmPmUppercase":return nb(l(zK,e,t,r));case"AmPmLowercase":return Zp(l(zK,e,t,r));case"HourMilitaryNumber":return Ri(f(EK,t,r));case"HourMilitaryFixed":return f(uH,2,f(EK,t,r));case"HourNumber":return Ri(sH(f(EK,t,r)));case"HourFixed":return f(uH,2,sH(f(EK,t,r)));case"HourMilitaryFromOneNumber":return Ri(1+f(EK,t,r));case"HourMilitaryFromOneFixed":return f(uH,2,1+f(EK,t,r));case"MinuteNumber":return Ri(f(TK,t,r));case"MinuteFixed":return f(uH,2,f(TK,t,r));case"SecondNumber":return Ri(f(OK,t,r));case"SecondFixed":return f(uH,2,f(OK,t,r));case"MillisecondNumber":return Ri(f(SK,t,r));case"MillisecondFixed":return f(uH,3,f(SK,t,r));default:return n.a}}),pH=a(function(e,t,r,n){return f(xi,"",f(Ua,l(hH,e,r,n),t))}),gH=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),vH=function(e){return e>11?"pm":"am"},yH=function(e){switch(e.$){case"Jan":return"January";case"Feb":return"February";case"Mar":return"March";case"Apr":return"April";case"May":return"May";case"Jun":return"June";case"Jul":return"July";case"Aug":return"August";case"Sep":return"September";case"Oct":return"October";case"Nov":return"November";default:return"December"}},mH=function(e){switch(f(Fs,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Fs,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},bH=function(e){switch(e.$){case"Mon":return"Monday";case"Tue":return"Tuesday";case"Wed":return"Wednesday";case"Thu":return"Thursday";case"Fri":return"Friday";case"Sat":return"Saturday";default:return"Sunday"}},CH=p(gH,yH,f(tu,yH,fu(3)),bH,f(tu,bH,fu(3)),vH,mH),EH=pH(CH),SH={$:"MonthNameFull"},TH=SH,wH=function(e){return{$:"Text",a:e}},IH=wH,AH={$:"YearNumber"},BH=AH,kH=n(function(e,t,n){var a=r(function(e,t){return f(Fx,M([Ax(18),px(6)]),M([f(IR,M([Lx]),ep(e)),f(IR,M([yK]),ep(t))]))}),i=EH(M([TH,IH(", "),BH])),o=f(Fx,M([px(23),UI(BR)]),U(f(Ua,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([_("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,pK,t)}return"No Committed Trades yet!"}()),_("Release Outcomes",Ri(n.numReleases)+" trades / "+BL(n.amountReleased)+" "+E_(e)+" Released"),_("Abort Outcomes",Ri(n.numAborts)+" trades"),_("Burn Outcomes",Ri(n.numBurns)+" trades / "+BL(n.amountBurned)+" "+E_(e)+" Burned")])),M([f(IR,M([$x]),f(dK,"View User History",hK(n.asRole)))])));return f(Fx,M([vx(8),gK,vK,OR(P_),px(1),pP({blur:20,color:d(wL,0,0,0,.08),offset:_(0,0),size:0})]),M([f(IR,M([UI(BR),OR(WR),e_(17)]),f(PP,18,t)),f(IR,M([UI(BR),OR(WR),e_(17)]),o)]))}),NH=n(function(e,t,r){var n=l(lK,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=Jp(e.parameters.initiatorRole)+" Stats";return f(IR,r?M([fU(f(IR,M([ZD(30),Ux]),l(kH,e.factory,e.parameters.initiatorAddress,n)))]):vr,f(ZV,a,f(fx,M([UI(BR),px(20),ux,YP(cK)]),f(Ua,fx(M([px(5)])),M([M([f(XR,M([_I(PR(28))]),sK),f(IR,M([Ax(24),o_,Fk(iK)]),ep(l(Os,2,P("0"),Ri(n.numReleases))))]),M([f(XR,M([_I(PR(28))]),oK),f(IR,M([Ax(24),o_,Fk(aK)]),ep(l(Os,2,P("0"),Ri(n.numAborts))))]),M([f(XR,M([_I(PR(28))]),uK),f(IR,M([Ax(24),o_,Fk(TU)]),ep(l(Os,2,P("0"),Ri(n.numBurns))))])])))))}),$H=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+sp(t)}e.a;return"https://kovan.etherscan.io/address/"+sp(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+sp(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+sp(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+sp(t)}}),RH=n(function(e,t,r){return f(_k,e,{label:ep(sp(r)),url:f($H,t,r)})}),xH=function(e){return f(ZV,"Trade Status",f(Fx,M([Ax(24),o_,px(8)]),M([ep(function(){switch(e.state.phase.$){case"Open":return"Buyer"===e.parameters.initiatorRole.$?"Open Buy Offer":"Open Sell Offer";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}}()),l(RH,M([Ax(12),Fk(dF),PF]),e.factory,e.creationInfo.address)])))},_H=f(ox,lx,GI.spaceEvenly),LH=i(function(e,t,r,n,a){return f(fx,M([UI(BR),_H]),M([xH(t),f(tK,t,r),nK(t),l(NH,t,n,a)]))}),PH=l(DR,9,32,107),DH=FR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),UH=f(IR,M([vx(4),ux,YP(zV),e_(5),OR(l(DR,22,0,255))]),f(XR,M([UI(PR(42))]),DH)),OH=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},MH=d(wU,1,31,52,.13),FH=function(e){return f(Fx,M([vx(12),OR(P_),e_(15),px(15),$x]),M([f(IR,M([Ax(24),Tx,ML,$x]),ep("External Payment Method")),f(_x,M([Ax(18),_I(PI),OR(WR),pP({blur:5,color:d(wL,0,0,0,.2),offset:_(-3,3),size:0}),vx(3),e_(5)]),M([f(Kc,f(IR,M([Fk(MH),ML]),ep("No payment methods found.")),f(xo,ep,f(xo,function(e){return e.info},ov(e))))]))]))},VH={$:"Active"},KH=function(e){return{$:"ExpandPhase",a:e}},HH=M([OR(PH),Fk(WR)]),jH=M([OR(WR)]),qH=FR({description:"flame",src:"/DAIHard/static/img/flame.png"}),GH=r(function(e,t){return sg(f(Cs,cg(e),cg(t)))}),zH=r(function(e,t){return d(RF,L(d(wL,1,.6,.2,1),d(wL,1,.6,.2,.8),d(wL,1,.6,.2,.6)),WR,e,t)}),WH=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),YH=function(e){return{$:"ContractActionClicked",a:e}},JH={$:"Web3Connect"},QH=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return d$}e.a;return l$}switch(e.a.$){case"Eth":e.a;return d$;case"Kovan":e.a;return l$;default:e.a;return h$(100)}},XH=n(function(e,t,r){var n=Sm(r);if("Just"===n.$){var a=n.a;if($(QH(t.factory),a.network)){return"TimeUp"===f(I_,e,t).$?_R:f(fx,M([px(8)]),function(){var e=L(t.state.phase,f(Ro,t,a.address),f(_o,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Ji,Cw,f(dK,"Remove and Refund this Trade",mw))])}break e}var r=(e.a,e.b,cg(rS(t.parameters)));return M([f(xF,"Deposit and Commit to Trade",l(WH,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Ji,YH,f(zH,"Abort Trade",aw)),f(Ji,YH,f(xF,"Confirm Payment",lw)),UH])}e.a,e.c.a;return M([UH])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Ji,YH,f(xF,"Burn it All!",fw)),f(Ji,YH,f(dK,"Release Everything",bw)),UH])}e.a,e.c.a;return M([UH])}break e;default:break e}return vr}())}return f(_x,M([Ax(18),ML,Fk(l_)]),M([ep("You must connect to the "+nO(t.factory)+" network to interact with this trade.")]))}return f(xF,"Connect to Wallet",JH)}),ZH={$:"Finished"},ej={$:"NotStarted"},tj=r(function(e,t){var r=_(d_(t),d_(e.state.phase)),n=r.a,a=r.b;return x(n,a)>0?ej:$(n,a)?VH:ZH}),rj=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Ra,r,e),a=t-1,i=r;e=n,t=a,r=i}}),nj=r(function(e,t){return l(rj,vr,e,t)}),aj=a(function(e,t,r,n){var a=BL(f(yg,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+E_(r.factory),i=BL(r.parameters.tradeAmount)+" "+E_(r.factory),o=f(fx,vr,f(nj,3,f(XR,M([_I(PR(18))]),qH))),u=f(Ma,IR(M([Fk(TU)])),ep),s=TL(r.terms.price),c=$(e,r.state.phase),d=f($o,_o(r),f(xo,function(e){return e.address},Sm(n))),h=c?WR:B_,p=_x(M([Fk(h),Ax(18),Tx])),g=c?l(DR,0,226,255):l(DR,16,7,234),v=f(Ma,IR(M([Fk(g)])),ep),y=BL(r.parameters.buyerDeposit)+" "+E_(r.factory),m=r.parameters.abortPunishment,b=BL(m)+" "+E_(r.factory),C=BL(f(GH,r.parameters.buyerDeposit,m))+" "+E_(r.factory),E=BL(f(GH,r.parameters.tradeAmount,m))+" "+E_(r.factory),S=function(){var t=_(e,d);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return _("And Now, We Wait",function(){return"Buyer"===n.$?f(Ua,p,M([M([ep("Your "),u("burnable deposit"),ep(" of "),v(y),ep(" is now held in this contract, and your offer to buy "),v(i),ep(" for "),v(s),ep(" is now listed in the marketplace.")]),M([ep("If another user likes your offer, they can become the Seller by depositing the full "),v(i),ep(" into this contract.")]),M([ep("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),ep(" to you.")])])):f(Ua,p,M([M([ep("Your offer to sell the "),v(i),ep(" held in this contract for "),v(s),ep(" is now listed in the marketplace.")]),M([ep("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),ep(" of 1/3 of the trade amount "),v("("+y+")"),ep(" into this contract.")]),M([ep("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),ep(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return _("Time to Pay Up",f(Ua,p,M([M([ep("You must now pay the Seller "),v(s),ep(" via the External Payment Method, "),f(IR,M([Tx]),ep("and then click ")),u("Confirm Payment"),ep(" before the payment window runs out. Use the chat to coordinate.")]),M([ep("If you abort the trade, or do not confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(") will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to the Seller, "),v(C),ep(" to you).")]),M([ep("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(s),ep(" has been unmistakably transferred.")])])))}t.a,t.b.a;return _("Time to Get Paid",f(Ua,p,M([M([ep("Work and communicate with the Buyer to receive "),v(s),ep(" as described in External Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([ep("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(") will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to you, "),v(C),ep(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return _("Judgement",f(Ua,p,M([M([ep("If the Seller confirms receipt of payment, or makes no decision within the Burn Window, the combined balance of "),v(a),ep(" is yours to claim.")]),M([ep("If they cannot confirm they've received payment from you, they will probably choose to "),u("burn the contract's balance of "),v(a),u("."),ep(" In this case the "),v(a),ep(" will be lost to both parties.")]),M([ep("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return _("Judgement",f(Ua,p,M([M([ep("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([ep("So, have you recieved the "),v(s),ep("? If so, you can click "),v("Release Everything"),ep(".")]),M([ep("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),ep(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([ep("If you don't decide within the Burn Window, the Buyer will be able to claim the full balance.")])])));default:t.a;return _("Contract closed.",M([p(M([ep("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return _("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(Ua,p,M([M([ep("The Seller has deposited "),v(i),ep(" into this contract, and offers to sell it for "),v(s),ep(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),ep(" into this contract by clicking "),u("Deposit and Commit to Trade"),ep(".")]),M([ep("If the trade is successful, the combined "+E_(r.factory)+" balance "),v("("+a+")"),ep(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,ep(" for both parties (see Payment Window for more on this).")]),M([ep("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(s),ep(" within the payment window.")])])):f(Ua,p,M([M([ep("The Buyer is offering to buy "),v(i),ep(" for "),v(s),ep(", and has deposited "),v(y),ep(" into this contract as a "),u("burnable deposit"),ep(". To become the Seller, deposit "),v(i),ep(" into this contract by clicking "),u("Deposit and Commit to Trade"),ep(".")]),M([ep("When you receive the "),v(s),ep(" from the Buyer, the combined "+E_(r.factory)+" balance "),v("("+a+")"),ep(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,ep(" for both parties (see Payment Window for more on this).")]),M([ep("Don't commit unless you can receive "),v(s),ep(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return _("Making the Payment",f(Ua,p,M([M([ep("During this phase, the Buyer is expected to transfer "),v(s),ep(" to the Seller, as described in External Payment Method, "),f(IR,M([Tx]),ep("and ")),u("Confirm the Payment "),ep(" before the payment window runs out. This would move the trade to the final phase.")]),M([ep("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ep(" (1/4 of the "),u("burnable deposit"),ep(" amount) will be "),u("burned"),ep(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ep(" to the Seller, "),v(C),ep(" to the Buyer).")])])));case"Judgment":t.a,t.b;return _("Judgement",f(Ua,p,M([M([ep("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([ep("If the Seller can verify he has received the "),v(s),ep(", he will probably release the total balance of "),v(i),ep(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),ep(".")]),M([ep("If the Seller has not made a decision before the Burn Window expires, the "),v(i),ep(" becomes claimable by the Buyer.")])])));default:t.a,t.b;return _("Contract closed.",vr)}}(),T=S.a,w=S.b;return f(Fx,M([UI(BR),_I(BR),e_(20),px(30)]),M([f(fx,M([UI(BR)]),M([f(IR,M([Ax(24),Tx,Fk(g),GL]),ep(T))])),f(Fx,M([UI(BR),tx,px(13)]),w),f(IR,M([Ux]),function(){switch(f(tj,r,e).$){case"Active":return l(XH,t,r,n);case"NotStarted":return f(IR,M([Ax(20),Tx,ML,Fk(l_)]),ep("Phase not yet started."));default:return f(IR,M([Ax(20),Tx,ML]),ep("Phase no longer active."))}}())]))}),ij=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},oj=FR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),uj=FR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),sj={$:"None"},cj=sj,fj=FR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),lj=function(e){switch(e.$){case"Open":return fj;case"Committed":return oj;case"Judgment":return uj;default:return cj}},dj=r(function(e,t){var r=lj(e),n=function(){switch(t.$){case"NotStarted":return l(DR,10,33,108);case"Active":return l(DR,0,100,170);default:return l(DR,1,129,104)}}(),a=vO(aF(f(_O,TO(gO(n)),mO(50))));return f(IR,M([$x,xR(f(XR,M([$x,tx,_I(PR(60))]),r))]),a)}),hj=function(e){var t=M([ML,Tx,Ax(20)]);switch(e.$){case"Active":return f(IR,U(t,M([Fk(zR)])),ep("Active"));case"NotStarted":return f(IR,U(t,M([Fk(l_)])),ep("Not Started"));default:return f(IR,t,ep("Finished"))}},pj=n(function(e,t,r){var n=f(tj,t,e),a=function(){return"Active"===n.$?l(DR,0,226,255):B_}(),i=f(IR,M([Fk(a),Ax(20),Tx,$x]),ep(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Burn Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return _R;switch(n.$){case"NotStarted":return d(L_,M([$x]),M([Ax(22),o_]),_(B_,P_),f(w_,e,t));case"Active":var a=f(I_,r,t);if("TimeLeft"===a.$){var i=a.a;return d(V_,M([$x]),M([Ax(22),o_]),_(WR,P_),i)}return f(Fx,M([$x,px(10)]),M([f(IR,M([$x]),ep(ij(e))),f(dK,"Poke",Cw(yw))]));default:return f(IR,M([_I(PR(1))]),_R)}}();return f(Fx,M([e_(20),px(10),_I(BR)]),M([f(IR,M([AP,$x]),i),f(IR,M([_I(BR),$x]),f(IR,M([tx]),f(dj,e,n))),f(Fx,M([px(10),DU,$x]),M([f(IR,M([$x]),hj(n)),o]))]))}),gj=r(function(e,t){return{$:"Min",a:e,b:t}}),vj=r(function(e,t){return f(gj,e,t)}),yj=i(function(e,t,r,n,a){var i=f(tj,t,e),o=f(IR,M([e_(10),UI(BR),_I(BR)]),d(aj,e,a,t,r)),u=function(){switch(e.$){case"Open":return t.parameters.autorecallInterval;case"Committed":return t.parameters.autoabortInterval;case"Judgment":return t.parameters.autoreleaseInterval;default:return Ho(0)}}(),s=l(pj,e,t,a),c=(function(){switch(i.$){case"NotStarted":return u;case"Active":return f(ul,f(oS,t.state.phaseStartTime,u),a);default:Ho(0)}}(),M([vx(12),AP,_I(f(vj,380,PI)),pP({blur:8,color:d(wL,0,0,0,.2),offset:_(0,0),size:0})])),h=f(IR,M([_I(BR),UI(PR(1)),OR(function(){return"Active"===i.$?l(Pk,0,0,1):P_}())]),_R);return n?f(fx,U(c,U($(i,VH)?HH:jH,M([UI(BR)]))),M([s,h,o])):f(fx,U(c,U($(i,VH)?HH:jH,M([ux,Ex(KH(e))]))),M([s]))}),mj=a(function(e,t,r,n){return"Closed"===e.state.phase.$?f(fx,M([$x,vx(12),px(10),e_(10),OR(PH),Ax(24),Tx,Fk(WR)]),M([ep("Trade "+OH(e.state.closedReason)),UH])):f(Fx,M([UI(BR),px(10)]),M([f(fx,M([UI(BR),_I(PI),px(20)]),M([h(yj,Io,e,r,$(t,Io),n),h(yj,To,e,r,$(t,To),n),h(yj,wo,e,r,$(t,wo),n)])),FH(e.terms.paymentMethods)]))}),bj=a(function(e,t,r,n){return _(d(LV,1800,li,"Trade at "+function(){var e=Vw(n.trade);if("Just"===e.$){var t=e.a;return sp(t.address)}return"..."}(),f(IR,M([e_(30),UI(BR)]),function(){var e=n.trade;switch(e.$){case"LoadedTrade":var a=e.a;return f(Fx,M([UI(BR),_I(BR),px(40)]),M([h(LH,t,a,n.wallet,r,n.showStatsModal),f(IR,M([UI(BR),f(ax,40,0),px(40)]),d(mj,a,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(IR,M([$x,tx,Ax(30)]),ep("Loading trade info..."));default:return f(IR,M([$x,tx,Ax(30)]),ep("Invalid trade"))}}())),M([WV(n),XV(n)]))}),Cj=n(function(e,t,r){var n=r.a,a=r.b;return _(e(n),t(a))}),Ej=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"InitialBlank":return _(_R,vr);case"CreateModel":var n=r.a;return l(Cj,Ji(EI),Ua(Ji(EI)),MF(n));case"TradeModel":var a=r.a;return l(Cj,Ji(BI),Ua(Ji(BI)),d(bj,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return l(Cj,Ji(wI),Ua(Ji(wI)),l(xV,t.time,t.tradeCaches,i));default:var o=r.a;return _(f(Ji,yI,l(FP,t.time,t.tradeCaches,o)),vr)}}(),n=r.a,a=r.b;return _(f(IR,M([UI(BR),_I(BR),vx(10)]),n),a)}),Sj=function(e){return{$:"DismissNotice",a:e}},Tj=function(e){return f(uP,sV,cV(e))},wj=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(Pk,1,1,1):l(Pk,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(DR,100,200,255);case"Caution":return l(DR,255,188,0);case"Error":return l(DR,255,70,70);default:return l(DR,200,200,200)}}(),o=f(IR,M([Ux,AP,sP(5),Tj(5)]),wF(Sj(t)));return f(IR,M([OR(i),vx(10),e_(8),UI(BR),LL(1),xL(d(wL,0,0,0,.15)),PV]),f(Fx,M([px(4),UI(BR)]),f(Ni,r(function(e,t){return f(_x,M([UI(BR),Fk(a)]),e?t:f(Ra,o,t))}),n.mainParagraphs)))},Ij=function(e){return $(e,vr)?vr:M([f(Fx,M([fV(20),sP(20),px(10),Ux,DU,UI(PR(300)),Ax(15)]),f(Ua,wj,f(pp,function(e){return $(e.b.align,Xh)},f(Ni,r(function(e,t){return _(e,t)}),e)))),f(Fx,M([Tj(20),ZD(100),px(10),GL,AP,UI(PR(300)),Ax(15)]),f(Ua,wj,f(pp,function(e){return $(e.b.align,n$)},f(Ni,r(function(e,t){return _(e,t)}),e))))])},Aj=r(function(e,t){var r=f(Ej,e,t),n=r.a,a=r.b;return _(f(Fx,M([U_(MR),xR(Vx(t)),UI(BR),_I(BR),e_(30)]),M([f(IR,M([_I(PR(50))]),_R),n])),U(a,Ij(t.userNotices)))}),Bj=function(e){return{$:"FocusStyleOption",a:e}},kj=Bj,Nj=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),$j=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),Rj={$:"AllowHover"},xj={$:"Layout"},_j={backgroundColor:li,borderColor:li,shadow:fi({blur:0,color:d(Lk,155/255,203/255,1,1),offset:_(0,0),size:3})},Lj=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:fi(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:fi(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:fi(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?_j:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?Rj:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?xj:t.a}()}}(l(Da,t,{focus:li,hover:li,mode:li},e))},Pj=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(KI);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),KI);case"Text":var a=t.a;return QB(a);default:return QB("")}}),Dj=n(function(e,t,r){var n=Lj(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?Nj(n):$j(n)}();return f(Pj,a,d(Rk,KI,wR,t,FI(M([r]))))}),Uj=gA(5),Oj=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),Mj={$:"SansSerif"},Fj=function(e){return{$:"Typeface",a:e}},Vj=J,Kj=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(xi,"-",Vj(Zp(t)));case"ImportFont":var t=e.a;e.b;return f(xi,"-",Vj(Zp(t)));default:var t=e.a.name;return f(xi,"-",Vj(Zp(t)))}}())}),Hj=function(){var e=M([Fj("Open Sans"),Fj("Helvetica"),Fj("Verdana"),Mj]);return M([f(Ok,UR,l(Uk,"bg-"+Mk(d(Lk,1,1,1,0)),"background-color",d(Lk,1,1,1,0))),f(Ok,Dk,l(Uk,"fc-"+Mk(d(Lk,0,0,0,1)),"color",d(Lk,0,0,0,1))),f(Ok,wx,Ix(20)),f(Ok,Uj,f(Oj,l(_a,Kj,"font-",e),e))])}(),jj=n(function(e,t,r){var n=e.options;return l(Dj,n,f(Ra,xk(f(xi," ",M([GI.root,GI.any,GI.single]))),U(Hj,t)),r)}),qj=function(e){return f(Ok,Uj,f(Oj,l(_a,Kj,"ff-",e),e))},Gj=Mj,zj=Fj,Wj=function(e){return{body:M([function(){var t=f(Aj,e.screenWidth,e),r=t.a,n=t.b,a=U(M([UI(BR),_I(BR),Ex(SR),qj(M([zj("Soleil"),Gj]))]),f(Ua,xR,n));return l(jj,{options:M([kj({backgroundColor:li,borderColor:li,shadow:li})])},a,r)}()]),title:"DAIHard"}},Yj=Gt,Jj=Yj({init:C$,onUrlChange:ER,onUrlRequest:CR,subscriptions:bR,update:jN,view:Wj});!function(t){e.Elm?Je("Elm",e.Elm,t):e.Elm=t}({App:{init:Jj(f(Cu,function(e){return f(Cu,function(t){return f(Cu,function(r){return Ki({height:r,networkId:t,width:e})},f(hl,"height",xT))},f(hl,"networkId",xT))},f(hl,"width",xT)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),R(r,r,f),k(n,e[0],e[1]),k(f,t[0],t[1]),R(n,n,f),R(a,e[3],t[3]),R(a,a,F),R(i,e[2],t[2]),k(i,i,i),N(o,n,r),N(u,i,a),k(s,i,a),k(c,n,r),R(e[0],o,u),R(e[1],c,s),R(e[2],s,u),R(e[3],o,c)}function l(e,t,r){for(var n=0;n<4;++n)A(e[n],t[n],r)}function d(e,t){var r=B(),n=B(),a=B();w(a,t[2]),R(r,t[0],a),R(n,t[1],a),h(e,n),e[31]^=C(r)<<7}function h(e,t){var r,n,a,i=B(),o=B();for(r=0;r<16;++r)o[r]=t[r];for(I(o),I(o),I(o),n=0;n<2;++n){for(i[0]=o[0]-65517,r=1;r<15;++r)i[r]=o[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=o[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,A(o,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function p(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B();return T(e[2],O),g(e[1],t),$(a,e[1]),R(i,a,M),N(a,a,e[2]),k(i,e[2],i),$(o,i),$(u,o),R(s,u,o),R(r,s,a),R(r,r,i),v(r,r),R(r,r,a),R(r,r,i),R(r,r,i),R(e[0],r,i),$(n,e[0]),R(n,n,i),y(n,a)&&R(e[0],e[0],j),$(n,e[0]),R(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),R(e[3],e[0],e[1]),0)}function g(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function v(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)$(n,n),1!==r&&R(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function y(e,t){var r=new P(32),n=new P(32);return h(r,e),h(n,t),m(r,0,n,0)}function m(e,t,r,n){return b(e,t,r,n,32)}function b(e,t,r,n,a){var i,o=0;for(i=0;i>>8)-1}function C(e){var t=new P(32);return h(t,e),1&t[0]}function E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),R(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)$(n,n),2!==r&&4!==r&&R(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}function I(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function A(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function B(e){var t,r=new Float64Array(16);if(e)for(t=0;t=0};var U=B(),O=B([1]),M=B([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),F=B([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),V=B([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),K=B([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),H=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),j=B([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139])}).call(t,r(10).Buffer)},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var o=new a.util.ByteBuffer,u=Math.ceil(i/n)+r,s=new a.util.ByteBuffer,c=r;c0&&(o=a.util.fillString(String.fromCharCode(0),s)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},n.decrypt=function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)},n},a.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(16),r(9),r(35),r(36)},function(e,t,r){var n=r(0);r(26),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e){var t={},r=[];if(!p.validate(e,g.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:h.pki.RDNAttributesAsArray(t.issuer),serialNumber:h.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:p.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(e.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:e.issuer}),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,h.util.hexToBytes(e.serialNumber))]),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(e.encryptedContent.algorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r0){for(var r=p.create(p.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n=r&&a0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,0,!0,e)),n.length>0&&a.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,1,!0,n)),a.value[0].value.push(p.create(p.Class.UNIVERSAL,p.Type.SET,!0,r.signerInfos)),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(r.type).getBytes()),a])},addSigner:function(e){var t=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=h.pki.certificateFromPem(a)),t=a.issuer.attributes,n=a.serialNumber}var i=e.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=h.pki.privateKeyFromPem(i));var o=e.digestAlgorithm||h.pki.oids.sha1;switch(o){case h.pki.oids.sha1:case h.pki.oids.sha256:case h.pki.oids.sha384:case h.pki.oids.sha512:case h.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var s=!1,c=!1,f=0;f="8"&&(r="00"+r);var n=o.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function a(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=o.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=v[this.state].block)},y.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==d&&(this.state=c,b(this,0)),this.blocks},y.prototype.sleep=function(e){e=void 0===e?0:e,this.state=v[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,b(t,0)},e)},y.prototype.wait=function(e){e.wait(this)},y.prototype.wakeup=function(){this.state===l&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,b(this,0))},y.prototype.cancel=function(){this.state=v[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},y.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,b(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e){e.error=!1,e.state=v[e.state][g],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),b(e,0))},0)},b=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||b(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,b(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=d,delete i[e.id],null===e.parent&&(e.type in u?0===u[e.type].length?n.log.error(a,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):u[e.type][0]!==e?n.log.error(a,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(u[e.type].shift(),0===u[e.type].length?delete u[e.type]:u[e.type][0].start()):n.log.error(a,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new y({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in u?u[e.type].push(t):(u[t.type]=[t],m(t))},n.task.cancel=function(e){e in u&&(u[e]=[u[e][0]])},n.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var r in t)t[r].unblock()},e}},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/State.elm b/src/State.elm index ba14350..931b6b3 100644 --- a/src/State.elm +++ b/src/State.elm @@ -278,6 +278,18 @@ update msg model = , Cmd.none ) + ( _, Wallet.Active userInfo ) -> + let + _ = + Debug.log "User pubkey set, but there's already an active userInfo! Overwriting commpubkey." userInfo + + wallet = + Wallet.Active + { userInfo | commPubkey = commPubkey } + in + { model | wallet = wallet } + |> runCmdDown (CmdDown.UpdateWallet wallet) + ( _, _ ) -> ( model |> addUserNotice