From 058e07b5b3d184369e97667e72cb8169a2c04c17 Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 17 Jul 2019 17:37:39 +0200 Subject: [PATCH] Rework heading links --- docs/404.html | 2 +- docs/index.html | 2 +- ...43ed49.js => main-89bdc4f801cfd149b024.js} | 2 +- src/View.elm | 24 +++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) rename docs/static/js/{main-25007549cf2b2843ed49.js => main-89bdc4f801cfd149b024.js} (77%) diff --git a/docs/404.html b/docs/404.html index 96ba50d..7f6e0ab 100644 --- a/docs/404.html +++ b/docs/404.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 96ba50d..7f6e0ab 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-25007549cf2b2843ed49.js b/docs/static/js/main-89bdc4f801cfd149b024.js similarity index 77% rename from docs/static/js/main-25007549cf2b2843ed49.js rename to docs/static/js/main-89bdc4f801cfd149b024.js index 52b375f..04a7749 100644 --- a/docs/static/js/main-25007549cf2b2843ed49.js +++ b/docs/static/js/main-89bdc4f801cfd149b024.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(43),Q=r(44),X=r(45);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 S(this,e,t,r);case"utf8":case"utf-8":return E(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^E),E^=t,S^=t<<4,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=858993459&(S>>>2^E),E^=t,S^=t<<2,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=16711935&(E>>>8^S),S^=t,E^=t<<8,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=S<<8|E>>>20&240,S=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var T=0;T>>26,E=E<<2|E>>>26):(S=S<<1|S>>>27,E=E<<1|E>>>27),S&=-15,E&=-15;var w=r[S>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|o[S>>>12&15]|u[S>>>8&15]|s[S>>>4&15],I=c[E>>>28]|f[E>>>24&15]|l[E>>>20&15]|d[E>>>16&15]|h[E>>>12&15]|p[E>>>8&15]|g[E>>>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[S>>>24&63]|l[S>>>16&63]|h[S>>>8&63]|g[63&S]|s[E>>>24&63]|f[E>>>16&63]|d[E>>>8&63]|p[63&E])}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 S(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 E(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 S=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,S,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 R(e){this.m=e}function $(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 R(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 W(){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 Re(e){var t=a();return this.divRemTo(e,t,null),t}function $e(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 Ye(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 R(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,E,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,S,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(),S=2,f()}function f(){if(S<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++S,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 S=2;S<=i;++S)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)&~S)+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,[]),S=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=S&&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,S=r.verify?r.verify(C,u,n):C;if(!0!==S)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||f.util.isArray(S)?"string"==typeof S&&(o.error=S):(S.message&&(o.message=S.message),S.error&&(o.error=S.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),S=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(S)}var E=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));E=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,[E]),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),R=c.hmac.create();R.start(u,e),R.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,$.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,S,E,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],S=e[2][1],E=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],R=e[7][0],$=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|S&(y^b))>>>0,L=$+l+h+f[x][1]+t[x][1],n=R+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,R=k,$=N,k=A,N=B,A=w,B=I,L=T+a,w=E+n+(L/4294967296>>>0)>>>0,I=L>>>0,E=C,T=S,C=m,S=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]+S,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]+E+(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]+$,e[7][0]=e[7][0]+R+(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=E,null!==e.session.clientCertificate&&(e.expect=S),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=E,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,S=3,E=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,R=f.handleHeartbeat,$=[];$[f.ConnectionEnd.client]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]],$[f.ConnectionEnd.server]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]];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=$[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,t,r,n={};n.startWatching=function(e,n){t=e,r=n,setInterval(a,100)};var a=function(){r.version.getNetwork(function(r,n){r?console.log("error with web3.version.getNetwork: ",r):n!=e&&(t.send(parseInt(n)),e=n)})};return n}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return T(e,t?"True":"False");if("number"==typeof t)return w(e,t+"");if(t instanceof String)return A(e,"'"+E(t,!0)+"'");if("string"==typeof t)return I(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return k(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(S(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return T(e,"Set")+B(e,".fromList")+" "+S(e,Ga(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+S(e,ja(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+S(e,Va(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=S(e,t.a),t=t.b);t.b;t=t.b)n+=","+S(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=S(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return T(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return I(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return k(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(B(e,f)+" = "+S(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return k(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 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){return e?""+t+"":t}function N(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+"` "+R(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 "+R(c)+"\n\nIt received the following value:\n\n "+C(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 R(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=x(e,t,0,n);a&&(r=n.pop());a=x(r.a,r.b,0,n));return a}function x(e,t,r,n){if(r>100)return n.push(L(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&N(5),!1;"Set_elm_builtin"===e.$&&(e=Ga(e),t=Ga(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=ja(e),t=ja(t));for(var a in e)if(!x(e[a],t[a],r+1,n))return!1;return!0}function _(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ge("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=le(e.b,t[a]);return ki(n)?n:Ai(f($i,a,n.a));case 8:if("object"!=typeof t||null===t||he(t))return ge("an OBJECT",t);var i=mr;for(var o in t)if(t.hasOwnProperty(o)){var n=le(e.b,t[o]);if(!ki(n))return Ai(f(Ri,o,n.a));i=M(L(o,n.a),i)}return Bi(Ja(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=_e(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=be(i(t.a)),s=0;s0&&bt(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 bt(r,0,n,t):((h?St(l,d):l===d)||bt(r,2,n,d),void Ct(p,g,r,n+1));case 0:return void(e.a!==t.a&&bt(r,3,n,t.a));case 1:return void Et(e,t,r,n,wt);case 2:return void Et(e,t,r,n,It);case 3:if(e.h!==t.h)return void bt(r,0,n,t);var v=Tt(e.d,t.d);v&&bt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&bt(r,5,n,y))}}}function St(e,t){for(var r=0;ru?bt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&bt(r,8,n,{w:a,x:o,y:k})}function At(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 Ct(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}At(e,t,r+Jn,n,a,i)}function Bt(e,t,r,n,a){var i=e[r];if(!i){var o=bt(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 Ct(n,i.z,u,a),void bt(t,9,a,{w:u,A:i})}Bt(e,t,r+Jn,n,a)}function kt(e,t,r,n){Nt(e,t,r,0,0,t.b,n)}function Nt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)kt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Nt(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&&Nt(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 Nt(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 Rt(e,t,r,n){return 0===r.length?e:(kt(e,t,r,n),$t(e,r))}function $t(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Oh,o,function(e){return ba(Mh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Vh,e,L(r,zh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Vh,e,L(r,Gh({received:n.loaded,size:n.lengthComputable?ba(n.total):Ca}))))})}function Ht(e,t){function r(){n=1===n?0:(aa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&aa(r),n=2)}}function jt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(qt()))};return na({setup:function(e){return a.a=e,sa.addEventListener("popstate",a),sa.navigator.userAgent.indexOf("Trident")<0||sa.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=qt(),o=Eg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?fg(o):cg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Eg(Dn.location.href).a||N(1)}function Gt(e,t){return Ie(function(r){aa(function(){var n=document.getElementById(e);r(n?Te(t(n)):we(lg(e)))})})}function zt(e){return Ie(function(t){aa(function(){t(Te(e()))})})}function Yt(){return{scene:Wt(),viewport:{x:sa.pageXOffset,y:sa.pageYOffset,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight}}}function Wt(){var e=ua.body,t=ua.documentElement;return{width:Math.max(e.scrollWidth,e.offsetWidth,t.scrollWidth,t.offsetWidth,t.clientWidth),height:Math.max(e.scrollHeight,e.offsetHeight,t.scrollHeight,t.offsetHeight,t.clientHeight)}}function Jt(e){return Gt(e,function(e){var t=e.getBoundingClientRect(),r=sa.pageXOffset,n=sa.pageYOffset;return{scene:Wt(),viewport:{x:r,y:n,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Qt(e){return f(hg,dg,Ie(function(t){try{sa.location=e}catch(e){Dn.location.reload(!1)}}))}function Xt(e){try{return ba(decodeURIComponent(e))}catch(e){return Ca}}function Zt(){return f(_a,nu(As),f(_a,us,Is))}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 er,tr,rr=[],nr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),fr=(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 _(e,t)>=0}),r(function(e,t){var r=_(e,t);return r<0?Oa:r?Ka:Ua})),vr={$:"#0"},yr=r(O),mr={$:"[]"},br=r(M),Cr=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 F(n)}),Sr=(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 F(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 F(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 F(o)}),r(function(e,t){return F(V(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return F(V(t).sort(function(t,r){var n=f(e,t,r);return n===Ua?0:n===Oa?-1:1}))}),Tr=r(function(e,t){return e+t}),wr=r(function(e,t){return e-t}),Ir=r(function(e,t){return e*t}),Ar=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Br=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?N(11):r>0&&e<0||r<0&&e>0?r+e:r})),kr=Math.PI,Nr=(Math.E,Math.cos),Rr=Math.sin,$r=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),xr=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),Pr=(isNaN,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})),Dr=r(function(e,t){return e+t}),Ur=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),jr=r(function(e,t){return 0===t.indexOf(e)}),qr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),Gr=r(function(e,t){var r=e.length;if(r<1)return mr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return F(a)}),zr=oe(function(e){return"number"!=typeof e?ge("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ie(function(r){r(Te(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),wn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),In=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),An=n(function(e,t,r){return e.setUint8(t,r),t+1}),Bn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),kn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),Nn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),Rn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),$n=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}),_n=r(function(e,t){try{return ba(f(e,t,0).b)}catch(e){return Ca}}),Ln=(r(function(e,t){return L(t+1,e.getInt8(t))}),n(function(e,t,r){return L(r+2,t.getInt16(r,e))}),n(function(e,t,r){return L(r+4,t.getInt32(r,e))}),r(function(e,t){return L(t+1,e.getUint8(t))})),Pn=(n(function(e,t,r){return L(r+2,t.getUint16(r,e))}),n(function(e,t,r){return L(r+4,t.getUint32(r,e))}),n(function(e,t,r){return L(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return L(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return L(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Dn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ba(l):Ca}a.push(d(vd,n[0],n.index,i,F(f))),s=t.lastIndex}return t.lastIndex=u,F(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?ba(o):Ca}return r(d(vd,t,arguments[arguments.length-2],i,F(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,F(a)}),n(function(e,t,r){return Ie(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(qh)}),i.addEventListener("timeout",function(){a(Yh)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Mh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Hh(r.url))}return Ot(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ta=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ra=(r(function(e,t){return{$:0,d:t.d,b:t.b,a:function(r){return e(t.a(r))}}}),r(function(e,t){return{$:0,a:e,b:t}})),na=(r(function(e,t){return new Blob([t],{type:e})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:N(0),o=Dt(i);return Ht(r,function(e){var r=a(e),n=mt(o,r);i=Rt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=Dn.title,o=Dn.body,u=Dt(o);return Ht(r,function(e){er=n;var r=a(e),s=On("body")(mr)(r.body),c=mt(u,s);o=Rt(o,u,c,t),u=s,er=0,i!==r.title&&(Dn.title=i=r.title)})})})),aa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ia=(r(function(e,t){return f(hg,dg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(hg,dg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(hg,dg,Ie(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),ua="undefined"!=typeof document?document:oa,sa="undefined"!=typeof window?window:oa,ca=(n(function(e,t,r){return ke(Ie(function(n){function a(e){Be(r(e))}return e.addEventListener(t,a,tr&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=le(e,t);return ki(r)?ba(r.a):Ca}),r(function(e,t){return Gt(t,function(t){return t[e](),vr})}),r(function(e,t){return zt(function(){return sa.scroll(e,t),vr})})),fa=(n(function(e,t,r){return Gt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,vr})}),r(function(e,t){return Ie(function(r){var n=setInterval(function(){Be(t)},e);return function(){clearInterval(n)}})})),la=function(e){return{$:"Native",a:e}},da={$:"XDai"},ha={$:"EthDai"},pa={$:"KovanDai"},ga={$:"Rootstock"},va={$:"RootstockTest"},ya=function(e){return{$:"Token",a:e}},ma=r(function(e,t){return e(t)}),ba=function(e){return{$:"Just",a:e}},Ca={$:"Nothing"},Sa=function(e){e:for(;;)switch(e.$){case"Mainnet":return ba(ya(ha));case"Kovan":return ba(ya(pa));case"RskMain":return ba(la(ga));case"RskTest":return ba(la(va));case"Private":if(100===e.a)return ba(la(da));break e;default:break e}return Ca},Ea={$:"ETCMain"},Ta={$:"ETCTest"},wa={$:"Expanse"},Ia={$:"Kovan"},Aa={$:"Mainnet"},Ba=function(e){return{$:"Private",a:e}},ka={$:"Rinkeby"},Na={$:"Ropsten"},Ra={$:"RskMain"},$a={$:"RskTest"},xa=function(e){switch(e){case 1:return Aa;case 2:return wa;case 3:return Na;case 4:return ka;case 30:return Ra;case 31:return $a;case 42:return Ia;case 41:return Ea;case 62:return Ta;default:return Ba(e)}},_a=n(function(e,t,r){return t(e(r))}),La=f(_a,xa,Sa),Pa=n(function(e,t,r){return{factoryType:e,httpProvider:t,wsProvider:r}}),Da=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return l(Pa,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws")}e.a;return l(Pa,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws")}switch(e.a.$){case"Eth":e.a;return l(Pa,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws");case"Kovan":e.a;return l(Pa,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws");case"XDai":e.a;return l(Pa,e,"https://dai.poa.network","");case"Rootstock":e.a;return l(Pa,e,"https://public-node.rsk.co","");default:e.a;return l(Pa,e,"https://public-node.testnet.rsk.co","")}},Ua={$:"EQ"},Oa={$:"LT"},Ma=cr,Fa=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(Ma,o,r,n)}var a=t.a;return l(Ma,e,r,a)});return l(Ma,o,l(Ma,e,t,i),a)}),Va=function(e){return l(Fa,za,mr,e)},Ka={$:"GT"},Ha=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(Ha,e,t,o)),c=i;e=u,t=s,r=c}}),ja=function(e){return l(Ha,n(function(e,t,r){return f(za,L(e,t),r)}),mr,e)},qa=function(e){return l(Ha,n(function(e,t,r){return f(za,e,r)}),mr,e)},Ga=function(e){var t=e.a;return qa(t)},za=br,Ya=Tr,Wa=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}}),Ja=function(e){return l(Wa,za,mr,e)},Qa=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(Wa,e,t,Ja(p)):d(Qa,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}),Xa=n(function(e,t,r){return d(Qa,e,t,0,r)}),Za=r(function(e,t){return t.b?l(Xa,za,t,e):e}),ei=r(function(e,t){return U(t,{userNotices:f(Za,t.userNotices,F([e]))})}),ti=r(function(e,t){return l(Wa,ei,t,e)}),ri=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),ni=$r,ai=r(function(e,t){return Lr(t)/Lr(e)}),ii=K,oi=ni(f(ai,2,32)),ui=rr,si=d(ri,0,oi,ui,ui),ci=function(e){return{$:"Leaf",a:e}},fi=function(e){return{$:"SubTree",a:e}},li=ar,di=r(function(e,t){for(;;){var r=f(li,32,e),n=r.a,a=r.b,i=f(za,fi(n),t);if(!a.b)return Ja(i);var o=a,u=i;e=o,t=u}}),hi=r(function(e,t){return t(e)}),pi=hr,gi=function(e){return e.a},vi=r(function(e,t){for(;;){var r=ni(t/32);if(1===r)return f(li,32,e).a;var n=f(di,e,mr),a=r;e=n,t=a}}),yi=xr,mi=r(function(e,t){return _(e,t)>0?e:t}),bi=Ir,Ci=wr,Si=m,Ei=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=yi(f(ai,32,r-1)),a=e?Ja(t.nodeList):t.nodeList,i=f(vi,a,t.nodeListSize);return d(ri,Si(t.tail)+r,f(mi,5,n*oi),i,t.tail)}return d(ri,Si(t.tail),oi,ui,t.tail)}),Ti=nr,wi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(Ei,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=ci(l(Ti,32,t,e)),o=e,u=t-32,s=r,c=f(za,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),Ii=r(function(e,t){if(e<=0)return si;var r=e%32,n=l(Ti,r,e-r,t);return h(wi,t,e-r-32,e,mr,n)}),Ai=function(e){return{$:"Err",a:e}},Bi=function(e){return{$:"Ok",a:e}},ki=function(e){return"Ok"===e.$},Ni=r(function(e,t){return{$:"Failure",a:e,b:t}}),Ri=r(function(e,t){return{$:"Field",a:e,b:t}}),$i=r(function(e,t){return{$:"Index",a:e,b:t}}),xi=function(e){return{$:"OneOf",a:e}},_i=yr,Li=j,Pi=function(e){var t=Li(e);return 97<=t&&t<=122},Di=function(e){var t=Li(e);return t<=90&&65<=t},Ui=function(e){return Pi(e)||Di(e)},Oi=function(e){var t=Li(e);return t<=57&&48<=t},Mi=function(e){return Pi(e)||Di(e)||Oi(e)},Fi=function(e){return l(Wa,r(function(e,t){return t+1}),0,e)},Vi=Cr,Ki=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(za,t,r);e=n,t=a,r=i}}),Hi=r(function(e,t){return l(Ki,e,t,mr)}),ji=r(function(e,t){return l(Vi,e,f(Hi,0,Fi(t)-1),t)}),qi=Kr,Gi=Z,zi=r(function(e,t){return f(Fr,e,V(t))}),Yi=z,Wi=r(function(e,t){return F(f(Mr,e,t))}),Ji=function(e){return f(zi,"\n ",f(Wi,"\n",e))},Qi=on,Xi=r(function(e,t){return"\n\n("+Gi(e+1)+") "+Ji(Zi(t))}),Zi=function(e){return f(eo,e,mr)},eo=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=Yi(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ui(n)&&f(qi,Mi,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(za,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Gi(s)+"]",o=n,u=f(za,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(zi,"",Ja(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Gi(Fi(l))+" ways:";return f(zi,"\n\n",f(za,h,f(ji,Xi,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(zi,"",Ja(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(zi,"",Ja(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Ji(f(Qi,4,g))+"\n\n")+p}}),to=Wr,ro=ze("txIn",to),no=function(e){return e},ao=qe("txOut",no),io={$:"Open"},oo=Me,uo=oo(mr),so=a(function(e,t,r,n){return L({agentAddress:t,agentRole:r,userInfo:n,viewPhase:io,web3Context:e},uo)}),co=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),fo={$:"None"},lo=fo,ho=function(e){return d(co,e,uo,lo,mr)},po=function(e){return{$:"GotoRoute",a:e}},go=function(e){return{$:"AbiDecoder",a:e}},vo=r(function(e,t){return{$:"Tape",a:e,b:t}}),yo=Y,mo=Vr,bo=r(function(e,t){return e<1?t:l(mo,e,yo(t),t)}),Co=bo(64),So=n(function(e,t,r){return L(f(vo,e,Co(t)),r)}),Eo=r(function(e,t){return e<1?"":l(mo,0,e,t)}),To=Eo(64),wo=r(function(e,t){if("Ok"===t.$){var r=t.a;return Bi(e(r))}var n=t.a;return Ai(n)}),Io=function(e){return-e},Ao=r(function(e,t){return e<1?"":l(mo,-e,yo(t),t)}),Bo=function(){var e=function(e){if(!f(qi,pi(D("0")),f(Eo,63,e)))return Ai("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Ao,1,e)){case"0":return Bi(!1);case"1":return Bi(!0);default:return Ai("Boolean decode error. "+e+" is not 1 or 0.")}};return go(function(t){var r=t.a,n=t.b;return f(wo,f(So,r,n),e(To(n)))})}(),ko=jr,No=function(e){return f(ko,"0x",e)||f(ko,"0X",e)?f(bo,2,e):e},Ro=function(e){return e.b},$o=r(function(e,t){var r=e.a;return f(wo,Ro,r(function(e){return f(vo,e,e)}(No(t))))}),xo=Zr,_o=ie,Lo=Jr,Po=ae,Do=function(e){return f(xo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Po(n)}var a=r.a;return _o(a)},Lo)},Uo=f(_a,$o,Do),Oo=function(e){return{$:"Magnitude",a:e}},Mo=function(e){return{$:"Pos",a:e}},Fo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Vo=function(e){return{$:"MagnitudeNotNormalised",a:e}},Ko=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 ba(n)}return Ca}},Ho=function(e){var t=Ko(e);return"Nothing"!==t.$&&t.a<0},jo=function(e){return{$:"Neg",a:e}},qo={$:"Zer"},Go=function(e){return!e.b},zo=r(function(e,t){var r=t.a;if(Go(r))return qo;switch(e.$){case"Zero":return qo;case"Positive":return Mo(t);default:return jo(t)}}),Yo=r(function(e,t){return f(Fo,e,Vo(t))}),Wo=function(e){return f(Xa,r(function(t,r){return e(t)&&Go(r)?mr:f(za,t,r)}),mr)}(pi(0)),Jo=Ar,Qo=-1+f(Jo,10,7),Xo=Qo+1,Zo=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),eu=function(e){return e<0?f(Zo,Ya(-1),eu(e+Xo)):L(e/Xo|0,e%Xo)},tu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=eu(r+e),i=a.a,o=a.b;return f(za,o,f(tu,i,n))}{if(!(_(e,Xo)>0))return F([e]);var u=F([e]);e=0,t=u}}}),ru=function(e){var t=e.a;return Oo(Wo(f(tu,0,t)))},nu=r(function(e,t){return l(Xa,r(function(t,r){return f(za,e(t),r)}),mr,t)}),au=nu(Io),iu={$:"Negative"},ou={$:"Positive"},uu={$:"Zero"},su=function(e){switch(e.$){case"Positive":return iu;case"Negative":return ou;default:return uu}},cu=function(e){for(;;){var t=e.a,r=e.b,n=ru(r),a=n.a;if(!Ho(a))return f(zo,t,Oo(a));e=f(Yo,su(t),au(a))}},fu=gr,lu=function(e){switch(f(fu,e,0).$){case"LT":return iu;case"GT":return ou;default:return uu}},du=function(e){return e<0?-e:e},hu=function(e){return cu(f(Fo,lu(e),Vo(F([du(e)]))))},pu=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(Jo,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},gu=function(e){switch(e.$){case"Zer":return qo;case"Neg":var t=e.a;return Mo(t);default:return e}},vu=function(e){return{$:"MagnitudePair",a:e}},yu=r(function(e,t){var r=L(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(za,L(a,u),f(yu,i,s))}var c=r.a,a=c.a,i=c.b;return f(za,L(a,0),f(yu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(za,L(0,u),f(yu,mr,s))}return mr}),mu=r(function(e,t){var r=e.a,n=t.a;return vu(f(yu,r,n))}),bu=function(e){switch(e.$){case"Zer":return f(Yo,uu,mr);case"Neg":var t=e.a.a;return f(Yo,ou,au(t));default:var t=e.a.a;return f(Yo,ou,t)}},Cu=r(function(e,t){var r=bu(t),n=r.b,a=bu(e),i=a.b,o=f(mu,i,n),u=o.a,s=f(nu,function(e){return e.a+e.b},u);return cu(f(Fo,ou,Vo(s)))}),Su=a(function(e,t,r,n){e:for(;;){var a=L(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 Ka}return a.b.b?Oa:f(fu,e,t)}}),Eu=function(e){switch(e.$){case"LT":return Ka;case"EQ":return Ua;default:return Oa}},Tu=r(function(e,t){var r=L(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(Su,0,0,n,a)}return Ka;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Eu(d(Su,0,0,n,a))}return Oa;default:switch(r.b.$){case"Pos":r.a;return Oa;case"Zer":r.a,r.b;return Ua;default:r.a;return Ka}}}),wu=r(function(e,t){return $(f(Tu,e,t),Ka)}),Iu=H,Au=r(function(e,t){return!f(wu,e,t)}),Bu=function(e){switch(e.$){case"Zer":return Oo(mr);case"Pos":default:var t=e.a;return t}},ku=r(function(e,t){var r=e.a;return ru(Vo(f(nu,bi(t),r)))}),Nu=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(ku,Oo(n),a),u=f(Nu,Oo(i),Oo(n)),s=u.a,c=f(Cu,f(zo,ou,o),f(zo,ou,Oo(f(za,0,s))));return Bu(c)}var a=r.a;return f(ku,Oo(n),a)}return Oo(mr)}),Ru=function(e){switch(e.$){case"Zer":return uu;case"Pos":return ou;default:return iu}},$u=r(function(e,t){return $(e,uu)||$(t,uu)?uu:$(e,t)?ou:iu}),xu=r(function(e,t){return f(zo,f($u,Ru(e),Ru(t)),f(Nu,Bu(e),Bu(t)))}),_u=function(e){switch(e.$){case"Zer":return qo;case"Pos":var t=e.a;return jo(t);default:var t=e.a;return Mo(t)}},Lu=r(function(e,t){return f(Cu,e,_u(t))}),Pu=hu(0),Du=a(function(e,t,r,n){if(e){var a=hu(e),i=f(xu,f(xu,a,n),t),o=f(Au,i,r)?L(f(xu,a,t),f(Lu,r,i)):L(Pu,r),u=o.a,s=o.b,c=d(Du,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Cu,u,l),h)}return L(Pu,r)}),Uu=ni(f(ai,2,Qo)),Ou=n(function(e,t,r){return d(Du,f(Jo,2,Uu),e,t,r)}),Mu=hu(1),Fu=r(function(e,t){return e}),Vu=n(function(e,t,r){return l(Wa,Fu(e),t,f(Hi,1,r))}),Ku=function(e){return l(Vu,xu(hu(Xo)),Mu,e)},Hu=n(function(e,t,r){if(e){var n=l(Ou,Ku(e),t,r),a=n.a,i=n.b,o=l(Hu,e-1,i,r),u=o.a,s=o.b;return L(f(Cu,a,u),s)}return l(Ou,Ku(e),t,r)}),ju=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},qu=r(function(e,t){if($(t,Pu))return Ca;var r=Fi(ju(e))-Fi(ju(t))+1,n=l(Hu,f(mi,0,r),gu(e),gu(t)),a=n.a,i=n.b;return ba(L(f(zo,f($u,Ru(e),Ru(t)),Bu(a)),f(zo,Ru(e),Bu(i))))}),Gu=f(xu,hu(2),hu(2147483648)),zu=Pr,Yu=function(e){return f(zu,e,"")},Wu=Sn,Ju=n(function(e,t,r){return e<=0?r:l(Ju,e>>1,O(t,t),1&e?O(r,t):r)}),Qu=r(function(e,t){return l(Ju,e,t,"")}),Xu=n(function(e,t,r){return O(f(Qu,e-yo(r),Yu(t)),r)}),Zu=re,es=Br,ts=function(e){e:for(;;)switch(e){case 0:return D("0");case 1:return D("1");case 2:return D("2");case 3:return D("3");case 4:return D("4");case 5:return D("5");case 6:return D("6");case 7:return D("7");case 8:return D("8");case 9:return D("9");case 10:return D("a");case 11:return D("b");case 12:return D("c");case 13:return D("d");case 14:return D("e");case 15:return D("f");default:var t=e;e=t;continue e}},rs=r(function(e,t){for(;;){if(t<16)return f(za,ts(t),e);var r=f(za,ts(f(es,16,t)),e),n=t/16|0;e=r,t=n}}),ns=function(e){return Zu(e<0?f(za,D("-"),f(rs,mr,-e)):f(rs,mr,e))},as=function(e){var t=f(qu,e,Gu);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=ns(pu(a));return $(n,hu(0))?i:O(as(n),l(Xu,8,D("0"),i))},is=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Oo(mr))?"0":as(Mo(t));default:var t=e.a;return"-"+is(f(xu,hu(-1),e))}},os=function(e){return l(Xu,64,D("0"),e)},us=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=os(ns(a)),c=function(e){return O(e,n)}(os(ns(u)));return P(a+32+(yo(n)/2|0),O(i,s),O(o,c))}return P(a,O(i,n),o)});return function(e){return O(e.b,e.c)}(l(Wa,t,P(32*Fi(e),"",""),e))},ss=Ur,cs=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))))}),fs=n(function(e,t,n){return l(ss,r(function(t,r){return l(cs,e,Li(t),r)}),t,n)}),ls=function(e){return Ja(l(fs,za,mr,e))},ds=function(e){return f(zi,"",f(nu,f(_a,ns,f(Xu,2,D("0"))),ls(e)))},hs=function(e){return 64-f(es,64,e)},ps=function(e){return O(e,f(Qu,hs(yo(e)),"0"))},gs=function(e){return L(ba(yo(e)/2|0),ps(e))},vs=function(e){return L(Ca,os(e))},ys=function(e){switch(e){case"0000":return D("0");case"0001":return D("1");case"0010":return D("2");case"0011":return D("3");case"0100":return D("4");case"0101":return D("5");case"0110":return D("6");case"0111":return D("7");case"1000":return D("8");case"1001":return D("9");case"1010":return D("a");case"1011":return D("b");case"1100":return D("c");case"1101":return D("d");case"1110":return D("e");case"1111":return D("f");default:return D("!")}},ms=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"}},bs=Or,Cs=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=L(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return L(f(zu,D("1"),r),!0);case"1":return L(f(zu,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(zu,D("0"),r),!1);case"1":return L(f(zu,D("1"),r),!0);default:break e}return L(r,!0)});return l(bs,t,L("",!1),e).a},Ss=function(e){return l(bs,za,mr,e)},Es=n(function(e,t,r){for(;;){if(""===t)return Ja(r);var n=e,a=f(bo,e,t),i=f(za,l(mo,0,e,t),r);e=n,t=a,r=i}}),Ts=r(function(e,t){return e&&""!==t?l(Es,e,t,mr):F([t])}),ws=function(e){var t=function(){var t=Ss(is(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(_a,Cs,f(Xu,256,D("1"))))}var r=t;return L(r,f(Xu,256,D("0")))}(),r=t.a,n=t.b;return Zu(f(nu,ys,f(Ts,4,n(f(zi,"",f(nu,ms,r))))))},Is=function(e){return{$:"Hex",a:e}},As=function(e){switch(e.$){case"AddressE":var t=e.a.a;return vs(t);case"UintE":var r=e.a;return vs(is(r));case"IntE":var n=e.a;return vs(ws(n));case"BoolE":return vs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return gs(a);case"BytesE":var a=e.a.a;return vs(No(a));case"StringE":var i=e.a;return gs(ds(i));case"ListE":var o=e.a;return function(e){var t=e.a;return gs(t)}(Zt()(o));default:var i=e.a;return vs(No(i))}};try{var Bs=Zt();Zt=function(){return Bs}}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 ks=Dr,Ns=function(e){return 1===yo(e)?f(ks,"0",e):e},Rs=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(za,n,r);e=i,t=o,r=u}}}),$s=r(function(e,t){return Ja(l(Rs,e,t,mr))}),xs=n(function(e,t,r){if(t<=0)return mr;var n=L(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 F([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 F([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(za,i,f(za,u,f(za,h,f(za,m,f($s,t-4,b))))):f(za,i,f(za,u,f(za,h,f(za,m,l(xs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),_s=r(function(e,t){return l(xs,0,e,t)}),Ls=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Ps=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 Qe(e.a)}},Ds={$:"LE"},Us=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Tn,t,r,n);case"I16":var a=e.a,n=e.b;return d(wn,t,r,n,$(a,Ds));case"I32":var a=e.a,n=e.b;return d(In,t,r,n,$(a,Ds));case"U8":var n=e.a;return l(An,t,r,n);case"U16":var a=e.a,n=e.b;return d(Bn,t,r,n,$(a,Ds));case"U32":var a=e.a,n=e.b;return d(kn,t,r,n,$(a,Ds));case"F32":var a=e.a,n=e.b;return d(Nn,t,r,n,$(a,Ds));case"F64":var a=e.a,n=e.b;return d(Rn,t,r,n,$(a,Ds));case"Seq":var i=e.b;return l(Os,i,t,r);case"Utf8":var o=e.b;return l(xn,t,r,o);default:var i=e.a;return l($n,t,r,i)}}),Os=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Us,n,t,r);e=i,t=o,r=u}}),Ms=Xe,Fs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Vs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Ps(r),i=n;e=a,t=i}}),Ks=function(e){return f(Fs,f(Vs,0,e),e)},Hs=function(e){return{$:"U8",a:e}},js=Hs,qs=r(function(e,t){return _(e,t)<0?e:t}),Gs=pr,zs=function(e){return{$:"Bytes",a:e}},Ys=zs,Ws=function(e){return Ms(Ks(f(nu,Ys,Ja(e))))},Js=Qe,Qs=r(function(e,t){var r=e.a;return f(_n,r,t)}),Xs=function(e){return{$:"Decoder",a:e}},Zs=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 L(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),ec=r(function(e,t){return Xs(f(Zs,e,t))}),tc=Xs(Ln),rc=r(function(e,t){if("Just"===t.$){return t.a}return e}),nc=function(e){return{$:"Done",a:e}},ac=function(e){return{$:"Loop",a:e}},ic=r(function(e,t){var n=t.a;return Xs(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),oc=function(e){return Xs(r(function(t,r){return L(r,e)}))},uc=r(function(e,t){var r=t.a,n=t.b;return r<=0?oc(nc(Ja(n))):f(ic,function(e){return ac(L(r-1,f(za,e,n)))},e)}),sc=function(e){return f(rc,mr,f(Qs,f(ec,L(Js(e),mr),uc(tc)),e))},cc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return L(f(e,n,i),f(e,a,o))}),fc=r(function(e,t){return l(cc,Wu,e,t)}),lc=f(Hi,0,4),dc=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}}),hc=Je,pc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),gc=function(e){return f(pc,f(_a,hc,Wu(4294967295)),e)},vc=r(function(e,t){return 5*t+e}),yc=4294967295>>>32-oi,mc=ir,bc=n(function(e,t,r){for(;;){var n=yc&t>>>e,a=f(mc,n,r);if("SubTree"!==a.$){var i=a.a;return f(mc,yc&t,i)}var o=a.a,u=e-oi,s=t,c=o;e=u,t=s,r=c}}),Cc=function(e){return e>>>5<<5},Sc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?Ca:ba(_(e,Cc(r))>-1?f(mc,yc&e,i):l(bc,n,e,a))}),Ec=r(function(e,t){var r=f(Sc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Tc=n(function(e,t,r){var n=f(vc,e,t);return f(Ec,n,r)}),wc=or,Ic=a(function(e,t,r,n){var a=yc&t>>>e,i=f(mc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Ic,e-oi,t,r,o);return l(wc,a,fi(u),n)}var s=i.a,c=l(wc,yc&t,r,s);return l(wc,a,ci(c),n)}),Ac=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||_(e,n)>-1?r:_(e,Cc(n))>-1?d(ri,n,a,i,l(wc,yc&e,t,o)):d(ri,n,a,d(Ic,a,e,t,i),o)}),Bc=n(function(e,t,r){return l(Ac,e,t,r)}),kc=a(function(e,t,r,n){var a=f(vc,e,t);return l(Bc,a,r,n)}),Nc=En,Rc=r(function(e,t){return l(cc,Nc,e,t)}),$c=function(e){var t=l(Xa,r(function(t,n){var a={d0:l(Tc,0,t,e.state),d1:l(Tc,1,t,e.state),d2:l(Tc,2,t,e.state),d3:l(Tc,3,t,e.state),d4:l(Tc,4,t,e.state)},i=r(function(e,r){return d(kc,e,t,f(Rc,f(dc,e,a),f(fc,gc(f(dc,f(es,5,e+1),a)),f(dc,f(es,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,lc);return U(e,{state:t})},xc=L(0,0),_c=function(e){return{current:xc,lfsrstate:1,state:e,x:1,y:0}},Lc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Pc=L(1,0),Dc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Uc=r(function(e,t){if(e){var n=f(Dc,1,t);return l(cc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Oc=r(function(e,t){var r=f(es,32,e/32|0),n=f(Dc,r,t),a=f(es,32,e);return f(Uc,a,n)}),Mc=n(function(e,t,r){var n=f(Sc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Ac,e,t(a),r)}),Fc=n(function(e,t,r){return l(Mc,e,Rc(t),r)}),Vc=a(function(e,t,r,n){var a=f(vc,e,t);return l(Fc,a,r,n)}),Kc=function(e){return l(Wa,r(function(e,t){var r=(1<>r}),Jc=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(qs,n,r),i=f(nu,function(e){return f(Wc,e,g)},f(Hi,0,a)),o=Yc(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f(_s,i.outputLen,l(v,g,mr,i.outputLen))},ef=function(e){return{$:"KS",a:e}},tf=function(e){var t=e.a;return ef({config:t,inputLength:0,partial:mr,state:f(Ii,25,Fu(xc))})},rf=function(e){return Xs(Pn(e))},nf=Ms(Ks(mr)),af=r(function(e,t){var n=t.a;return Xs(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),of=r(function(e,t){return f(af,function(e){return rf(t)},rf(e))}),uf=r(function(e,t){return f(rc,nf,f(Qs,f(of,e,Js(t)-e),t))}),sf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Js(e)?f(za,e,n.partial):n.partial;if(!(_(l(Wa,r(function(e,t){return t+Js(e)}),0,i),a)>-1))return ef(U(n,{inputLength:Js(e)+n.inputLength,partial:i}));var o=Ws(i),u=f(rc,nf,f(Qs,rf(a),o)),s=sc(u),c=f(Xc,s,n.state),d=Yc(c),h=f(uf,a,o),p=nf,g=ef(U(n,{inputLength:Js(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),cf=r(function(e,t){return Zc(f(sf,Ms(Ks(f(nu,js,t))),tf(e)))}),ff=cf(Ls),lf=function(e){return Is(f(zi,"",f(nu,f(_a,ns,Ns),f(_s,4,ff(f(nu,Li,Ss(e)))))))},df=function(e){return f(ko,"0x",e)||f(ko,"0X",e)?e:"0x"+e},hf=function(e){var t=e.a;return df(t)},pf=r(function(e,t){var r=us(f(nu,As,t)),n=function(e){return O(e,r)}(No(hf(lf(e))));return Is(n)}),gf=function(e){return{data:ba(f(pf,"poke()",mr)),decoder:Uo(Bo),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},vf=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),yf=r(function(e,t){return f(vf,e,t)}),mf=r(function(e,t){return{$:"AgentHistory",a:e,b:t}}),bf=function(e){return{$:"Trade",a:e}},Cf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Sf=r(function(e,t){switch(e.$){case"ViewUserRoleChanged":var r=e.a;return d(co,t,uo,lo,F([po(f(mf,t.agentAddress,r))]));case"ViewPhaseChanged":var n=e.a;return d(co,U(t,{viewPhase:n}),uo,lo,mr);case"Poke":var a=e.a,i=Cf(gf(a)),o={onBroadcast:Ca,onMined:Ca,onSign:Ca},u=f(yf,o,i);return d(co,t,uo,u,mr);case"TradeClicked":var s=e.a;return d(co,t,uo,lo,F([po(bf(s))]));default:return ho(t)}}),Ef=function(e){return{$:"GTag",a:e}},Tf=function(e){return{$:"UserNotice",a:e}},wf={$:"Web3Connect"},If=r(function(e,t){return{mainParagraphs:t,noticeType:e}}),Af=n(function(e,t,r){return e(t(r))}),Bf=en,kf=tn,Nf=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Rf=Vn,$f={$:"Empty"},xf=function(e){return{$:"Styled",a:e}},_f=function(e){return{$:"Text",a:e}},Lf=function(e){return{$:"Unstyled",a:e}},Pf=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return xf({html:r(function(t,r){return f(Rf,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Lf(f(Af,Rf(e),a));case"Text":var i=t.a;return _f(i);default:return $f}}),Df=Pf,Uf=r(function(e,t){return f(If,t.noticeType,f(nu,nu(Df(e)),t.mainParagraphs))}),Of=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return Tf(f(Uf,e,r));case"Web3Connect":return wf;case"GotoRoute":var n=t.a;return po(n);default:var a=t.a;return Ef(a)}}),Mf=r(function(e,t){return f(nu,Of(e),t)}),Ff={$:"Seller"},Vf=function(e){return{$:"Posix",a:e}},Kf=Vf,Hf={autoabortInterval:Kf(0),autorecallInterval:Kf(0),autoreleaseInterval:Kf(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:Ff},jf=function(e){return{$:"TokenValue",a:e}},qf=function(e){return e.a},Gf=r(function(e,t){if("Just"===t.$){var r=t.a;return ba(e(r))}return Ca}),zf=r(function(e,t){return f(rc,Pu,f(Gf,gi,f(qu,e,t)))}),Yf=r(function(e,t){return jf(f(zf,qf(e),hu(t)))}),Wf=function(e){return f(Yf,e,12)},Jf=function(e){return f(Yf,e,3)},Qf=jf(hu(0)),Xf=r(function(e,t){var r=Qf;return{abortPunishment:Wf(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Jf(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Zf=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";case"Rootstock":e.a;return"SBTC";case"RootstockTest":e.a;return"SBTC";default:e.a;return"xDai"}},el=function(e){if(e.b){var t=e.a;e.b;return ba(t)}return Ca},tl=Gr,rl=function(e){var t=el(f(tl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=yo(e)-1-r;return L(O(f(Eo,r,e),f(bo,r+1,e)),n)},nl=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 mr}}),al=function(e){var t=e.a,r=f(nl,pi(0),t);return Oo(r.b?t:mr)},il=ee,ol=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}}}),ul=n(function(e,t,r){var n=f(ol,t,r),a=Fi(r)>0;return e>0&&t>0&&a?f(za,f(_s,e,r),l(ul,e,t,n)):mr}),sl=r(function(e,t){return l(ul,e,e,t)}),cl=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return Ca;var a=n.a;return f(Gf,za(a),r)});return f(Xa,t,ba(mr))}(no),fl=function(e){return f(Gf,f(Af,al,Oo),cl(f(nu,f(_a,Ja,f(_a,Zu,il)),f(sl,7,Ja(e)))))},ll=X,dl=function(e){var t=Ss(ll(e));if(!t.b)return Ca;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Gf,zo(iu),fl(r))}return Ca;case"+":if(t.b.b){var r=t.b;return f(Gf,zo(ou),fl(r))}return Ca;default:var r=t;return f(Gf,zo(ou),fl(r))}},hl=function(e){var t=function(e){return!f(es,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(rc,0,el(r)))}},pl=function(e){return f(xu,e,e)},gl=hu(2),vl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Mu;case"Neg":return qo;default:if($(r,Mu))return f(xu,e,t);if(hl(r)){var n=e,a=pl(t),i=f(zf,r,gl);e=n,t=a,r=i;continue e}var n=f(xu,t,e),a=pl(t),i=f(zf,f(Lu,r,Mu),gl);e=n,t=a,r=i;continue e}}),yl=r(function(e,t){return l(vl,Mu,e,t)}),ml=function(e){if(""===e)return Ca;var t=rl(e),r=t.a,n=t.b,a=dl(r),i=18-n;if(i<0)return Ca;if("Nothing"===a.$)return Ca;var o=a.a,u=f(xu,o,f(yl,hu(10),hu(i)));return ba(u)},bl=function(e){return f(Gf,jf,ml(e))},Cl=qr,Sl=function(e){for(;;){if(f(Cl,".",e))return l(mo,0,-1,e);{if(!f(Cl,"0",e))return""===e?"0":e;e=l(mo,0,-1,e)}}},El=f(Af,f(Xu,7,D("0")),Gi),Tl=function(e){return f(zi,"",e)},wl=function(e){var t=e.a,r=Ja(t);if(r.b){var n=r.a,a=r.b;return Tl(f(za,Gi(n),f(nu,El,a)))}return"0"},Il=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return wl(t);default:var t=e.a;return"-"+wl(t)}},Al=r(function(e,t){return e<1?t:l(mo,0,-e,t)}),Bl=function(e){var t=l(Xu,18,D("0"),Il(e)),r=f(Al,18,t)+"."+f(Ao,18,t);return function(e){return""===e?"0":e}(Sl(r))},kl=r(function(e,t){var r=Bl(t),n=el(f(tl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Eo,a+1+e,r):f(Eo,a,r)}),Nl=r(function(e,t){if("Nothing"===e.$)return Bl(qf(t));var r=e.a;return f(kl,r,qf(t))}),Rl=dr,$l=te,xl=function(e){var t=$l(f(Nl,Ca,e));if("Just"===t.$){return t.a}f(Rl,"Error converting tokenValue to float: string -> float failed",e);return 0},_l=r(function(e,t){if(""===t)return Ai("You must specify a trade amount.");var r=bl(t);if("Nothing"===r.$)return Ai("I don't understand this number.");var n=r.a;return xl(n)<1?Ai("Trade amount must be a least 1 "+Zf(e)+"."):Bi(n)}),Ll=function(e){if(""===e)return Ai("You must specify a fiat price.");var t=dl(e);if("Nothing"===t.$){var r=$l(e);return Ai("Just"===r.$?"Fractional fiat amounts (i.e. $1.20) are not supported. Use a whole number.":"I don't understand this number.")}var n=t.a;return Bi(n)},Pl=r(function(e,t){if("Just"===t.$){var r=t.a;return Bi(r)}return Ai(e)}),Dl=function(e){return""===e},Ul=function(e){return Dl(e)?Ca:ba(e)},Ol=function(e){return f(Pl,"You must specify a fiat type.",Ul(e))},Ml=function(e){return""===e?Ai("Must specify a payment method."):Bi(e)},Fl=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Vl=g(Fl,Ca,Ca,Ca,Ca,Ca,Ca,Ca),Kl=function(e){var t=e.a,r=e.b,n=e.c,a=P(t,r,n);if("Ok"===a.a.$){if("Ok"===a.b.$){if("Ok"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a;return Bi(P(i,o,u))}var s=a.c.a;return Ai(s)}var c=a.b.a;return Ai(c)}var f=a.a.a;return Ai(f)},Hl=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),jl={$:"Custom"},ql=r(function(e,t){return{info:t,type_:e}}),Gl=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return Ai(o)}var u=t.a;if("Err"===r.$){var o=r.a;return Ai(o)}var s=r.a;if("Err"===n.$){var o=n.a;return Ai(o)}var c=n.a;if("Err"===a.$){var o=a.a;return Ai(o)}var f=a.a;if("Err"===i.$){var o=i.a;return Ai(o)}var l=i.a;return Bi(h(e,u,s,c,f,l))}),zl=r(function(e,t){if("Ok"===t.$){var r=t.a;return Bi(r)}var n=t.a;return Ai(e(n))}),Yl=function(e){return e.a},Wl=r(function(e,t){return p(Gl,i(function(e,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:t.userRole,paymentMethods:F([f(ql,jl,a)]),price:{amount:r,fiatType:n},tradeAmount:e}}),f(zl,function(e){return U(Vl,{daiAmount:ba(e)})},f(_l,e,t.daiAmount)),f(zl,function(e){return U(Vl,{fiatAmount:ba(e)})},Ll(t.fiatAmount)),f(zl,function(e){return U(Vl,{fiatType:ba(e)})},Ol(t.fiatType)),f(zl,function(e){return U(Vl,{paymentMethod:ba(e)})},Ml(t.paymentMethod)),Kl(d(Hl,function(e){return Yl(e)>0?Bi(e):Ai(U(Vl,{autorecallInterval:ba("Must specify a non-zero time for this window")}))},function(e){return Yl(e)>0?Bi(e):Ai(U(Vl,{autoabortInterval:ba("Must specify a non-zero time for this window")}))},function(e){return Yl(e)>0?Bi(e):Ai(U(Vl,{autoreleaseInterval:ba("Must specify a non-zero time for this window")}))},P(t.autorecallInterval,t.autoabortInterval,t.autoreleaseInterval))))}),Jl=n(function(e,t,r){if("Nothing"===t.$)return Ca;var n=t.a;if("Nothing"===r.$)return Ca;var a=r.a;return ba(f(e,n,a))}),Ql=function(e){if("Ok"===e.$){var t=e.a;return ba(t)}return Ca},Xl=function(e){var t=f(Wl,e.web3Context.factoryType,e.inputs),r=function(){return $(e.errors,Vl)?Vl:"Ok"===t.$?Vl:t.a}();return U(e,{createParameters:l(Jl,Xf,e.userInfo,Ql(t)),errors:r})},Zl=r(function(e,t){return Xl(U(t,{inputs:e}))}),ed=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),td=r(function(e,t){return d(ed,f(Zl,Hf,{allowance:Ca,createParameters:Ca,depositAmount:Ca,errors:Vl,inputs:Hf,showFiatTypeDropdown:!1,txChainStatus:Ca,userInfo:t,web3Context:e}),uo,lo,mr)}),rd=function(e){return{$:"Address",a:e}},nd=f(_a,No,f(_a,ll,rd)),ad=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return nd("0x41a8a3C08932d285f2AF190c7338ABcC5cFfFBb4")}e.a;return nd("0x4cd4742b61A840630e3509eC0eDb988edB55673f")}switch(e.a.$){case"Eth":e.a;return nd("");case"Kovan":e.a;return nd("");case"Rootstock":e.a;return nd("");case"RootstockTest":e.a;return nd("");default:e.a;return nd("0x4078E3f7a5d475Eb615C643ce5729Cc0cC9Fb11D")}},id=function(e){return nd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},od=function(e){return{$:"AddressE",a:e}},ud=od,sd=function(e){return{$:"UintE",a:e}},cd=sd,fd=n(function(e,t,r){return{data:ba(f(pf,"approve(address,uint256)",F([ud(t),cd(r)]))),decoder:Uo(Bo),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),ld=function(e){return f(Yf,e,200)},dd=r(function(e,t){return jf(f(Cu,qf(e),qf(t)))}),hd=function(e){var t=f(Yf,e.tradeAmount,200);return f(dd,e.pokeReward,f(dd,ld(e.tradeAmount),f(dd,t,function(){return"Buyer"===e.initiatorRole.$?Jf(e.tradeAmount):e.tradeAmount}())))},pd=kf(hi),gd=n(function(e,t,r){return{id:e,initiatorIsCustodian:r,tradeAddress:t}}),vd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),yd=Zn,md=Xn,bd=function(e){return f(md,{caseInsensitive:!1,multiline:!1},e)},Cd=Qn,Sd=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ed=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}}),Td=r(function(e,t){return!f(Ed,f(Af,Iu,e),t)}),wd=Td(no),Id=G,Ad=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Bd=n(function(e,t,r){if("Err"===t.$){var n=t.a;return Ai(n)}var a=t.a;if("Err"===r.$){var n=r.a;return Ai(n)}var i=r.a;return Bi(f(e,a,i))}),kd=f(Xa,Bd(za),Bi(mr)),Nd=function(e){if(e.b){var t=(e.a,e.b);return ba(t)}return Ca},Rd=n(function(e,t,r){e:for(;;){if(!t.b)return Bi(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(Jo,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Jo,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Jo,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Jo,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Jo,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Jo,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Jo,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Jo,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Jo,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Jo,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Jo,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Jo,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Jo,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Jo,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Jo,16,e);e=i,t=o,r=u;continue e;default:var s=n;return Ai(Yu(s)+" is not a valid hexadecimal character.")}}}),$d=function(e){if(Dl(e))return Ai("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(ko,"-",e)){var t=f(rc,mr,Nd(Ss(e)));return f(wo,Io,l(Rd,Fi(t)-1,t,0))}return l(Rd,yo(e)-1,Ss(e),0)}();return f(zl,function(t){return f(zi," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},xd=function(e){var t=Ss(e);return function(e){return L(t,e)}(f(Ad,mr,kd(f(nu,$d,f(Wi,"",f(zi,"",f(nu,f(_a,ns,Ns),f(_s,20,ff(f(nu,f(_a,Id,Li),t))))))))))},_d=function(e){var t=r(function(e,t){return!(t>=8&&Pi(e)||t<8&&Di(e))}),n=xd(No(e)),a=n.a,i=n.b,o=l(Vi,t,a,i);return!!Sd(e)&&wd(o)},Ld=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-f]{40}$"))),Pd=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9A-F]{40}$"))),Dd=function(e){return'"'+e+'"'},Ud=function(e){var t=No(e),r=f(Eo,24,t),n=f(Ao,40,e);return 64===yo(t)&&f(qi,pi(D("0")),r)?Pd(n)||Ld(n)?Bi(rd(n)):_d(n)?Bi(rd(n)):Ai("Given address "+Dd(e)+" failed the EIP-55 checksum test."):40!==yo(t)?Ai("Given address "+Dd(e)+" is not the correct length."):Sd(t)?Pd(t)||Ld(t)?Bi(rd(t)):_d(t)?Bi(rd(t)):Ai("Given address "+Dd(e)+" failed the EIP-55 checksum test."):Ai("Given address "+Dd(e)+" contains invalid hex characters.")},Od=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),Ud(To(r)))}),Md=r(function(e,t){var r=t.a;return go(function(t){var n=t.a,a=t.b;return r(f(vo,n,f(bo,64*e,a)))})}),Fd=Qr,Vd=r(function(e,t){return f(Fd,"data",Uo(f(Md,e,t)))}),Kd=Xr,Hd=r(function(e,t){return f(Fd,"topics",f(Kd,e,Uo(t)))}),jd=function(e){return f(Gf,f(_a,Ja,f(Wa,r(function(e,t){return f(Cu,hu(e),f(xu,t,Gu))}),Pu)),cl(f(nu,f(_a,Ja,f(_a,Zu,f(_a,$d,Ql))),f(sl,8,Ja(e)))))},qd=function(e){var t=Ss(ll(e));e:for(;;){if(!t.b)return Ca;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(Gf,xu(hu(-1)),jd(a))}var i=t.b;i.b;return Ca}var a=t.b;return f(Gf,xu(hu(-1)),jd(a))}return Ca;case"+":if(t.b.b){var a=t.b;return jd(a)}return Ca;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return jd(a)}t.b;return Ca}break e;default:break e}}var a=t;return jd(a)},Gd=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),f(Pl,"Error Decoding Uint into BigInt",qd(df(To(r)))))}),zd=f(pd,f(Hd,1,Bo),f(pd,f(Vd,1,Od),f(pd,f(Vd,0,Gd),Po(gd)))),Yd=me,Wd=f(_a,hf,Yd),Jd=an,Qd=r(function(e,t){return me(l(Wa,Ee(e),Ce(),t))}),Xd=function(e){return me(l(Wa,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},Zd=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(Jd,e,Xd(F([L("data",Yd(t.data)),L("topics",f(Qd,Wd,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),eh=function(e){var t=e.a;return df(t)},th=r(function(e,t){return l(Xa,r(function(t,r){return e(t)?f(za,t,r):r}),mr,t)}),rh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return Ai(r)}),nh=r(function(e,t){return f(wo,function(e){return e.id},f(rh,function(e){return f(zl,Zi,f(Zd,zd,e).returnData)},f(Pl,"No log found from that factoryAddress in that txReceipt",el(f(th,function(t){return $(f(_a,eh,ll)(t.address),f(_a,eh,ll)(ad(e)))},t.logs)))))}),ah=n(function(e,t,r){return{data:ba(f(pf,"allowance(address,address)",F([ud(t),ud(r)]))),decoder:Uo(Gd),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),ih=function(e){switch(e.$){case"BlockNum":var t=e.a;return Yd(df(ns(t)));case"EarliestBlock":return Yd("earliest");case"LatestBlock":return Yd("latest");default:return Yd("pending")}},oh=f(_a,eh,Yd),uh=f(_a,is,f(_a,df,Yd)),sh=f(_a,ns,f(_a,df,Yd)),ch=sn,fh=function(e){return Xd(f(nu,function(e){var t=e.a,r=e.b;return L(t,f(rc,ch,r))},f(th,function(e){e.a;return!$(e.b,Ca)},e)))},lh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return fh(F([L("to",f(Gf,oh,t)),L("from",f(Gf,oh,r)),L("gas",f(Gf,sh,n)),L("gasPrice",f(Gf,uh,a)),L("value",f(Gf,uh,i)),L("data",f(Gf,Wd,o))]))},dh=function(e){return{$:"BadBody",a:e}},hh=function(e){return{$:"BadStatus",a:e}},ph=function(e){return{$:"BadUrl",a:e}},gh={$:"NetworkError"},vh={$:"Timeout"},yh=nn,mh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return Ai(ph(r));case"Timeout_":return Ai(vh);case"NetworkError_":return Ai(gh);case"BadStatus_":var n=t.a,a=t.b;return Ai(hh(n.statusCode));default:var n=t.a,a=t.b,i=f(yh,f(Fd,"result",e),a);if("Ok"===i.$){var o=i.a;return Bi(o)}var u=i.a;return Ai(dh(Zi(u)))}}),bh=me,Ch=n(function(e,t,r){return Xd(F([L("id",bh(e)),L("jsonrpc",Yd("2.0")),L("method",Yd(t)),L("params",f(Qd,no,r))]))}),Sh={$:"RBEmpty_elm_builtin"},Eh=Sh,Th=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return Ca;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(fu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return ba(n);default:var u=e,s=i;e=u,t=s;continue e}}}),wh={$:"Black"},Ih=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Ah={$:"Red"},Bh=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(Ih,Ah,t,r,h(Ih,wh,c,f,l,d),h(Ih,wh,i,o,u,s))}return h(Ih,e,i,o,h(Ih,Ah,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(Ih,Ah,c,f,h(Ih,wh,g,v,y,m),h(Ih,wh,t,r,d,a))}return h(Ih,e,t,r,n,a)}),kh=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Ih,Ah,e,t,Sh,Sh);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(fu,e,a).$){case"LT":return h(Bh,n,a,i,l(kh,e,t,o),u);case"EQ":return h(Ih,n,a,t,o,u);default:return h(Bh,n,a,i,o,l(kh,e,t,u))}}),Nh=n(function(e,t,r){var n=l(kh,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(Ih,wh,a,i,o,u)}return n}),Rh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},$h=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(Ih,Ah,p,g,h(Ih,wh,r,n,h(Ih,Ah,i,o,u,s),v),h(Ih,wh,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(Ih,wh,r,n,h(Ih,Ah,i,o,u,s),h(Ih,Ah,f,l,d,m))}return e},xh=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(Ih,Ah,i,o,h(Ih,wh,s,c,f,l),h(Ih,wh,r,n,d,h(Ih,Ah,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,S=e.e,g=(S.a,S.b),v=S.c,y=S.d,m=S.e;return t.$,h(Ih,wh,r,n,h(Ih,Ah,i,o,C,d),h(Ih,Ah,g,v,y,m))}return e},_h=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(Ih,r,u,s,c,h(Ih,Ah,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 xh(t)}break e}o.a,o.d;return xh(t)}break e}return t}),Lh=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(Ih,t,r,n,Lh(a),u)}var s=$h(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Bh,c,f,l,Lh(d),p)}return Sh}return h(Ih,t,r,n,Lh(a),u)}return Sh},Ph=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Sh;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(_(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(Ih,r,n,a,f(Ph,e,i),o)}var s=$h(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Bh,c,l,d,f(Ph,e,p),v)}return Sh}return h(Ih,r,n,a,f(Ph,e,i),o)}return f(Dh,e,g(_h,e,t,r,n,a,i,o))}),Dh=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=Rh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Bh,r,s,c,i,Lh(o))}return Sh}return h(Bh,r,n,a,i,f(Ph,e,o))}return Sh}),Uh=r(function(e,t){var r=f(Ph,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(Ih,wh,n,a,i,o)}return r}),Oh=n(function(e,t,r){var n=t(f(Th,e,r));if("Just"===n.$){var a=n.a;return l(Nh,e,a,r)}return f(Uh,e,r)}),Mh=function(e){return"Just"===e.$},Fh=vn,Vh=yn,Kh=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Hh=function(e){return{$:"BadUrl_",a:e}},jh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),qh={$:"NetworkError_"},Gh=function(e){return{$:"Receiving",a:e}},zh=function(e){return{$:"Sending",a:e}},Yh={$:"Timeout_"},Wh=function(e){return f(ra,"application/json",f(Qi,0,e))},Jh=n(function(e,t,r){return Wh(l(Ch,e,t,r))}),Qh=f(ta,"",no),Xh=we,Zh=Te,ep=function(e){if("Ok"===e.$){var t=e.a;return Zh(t)}var r=e.a;return Xh(r)},tp=function(e){return l(ea,vr,ep,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:Ca,url:e.url})},rp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return tp({body:l(Jh,1,r,n),headers:mr,method:"POST",resolver:Qh(mh(a)),timeout:Ca,url:t})},np=n(function(e,t,r){return rp({decoder:t.decoder,method:"eth_call",params:F([lh(t),ih(r)]),url:e})}),ap={$:"LatestBlock"},ip=r(function(e,t){return l(np,e,t,ap)}),op=function(e){return{$:"Perform",a:e}},up=cn,sp=Zh(vr),cp=r(function(e,t){return f(up,function(t){return Zh(e(t))},t)}),fp=n(function(e,t,r){return f(up,function(t){return f(up,function(r){return Zh(f(e,t,r))},r)},t)}),lp=function(e){return l(Xa,fp(za),Zh(mr),e)},dp=r(function(e,t){var r=t.a;return ke(f(up,Fh(e),r))}),hp=n(function(e,t,r){return f(cp,function(e){return vr},lp(f(nu,dp(e),t)))}),pp=n(function(e,t,r){return Zh(vr)}),gp=r(function(e,t){var r=t.a;return op(f(cp,e,r))});gn.Task=De(sp,hp,pp,gp);var vp=Oe("Task"),yp=fn,mp=r(function(e,t){return vp(op(f(yp,f(Af,f(Af,Zh,e),Ai),f(up,f(Af,f(Af,Zh,e),Bi),t))))}),bp=i(function(e,t,r,n,a){return f(mp,a,f(ip,e.httpProvider,l(ah,id(t),r,n)))}),Cp=nd("0x2b518987f8c21937B4d0b700b1224736a28fCA23"),Sp=function(e){return{$:"BoolE",a:e}},Ep=Sp,Tp=function(e){return{$:"StringE",a:e}},wp=Tp,Ip=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:ba(f(pf,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([ud(t),ud(r),Ep(n),cd(a),cd(i),cd(o),cd(u),cd(s),cd(c),cd(l),cd(d),wp(h),wp(p)]))),decoder:Uo(Od),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}}}}}}}}}}}}}},Ap=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:ba(f(pf,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([ud(t),ud(r),Ep(n),cd(a),cd(i),cd(o),cd(u),cd(s),cd(c),cd(l),cd(d),wp(h),wp(p)]))),decoder:Uo(Od),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}}}}}}}}}}}}}},Bp=r(function(e,t){return{paymentMethods:t,price:e}}),kp=function(e){return Yd(Il(e))},Np=function(e){return f(Qd,no,F([Yd(e.fiatType),kp(e.amount)]))},Rp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},$p=function(e){return Xd(F([L("type",Yd(Rp(e.type_))),L("info",Yd(e.info))]))},xp=function(e){var t=Np(e.price),r=f(Qd,$p,e.paymentMethods);return f(Qi,0,Xd(F([L("paymentmethods",r),L("price",t)])))},_p=r(function(e,t){return U(t,{value:ba(e)})}),Lp=function(e){return hu(Yl(e))},Pp=function(e){return f(zf,Lp(e),hu(1e3))},Dp=r(function(e,t){var r=function(){return"Token"===e.$?Ip:Ap}();return function(){return"Native"===e.$?_p(qf(hd(t))):no}()(r(ad(e))(t.initiatorAddress)(Cp)($(t.initiatorRole,Ff))(qf(t.tradeAmount))(qf(Jf(t.tradeAmount)))(qf(Wf(t.tradeAmount)))(qf(t.pokeReward))(Pp(t.autorecallInterval))(Pp(t.autoabortInterval))(Pp(t.autoreleaseInterval))(qf(ld(t.tradeAmount)))(xp(f(Bp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Up=function(e){return{$:"CreateMined",a:e}},Op={$:"CreateNeedsSig"},Mp=function(e){return{$:"CreateSigned",a:e}},Fp=r(function(e,t){var r=Cf(f(Dp,e,t)),n={onBroadcast:Ca,onMined:ba(L(Up,Ca)),onSign:ba(Mp)};return L(ba(Op),f(yf,n,r))}),Vp=function(e){return{$:"AllowanceFetched",a:e}},Kp=r(function(e,t){return{$:"ApproveMining",a:e,b:t}}),Hp={$:"ApproveNeedsSig"},jp=r(function(e,t){return{$:"ApproveSigned",a:e,b:t}}),qp=function(e){return{$:"Confirm",a:e}},Gp=function(e){return{$:"CreateMining",a:e}},zp={$:"NoOp"},Yp=function(e){return{appCmds:mr,chainCmd:lo,cmd:uo,model:e}},Wp=function(e){return il(Il(e))},Jp={$:"ShouldBeImpossible"},Qp=function(e){return _f(e)},Xp=r(function(e,t){f(Rl,e,t);return{mainParagraphs:F([F([Qp(e)])]),noticeType:Jp}}),Zp={$:"Error"},eg=r(function(e,t){f(Rl,e+" fetch error",t);return{mainParagraphs:F([F([Qp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Zp}}),tg=r(function(e,t){return{mainParagraphs:F([F([Qp('Error mining "'+e+'" transaction: '+t)])]),noticeType:Zp}}),rg={$:"Caution"},ng=r(function(e,t){return{mainParagraphs:F([F([Qp('Error signing "'+e+'" transaction: '+t)])]),noticeType:rg}}),ag=r(function(e,t){if("Just"===t.$){return e(t.a)}return Ca}),ig=r(function(e,t){return 1-e(1-t)}),og=function(e){return f(Jo,e,5)},ug=ig(og),sg={easing:ug,offset:12,speed:200},cg=function(e){return{$:"External",a:e}},fg=function(e){return{$:"Internal",a:e}},lg=function(e){return{$:"NotFound",a:e}},dg=function(e){for(;;){e=e.a}},hg=r(function(e,t){return vp(op(f(cp,e,t)))}),pg={$:"Http"},gg={$:"Https"},vg=Hr,yg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),mg=i(function(e,t,r,n,a){if(Dl(a)||f(vg,"@",a))return Ca;var i=f(tl,":",a);if(i.b){if(i.b.b)return Ca;var o=i.a,u=il(f(bo,o+1,a));if("Nothing"===u.$)return Ca;var s=u;return ba(p(yg,e,f(Eo,o,a),s,t,r,n))}return ba(p(yg,e,a,Ca,t,r,n))}),bg=a(function(e,t,r,n){if(Dl(n))return Ca;var a=f(tl,"/",n);if(a.b){var i=a.a;return h(mg,e,f(bo,i,n),t,r,f(Eo,i,n))}return h(mg,e,"/",t,r,n)}),Cg=n(function(e,t,r){if(Dl(r))return Ca;var n=f(tl,"?",r);if(n.b){var a=n.a;return d(bg,e,ba(f(bo,a+1,r)),t,f(Eo,a,r))}return d(bg,e,Ca,t,r)}),Sg=r(function(e,t){if(Dl(t))return Ca;var r=f(tl,"#",t);if(r.b){var n=r.a;return l(Cg,e,ba(f(bo,n+1,t)),f(Eo,n,t))}return l(Cg,e,Ca,t)}),Eg=function(e){return f(ko,"http://",e)?f(Sg,pg,f(bo,7,e)):f(ko,"https://",e)?f(Sg,gg,f(bo,8,e)):Ca},Tg=Jt,wg=zt(Yt),Ig=ca,Ag=r(function(e,t){return L(e,t)}),Bg=_r,kg=a(function(e,t,r,n){var a=_(r,n)>0?Ci:Ya,i=du(r-n),o=f(mi,1,Bg(i)/e|0),u=o,s=f(nu,function(e){return t(e/u)},f(Hi,0,o));return e<=0||$(r,n)?mr:f(nu,function(e){return f(a,r,e*i)},s)}),Ng=r(function(e,t){var n=r(function(t,r){return lp(f(nu,Ig(0),d(kg,e.speed,e.easing,t,r-e.offset)))});return f(up,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(fp,Ag,wg,Tg(t)))}),Rg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(bp,t.web3Context,a,n.address,ad(t.web3Context.factoryType),Vp);return d(ed,t,i,lo,mr)}return Yp(t);case"ChangeRole":var o=e.a,u=t.inputs;return Yp(U(t,{inputs:U(u,{userRole:o})}));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Yp(f(Zl,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Yp(f(Zl,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Yp(f(Zl,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Yp(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return Yp(f(Zl,U(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var g=e.a,u=t.inputs;return Yp(f(Zl,U(u,{autorecallInterval:g}),t));case"AutoabortIntervalChanged":var g=e.a,u=t.inputs;return Yp(f(Zl,U(u,{autoabortInterval:g}),t));case"AutoreleaseIntervalChanged":var g=e.a,u=t.inputs;return Yp(f(Zl,U(u,{autoreleaseInterval:g}),t));case"ShowCurrencyDropdown":var v=e.a,u=t.inputs;return Yp((v?Zl(U(u,{fiatType:""})):no)(U(t,{showFiatTypeDropdown:v})));case"CreateClicked":var n=e.a,y=f(Wl,t.web3Context.factoryType,t.inputs);if("Ok"===y.$){var m=y.a,b=f(Xf,n,m);return Yp(U(t,{depositAmount:ba(qf(hd(b))),txChainStatus:ba(qp(b))}))}var C=y.a;return d(ed,U(t,{errors:C}),f(mp,Fu(zp),function(){return f(Ng,U(sg,{offset:60}),"inputError")}()),lo,mr);case"AbortCreate":return Yp(U(t,{txChainStatus:Ca}));case"ConfirmCreate":var b=e.a,S=e.b,E=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return f(Fp,t.web3Context.factoryType,b);var r=e.a,n=function(){var e=Cf(l(fd,id(r),ad(t.web3Context.factoryType),S)),n={onBroadcast:Ca,onMined:Ca,onSign:ba(jp(b))};return f(yf,n,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Tu,i,S),Oa)?L(ba(Hp),n):f(Fp,t.web3Context.factoryType,b)}return L(ba(Hp),n)}(),T=E.a,w=E.b;return d(ed,U(t,{txChainStatus:T}),uo,w,mr);case"ApproveSigned":var b=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Yp(U(t,{txChainStatus:ba(f(Kp,b,A))}))}var B=I.a;return d(ed,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"appove",B))]));case"AllowanceFetched":var k=e.a;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ba(N)}),x=L(R.txChainStatus,R.depositAmount);if("Just"===x.a.$&&"ApproveMining"===x.a.a.$&&"Just"===x.b.$){var _=x.a.a,b=_.a,P=x.b.a;if($(f(Tu,N,P),Oa))return Yp(R);var D=f(Fp,R.web3Context.factoryType,b),T=D.a,w=D.b;return d(ed,U(R,{txChainStatus:T}),uo,w,mr)}return Yp(R)}var O=k.a;return d(ed,t,uo,lo,F([Tf(f(eg,"allowance",O))]));case"CreateSigned":var I=e.a;if("Ok"===I.$){var A=I.a;return Yp(U(t,{txChainStatus:ba(Gp(A))}))}var B=I.a;return d(ed,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(ed,t,uo,lo,F([Tf(f(tg,"create",B))]))}var M=e.a.a,V=f(ag,Wp,Ql(f(nh,t.web3Context.factoryType,M)));if("Just"===V.$){var K=V.a;return d(ed,t,uo,lo,F([po(bf(K))]))}return d(ed,t,uo,lo,F([Tf(f(Xp,"Error getting the ID of the created contract",M))]));case"Web3Connect":return d(ed,t,uo,lo,F([wf]));default:return Yp(t)}}),$g=function(e){return fh(F([L("to",f(Gf,oh,e.to)),L("from",f(Gf,oh,e.from)),L("gas",f(Gf,sh,e.gas)),L("gasPrice",f(Gf,uh,e.gasPrice)),L("value",f(Gf,uh,e.value)),L("data",f(Gf,Wd,e.data)),L("nonce",f(Gf,sh,e.nonce))]))},xg=function(e){return{$:"TxSentry",a:e}},_g=r(function(e,t){return Xd(F([L("ref",bh(e)),L("txParams",t)]))}),Lg=function(e){return{$:"Signing",a:e}},Pg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Lg(e)}}),Dg=mn,Ug=n(function(e,t,r){var n=e.a,a=$g(r),i=l(Nh,n.ref,f(Pg,r,t),n.txs);return L(xg(U(n,{ref:n.ref+1,txs:i})),f(Dg,n.tagger,n.outPort(f(_g,n.ref,a))))}),Og=Ug,Mg=r(function(e,t){if("None"===t.$)return L(e,uo);var r=t.a,n=t.b;return l(Og,e,r,n)}),Fg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Vg=r(function(e,t){if("None"===t.$)return fo;var r=t.a,n=t.b,a=l(Fg,f(Gf,Af(e),r.onSign),f(Gf,Af(e),r.onBroadcast),f(Gf,function(t){var r=t.a,n=t.b;return L(f(_a,r,e),f(Gf,function(t){return{confirmations:t.confirmations,toMsg:f(_a,t.toMsg,e)}},n))},r.onMined));return f(vf,a,n)}),Kg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Aa}e.a;return Ia}switch(e.a.$){case"Eth":e.a;return Aa;case"Kovan":e.a;return Ia;case"Rootstock":e.a;return Ra;case"RootstockTest":e.a;return $a;default:e.a;return Ba(100)}},Hg=r(function(e,t){return f(fu,Yl(e),Yl(t))}),jg=r(function(e,t){return $(t.state.phase,io)&&$(f(Hg,t.derived.phaseEndTime,e),Ka)}),qg=function(e){if(""===e)return Bi(Ca);var t=bl(e);if("Nothing"===t.$)return Ai("I can't interpret this number");var r=t.a;return Bi(ba(r))},Gg=function(e){if(""===e)return Bi(Ca);var t=dl(e);if("Nothing"===t.$)return Ai("I don't understand this number.");var r=t.a;return Bi(ba(r))},zg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),Yg=d(zg,Ca,Ca,Ca,Ca),Wg=i(function(e,t,r,n,a){if("Err"===t.$){var i=t.a;return Ai(i)}var o=t.a;if("Err"===r.$){var i=r.a;return Ai(i)}var u=r.a;if("Err"===n.$){var i=n.a;return Ai(i)}var s=n.a;if("Err"===a.$){var i=a.a;return Ai(i)}var c=a.a;return Bi(d(e,o,u,s,c))}),Jg=function(e){return h(Wg,a(function(t,r,n,a){return{dai:{max:r,min:t},fiat:f(Gf,function(e){return{max:a,min:n,type_:e}},Ul(e.fiatType)),paymentMethodTerms:e.paymentMethodTerms}}),f(zl,function(e){return U(Yg,{minDai:ba(e)})},qg(e.minDai)),f(zl,function(e){return U(Yg,{maxDai:ba(e)})},qg(e.maxDai)),f(zl,function(e){return U(Yg,{minFiat:ba(e)})},Gg(e.minFiat)),f(zl,function(e){return U(Yg,{maxFiat:ba(e)})},Gg(e.maxFiat)))},Qg=r(function(e,t){var r=function(t){return f(Td,function(e){return f(vg,ll(e),ll(t))},e)};return f(Ed,function(e){return r(e.info)},t)}),Xg=r(function(e,t){return U(t,{paymentMethod:e})}),Zg=r(function(e,t){return U(t,{paymentMethodTerms:e})}),ev=r(function(e,t){return f(Tu,qf(e),qf(t))}),tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Za,e.inputs.paymentMethodTerms,F([t]));return rv(U(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))}))},rv=function(e){var t=tv(e),n=Jg(t.inputs);if("Err"===n.$){return U(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Qg,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiat;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.fiatType,r.type_)&&function(){var t=r.min;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Tu,e.terms.price.amount,n),Oa)}()&&function(){var t=r.max;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Tu,e.terms.price.amount,n),Ka)}()},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(ev,e.parameters.tradeAmount,r),Oa)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(ev,e.parameters.tradeAmount,r),Ka)}()},s=r(function(e,r){return f(jg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},nv={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},av=r(function(e,t){return f(fu,e.creationInfo.blocknum,t.creationInfo.blocknum)}),iv=n(function(e,t,r){return L(rv({browsingRole:t,errors:Yg,filterFunc:jg,inputs:nv,showCurrencyDropdown:!1,sortFunc:av,userInfo:r,web3Context:e}),uo)}),ov=r(function(e,t){return f(Tu,e.amount,t.amount)}),uv=r(function(e,t){var r=f(th,Gs(e),t.inputs.paymentMethodTerms);return rv(U(t,{inputs:f(Zg,r,t.inputs)}))}),sv=function(e){return U(e,{filterFunc:jg,inputs:nv,sortFunc:av})},cv={$:"Ascending"},fv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),lv=function(e){return l(fv,e,uo,mr)},dv=r(function(e,t){return U(t,{fiatType:e})}),hv=r(function(e,t){return U(t,{maxDai:e})}),pv=r(function(e,t){return U(t,{maxFiat:e})}),gv=r(function(e,t){return U(t,{minDai:e})}),vv=r(function(e,t){return U(t,{minFiat:e})}),yv=n(function(e,t,r){return f(e,r,t)}),mv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(fv,U(t,{inputs:f(gv,n,t.inputs)}),uo,mr);case"MaxDaiChanged":var n=e.a;return l(fv,U(t,{inputs:f(hv,n,t.inputs)}),uo,mr);case"MinFiatChanged":var n=e.a;return l(fv,U(t,{inputs:f(vv,n,t.inputs)}),uo,mr);case"MaxFiatChanged":var n=e.a;return l(fv,U(t,{inputs:f(pv,n,t.inputs)}),uo,mr);case"FiatTypeInputChanged":var n=e.a;return l(fv,U(t,{inputs:f(dv,n,t.inputs)}),uo,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(fv,U(t,{inputs:(a?dv(""):no)(t.inputs),showCurrencyDropdown:a}),uo,mr);case"FiatTypeLostFocus":return l(fv,U(t,{showCurrencyDropdown:!1}),uo,mr);case"PaymentMethodInputChanged":var n=e.a;return l(fv,U(t,{inputs:f(Xg,n,t.inputs)}),uo,mr);case"AddSearchTerm":return l(fv,tv(t),uo,mr);case"RemoveTerm":var i=e.a;return l(fv,f(uv,i,t),uo,mr);case"ApplyInputs":return l(fv,rv(t),uo,mr);case"ResetSearch":return l(fv,sv(t),uo,mr);case"TradeClicked":var o=e.a;return l(fv,t,uo,F([po(bf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,cv)?yv:no)(r(function(e,t){switch(u.$){case"Expiring":return f(Hg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(ev,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(ov,e.terms.price,t.terms.price);case"Margin":return f(rc,Ua,l(Jl,r(function(e,t){return f(fu,e,t)}),e.derived.margin,t.derived.margin));case"PaymentMethods":return f(av,e,t);case"AutoabortWindow":return f(Hg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(Hg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(fv,U(t,{sortFunc:c}),uo,mr);default:return lv(t)}}),bv=n(function(e,t,r){var n=e.factoryType;if("Token"===n.$){var a=n.a;return h(bp,e,a,t.address,ad(e.factoryType),r)}return uo}),Cv=function(e){return{$:"AllowanceFetched",a:e}},Sv=function(e){return{$:"Menu",a:e}},Ev={$:"NoneStarted"},Tv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),wv=r(function(e,t){var r={state:Sv(Ev),textInput:"",tokenAllowance:Ca,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(bv,r.web3Context,e,Cv)}return uo}();return d(Tv,r,n,lo,mr)}),Iv=function(e){return{$:"ApproveSigned",a:e}},Av=r(function(e,t){var r=Cf(l(fd,id(e),ad(ya(e)),qf(t))),n={onBroadcast:Ca,onMined:Ca,onSign:ba(Iv)};return f(yf,n,r)}),Bv=function(e){return{$:"OpenMined",a:e}},kv=function(e){return{$:"OpenSigned",a:e}},Nv=r(function(e,t){var r=Cf(f(Dp,e,t)),n={onBroadcast:Ca,onMined:ba(L(Bv,Ca)),onSign:ba(kv)};return f(yf,n,r)}),Rv=function(e){return{$:"ApproveMining",a:e}},$v=function(e){return{$:"ApproveNeedsSig",a:e}},xv={$:"OpenMining"},_v={$:"OpenNeedsSig"},Lv={$:"ReadyToOpen"},Pv=r(function(e,t){return{$:"Spec",a:e,b:t}}),Dv=function(e){return{$:"StartPrompt",a:e}},Uv=r(function(e,t){return jf(f(xu,qf(e),hu(t)))}),Ov=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Yf,f(Uv,e.daiAmountIn,100*t),100+t)},Mv=n(function(e,t,r){var n=t.intervals,a=n.a,i=n.b,o=n.c;return f(Xf,e,{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,initiatorRole:t.initiatorRole,paymentMethods:F([f(ql,jl,r)]),price:t.fiatValue,tradeAmount:Ov(t)})}),Fv=function(e){return{appCmds:mr,chainCmd:lo,cmd:uo,model:e}},Vv=function(e){return jf(e)},Kv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(bp,t.web3Context,a,n.address,ad(t.web3Context.factoryType),Cv);return d(Tv,t,i,lo,mr)}return Fv(t);case"StartClicked":var o=e.a;if("Token"===t.web3Context.factoryType.$){var u=function(){var e=t.tokenAllowance;if("Just"===e.$){var r=e.a;return $(f(ev,r,o.daiAmountIn),Oa)?Sv(Dv(o)):f(Pv,o,Lv)}return Sv(Dv(o))}();return Fv(U(t,{state:u}))}return Fv(U(t,{state:f(Pv,o,Lv)}));case"ApproveClicked":var o=e.a,s=t.web3Context.factoryType;if("Token"===s.$){var a=s.a,c=f(Av,a,o.daiAmountIn);return d(Tv,U(t,{state:Sv($v(o))}),uo,c,mr)}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Approve Clicked msg received, but factoryType is not a token factory!",o))]));case"ApproveSigned":var p=e.a,g=L(p,t.state);if("Ok"===g.a.$){if("Menu"===g.b.$&&"ApproveNeedsSig"===g.b.a.$){var v=g.a.a,o=g.b.a.a;return Fv(U(t,{state:f(Pv,o,Rv(v))}))}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(Tv,t,uo,lo,F([Tf(f(ng,"ERC20 approve",y))]));case"AllowanceFetched":var m=e.a,b=L(m,t.state);if("Ok"===b.a.$){if("Spec"===b.b.$&&"ApproveMining"===b.b.b.$){var C=b.a.a,S=b.b,o=S.a;return Fv($(f(Tu,C,qf(o.daiAmountIn)),Oa)?U(t,{tokenAllowance:ba(Vv(C))}):U(t,{state:f(Pv,o,Lv),tokenAllowance:ba(Vv(C))}))}return Fv(t)}var E=b.a.a;return d(Tv,t,uo,lo,F([Tf(f(eg,"token allowance",E))]));case"OpenClicked":var n=e.a,T=e.b,w=l(Mv,n,T,t.textInput),c=f(Nv,t.web3Context.factoryType,w);return d(Tv,U(t,{state:f(Pv,T,_v)}),uo,c,mr);case"OpenSigned":var p=e.a,I=L(p,t.state);if("Ok"===I.a.$){if("Spec"===I.b.$){var v=I.a.a,A=I.b,w=A.a;return Fv(U(t,{state:f(Pv,w,xv)}))}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(Tv,t,uo,lo,F([Tf(f(ng,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ag,Wp,Ql(f(nh,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(Tv,t,uo,lo,F([po(bf(R))]))}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Error getting the ID of the created contract",k))]))}var y=B.a;return d(Tv,t,uo,lo,F([Tf(f(tg,"Open trade",y))]));case"TextInputChanged":var x=e.a;return Fv(U(t,{textInput:x}));case"ChangeState":var u=e.a;return Fv(U(t,{state:u}));case"AbortCreate":return Fv(U(t,{state:Sv(Ev)}));case"NoOp":return Fv(t);default:return d(Tv,t,uo,lo,F([wf]))}}),Hv=function(e){return"Buyer"===e.$?"buyer":"seller"},jv=function(e){return e.a+"="+e.b},qv=function(e){return e.b?"?"+f(zi,"&",f(nu,jv,e)):""},Gv=r(function(e,t){return"/"+(f(zi,"/",e)+qv(t))}),zv=function(e){switch(e.$){case"Home":return f(Gv,F(["DAIHard"]),mr);case"QuickCreate":return f(Gv,F(["DAIHard","quickcreate"]),mr);case"Create":return f(Gv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a;return f(Gv,F(["DAIHard","trade",Gi(t)]),mr);case"Marketplace":var r=e.a;return f(Gv,F(["DAIHard","marketplace",Hv(r)]),mr);case"AgentHistory":var n=e.a,r=e.b;return f(Gv,F(["DAIHard","history",eh(n),function(){return"Buyer"===r.$?"buyer":"seller"}()]),mr);default:return f(Gv,mr,mr)}},Yv={$:"NotFound"},Wv={$:"Create"},Jv={$:"Home"},Qv=function(e){return{$:"Marketplace",a:e}},Xv={$:"QuickCreate"},Zv=function(e){return{$:"Parser",a:e}},ey=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),ty=r(function(e,t){return Zv(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 F([h(ey,f(za,u,r),s,a,i,o(l))])}return mr}return mr})}),ry=f(ty,"ADDRESS",f(_a,Ud,Ql)),ny={$:"Buyer"},ay=f(ty,"BUYERORSELLER",function(e){switch(e){case"buyer":return ba(ny);case"seller":return ba(Ff);default:return Ca}}),iy=f(ty,"NUMBER",il),oy=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(ey,r,n,a,i,e(o))}),uy=r(function(e,t){var r=t.a;return Zv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(nu,oy(u),r(h(ey,n,a,i,o,e)))})}),sy=function(e){return l(Xa,Za,mr,e)},cy=r(function(e,t){return sy(f(nu,e,t))}),fy=function(e){return Zv(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)?F([h(ey,f(za,u,r),s,a,i,o)]):mr}return mr})},ly=r(function(e,t){var r=e.a,n=t.a;return Zv(function(e){return f(cy,n,r(e))})}),dy=Zv(function(e){return F([e])}),hy=f(ly,fy("DAIHard"),function(e){return Zv(function(t){return f(cy,function(e){return(0,e.a)(t)},e)})}(F([f(uy,Jv,dy),f(uy,Xv,fy("quickcreate")),f(uy,Wv,fy("create")),f(uy,bf,f(ly,fy("trade"),iy)),f(uy,Qv,f(ly,fy("marketplace"),ay)),f(uy,mf,f(ly,fy("history"),f(ly,ry,ay))),f(uy,function(e){return f(mf,e,Ff)},f(ly,fy("history"),ry))]))),py=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 ba(t.value)}return ba(t.value)}return Ca}},gy=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(za,t,gy(r))}return mr}return mr},vy=function(e){var t=f(Wi,"/",e);if(t.b&&""===t.a){var r=t.b;return gy(r)}var r=t;return gy(r)},yy=Xt,my=r(function(e,t){if("Nothing"===t.$)return ba(F([e]));var r=t.a;return ba(f(za,e,r))}),by=r(function(e,t){var r=f(Wi,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=yy(n);if("Nothing"===o.$)return t;var u=o.a,s=yy(i);if("Nothing"===s.$)return t;var c=s.a;return l(Oh,u,my(c),t)}return t}),Cy=function(e){if("Nothing"===e.$)return Eh;var t=e.a;return l(Xa,by,Eh,f(Wi,"&",t))},Sy=r(function(e,t){var r=e.a;return py(r(h(ey,mr,vy(t.path),Cy(t.query),t.fragment,no)))}),Ey=function(e){return f(rc,Yv,f(Sy,hy,e))},Ty=ia,wy=r(function(e,t){return f(Ty,e,zv(t))}),Iy=qe("connectToWeb3",function(e){return ch}),Ay=function(e){return Xd(F([L("event",Yd(e.event)),L("category",Yd(e.category)),L("label",Yd(e.label)),L("value",bh(e.value))]))},By=r(function(e,t){return Xd(F([L("address",Yd(eh(e))),L("signSeedMsg",Yd(t))]))}),ky=qe("gTagOut",no),Ny=qe("genPrivkey",no),Ry=r(function(e,t){return U(t,{userInfo:e})}),$y=r(function(e,t){return L(f(Zl,t.inputs,U(t,{userInfo:e})),function(){var r=L(e,t.web3Context.factoryType);if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a;return h(bp,t.web3Context,a,n.address,ad(t.web3Context.factoryType),Vp)}return uo}())}),xy=r(function(e,t){return U(t,{userInfo:e})}),_y=r(function(e,t){return L(U(t,{userInfo:e}),function(){if("Just"===e.$){var r=e.a;return l(bv,t.web3Context,r,Cv)}return uo}())}),Ly=function(e){return{$:"AllowanceFetched",a:e}},Py=r(function(e,t){return L(U(t,{userInfo:e}),function(){var r=P(e,t.trade,t.web3Context.factoryType);if("Just"===r.a.$&&"LoadedTrade"===r.b.$&&"Token"===r.c.$){var n=r.a.a,a=r.b.a,i=r.c.a;return h(bp,t.web3Context,i,n.address,a.creationInfo.address,Ly)}return uo}())}),Dy=function(e){return{$:"AgentHistoryModel",a:e}},Uy=function(e){return{$:"CreateModel",a:e}},Oy=function(e){return{$:"CreateMsg",a:e}},My=function(e){return{$:"MarketplaceModel",a:e}},Fy=function(e){return{$:"QuickCreateModel",a:e}},Vy=function(e){return{$:"QuickCreateMsg",a:e}},Ky=function(e){return{$:"TradeModel",a:e}},Hy=function(e){return{$:"TradeMsg",a:e}},jy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,uo);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Uy(a),f(Dg,Oy,i));case"QuickCreateModel":var o=t.a,u=f(_y,e,o),s=u.a,c=u.b;return L(Fy(s),f(Dg,Vy,c));case"TradeModel":var l=t.a,d=f(Py,e,l),h=d.a,p=d.b;return L(Ky(h),f(Dg,Hy,p));case"MarketplaceModel":var g=t.a;return L(My(f(xy,e,g)),uo);default:var v=t.a;return L(Dy(f(Ry,e,v)),uo)}}),qy=r(function(e,t){return U(t,{web3Context:e})}),Gy=r(function(e,t){return U(t,{web3Context:e})}),zy=r(function(e,t){return U(t,{web3Context:e})}),Yy=r(function(e,t){return U(t,{web3Context:e})}),Wy=r(function(e,t){switch(t.$){case"BetaLandingPage":return P(t,uo,Ca);case"CreateModel":var r=t.a;return P(Uy(f(Gy,e,r)),uo,Ca);case"QuickCreateModel":var n=t.a;return P(Fy(f(Yy,e,n)),uo,Ca);case"TradeModel":t.a;return P(t,uo,ba(Qv(ny)));case"MarketplaceModel":var a=t.a;return P(My(f(zy,e,a)),uo,Ca);default:var i=t.a;return P(Dy(f(qy,e,i)),uo,Ca)}}),Jy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Qy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Xy=function(e){return Qy(p(Jy,e,Ca,Ca,Ca,Ca,Ca))},Zy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),em=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},tm=em(f(Zy,Ca,Ca)),rm=r(function(e,t){return{address_:e,blocknum:t}}),nm=function(e){return go(function(t){return Bi(L(t,e))})},am=r(function(e,t){return L(t.a,e(t.b))}),im=n(function(e,t,r){var n=t.a,a=r.a;return go(function(t){return f(rh,function(t){var r=t.a,n=t.b;return f(wo,am(e(n)),a(r))},n(t))})}),om=r(function(e,t){return l(im,r(function(e,t){return e(t)}),t,e)}),um=Uo(f(om,Gd,f(om,Od,nm(rm)))),sm=r(function(e,t){return{data:ba(f(pf,"createdTrades(uint256)",F([cd(t)]))),decoder:um,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),cm=n(function(e,t,r){return f(mp,r,f(ip,e.httpProvider,f(sm,ad(e.factoryType),t)))}),fm=function(e){return{$:"CreationInfoFetched",a:e}},lm=r(function(e,t){return l(cm,e,hu(t),fm)}),dm=function(e){return{$:"EventSentryMsg",a:e}},hm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),pm=Do(f(_a,No,$d)),gm=function(e){return rp({decoder:pm,method:"eth_blockNumber",params:mr,url:e})},vm=function(e){return{$:"BlockNumber",a:e}},ym=function(e){return{$:"EventSentry",a:e}},mm=function(e){return{$:"Set_elm_builtin",a:e}},bm=mm(Eh),Cm=r(function(e,t){return L(ym({blockNumber:Ca,errors:mr,nodePath:t,pending:bm,ref:1,requests:Eh,tagger:e,watching:bm}),f(mp,f(_a,vm,e),gm(t)))}),Sm=n(function(e,t,r){var n=f(lm,e,r),a=f(Cm,dm,e.httpProvider),i=a.a,o=a.b;return d(hm,{allowance:Ca,chatHistoryModel:Ca,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:io,secureCommInfo:tm,showChatHistory:!1,showStatsModal:!1,trade:Xy(r),txChainStatus:Ca,userInfo:t,web3Context:e},oo(F([n,o])),lo,mr)}),Em=function(e){return{data:ba(f(pf,"abort()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Tm=function(e){return{data:ba(f(pf,"burn()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},wm=function(e){return{data:ba(f(pf,"claim()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Im=r(function(e,t){return{data:ba(f(pf,"initiatorStatement(string)",F([wp(t)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),Am=function(e){return{data:ba(f(pf,"recall()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Bm=function(e){return{data:ba(f(pf,"release()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},km=r(function(e,t){return{data:ba(f(pf,"responderStatement(string)",F([wp(t)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),Nm=r(function(e,t){return{amount:t,fiatType:e}}),Rm=f(xo,function(e){var t=dl(e);if("Just"===t.$){var r=t.a;return Po(r)}return _o("Can't convert that to a BigInt")},Lo),$m=l(kf,Nm,f(Kd,0,Lo),f(Kd,1,Rm)),xm={$:"Bank"},_m={$:"Cash"},Lm=function(e){switch(e){case"cash":return ba(_m);case"bank":return ba(xm);case"custom":return ba(jl);default:return Ca}},Pm=f(xo,function(e){var t=Lm(e);if("Just"===t.$){var r=t.a;return Po(r)}return _o("")},Lo),Dm=l(kf,ql,f(Fd,"type",Pm),f(Fd,"info",Lo)),Um=ue,Om=function(e){var t=l(kf,Bp,f(Fd,"price",$m),f(Fd,"paymentmethods",Um(Dm)));return f(yh,t,e)},Mm=r(function(e,t){return{commPubkey:t,responder:e}}),Fm=r(function(e,t){var n=r(function(t,r){return l(mo,t,t+2*r,e)}),a=f(_a,$d,wo(bi(2)));return f(rh,function(t){return f(wo,function(e){return f(n,t+64,e)},$d(l(mo,t,t+64,e)))},a(t))}),Vm=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?P(0,0,f(e,o(t),i)):P(o(t),a-1,i):128&t?192==(224&t)?P(31&t,1,i):224==(240&t)?P(15&t,2,i):P(7&t,3,i):P(0,0,f(e,t,i))}),Km=n(function(e,t,r){var n=l(Wa,Vm(e),P(0,0,t),r);if(n.b)return Ai("invalid UTF-8 sequence");var a=n.c;return Bi(a)}),Hm=q,jm=function(e){return Yu(Hm(e))},qm=function(e){return l(Km,r(function(e,t){return O(t,jm(e))}),"",e)},Gm=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),f(rh,qm,f(rh,f(_a,nu($d),kd),f(wo,th(f(_a,Dl,Iu)),f(wo,Ts(2),f(Fm,t,To(r)))))))}),zm=f(pd,f(Vd,1,Gm),f(pd,f(Vd,0,Od),Po(Mm))),Ym=r(function(e,t){return{commPubkey:t,terms:e}}),Wm=f(pd,f(Vd,1,Gm),f(pd,f(Vd,0,Gm),Po(Ym))),Jm=function(e){return{statement:e}},Qm=f(pd,f(Vd,0,Gm),Po(Jm)),Xm=function(e){return{statement:e}},Zm=f(pd,f(Vd,0,Gm),Po(Xm)),eb={$:"AbortedEvent"},tb={$:"BurnedEvent"},rb={$:"ClaimedEvent"},nb=function(e){return{$:"CommittedEvent",a:e}},ab=function(e){return{$:"InitiatedEvent",a:e}},ib=function(e){return{$:"InitiatorStatementLogEvent",a:e}},ob={$:"PokeEvent"},ub={$:"RecalledEvent"},sb={$:"ReleasedEvent"},cb=function(e){return{$:"ResponderStatementLogEvent",a:e}},fb=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),lb=function(e){return fb(e)?Bi(Is(No(e))):Ai("Something in here is not very hexy: "+Dd(e))},db=Do(lb),hb=f(Fd,"topics",f(Kd,0,db)),pb=function(e){return Is(f(zi,"",f(nu,f(_a,ns,Ns),ff(f(nu,Li,Ss(e))))))},gb=f(xo,function(e){return $(e,pb("Initiated(string,string)"))?f(Bf,ab,Wm):$(e,pb("Committed(address,string)"))?f(Bf,nb,zm):$(e,pb("Recalled()"))?Po(ub):$(e,pb("Claimed()"))?Po(rb):$(e,pb("Aborted()"))?Po(eb):$(e,pb("Released()"))?Po(sb):$(e,pb("Burned()"))?Po(tb):$(e,pb("InitiatorStatementLog(string)"))?f(Bf,ib,Qm):$(e,pb("ResponderStatementLog(string)"))?f(Bf,cb,Zm):$(e,pb("Poke()"))?Po(ob):_o("Unrecognized topic hash")},hb),vb={$:"Initiator"},yb={$:"Responder"},mb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ba(vb):f(ag,function(e){return $(t,e)?ba(yb):Ca},e.state.responder)}),bb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Cb=function(e){return $(e.buyerDeposit,Jf(e.tradeAmount))&&$(e.abortPunishment,Wf(e.tradeAmount))},Sb={$:"Invalid"},Eb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Tb=function(e){return{$:"LoadedTrade",a:e}},wb=r(function(e,t){return Kf(Yl(t)+Yl(e))}),Ib=function(e){var t=$l(Il(e.amount));if("Just"===t.$){return t.a}f(Rl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Ab=r(function(e,t){return(t-e)/e}),Bb=r(function(e,t){var r=Ib(t),n=xl(e);return"USD"===t.fiatType?ba(f(Ab,n,r)):Ca}),kb=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 Kf(0)}}();return{margin:f(Bb,e.tradeAmount,r.price),phaseEndTime:f(wb,t.phaseStartTime,n)}}),Nb=function(e){var t=P(L(e.creationInfo,e.parameters),L(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 Tb(g(Eb,e.id,n,a,o,u,s,l(kb,a,o,u)))}return Qy(e)},Rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{creationInfo:ba(e)}));case"LoadedTrade":f(Rl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Sb}}),$b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{parameters:ba(e)}));case"LoadedTrade":t.a,f(Rl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Sb}}),xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{phaseStartInfo:ba(e)}));case"LoadedTrade":t.a,f(Rl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Sb}}),_b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{state:ba(e)}));case"LoadedTrade":var n=t.a;return Tb(U(n,{state:e}));default:return Sb}}),Lb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{terms:ba(e)}));case"LoadedTrade":t.a,f(Rl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Sb}}),Pb=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiator:e,initiatorIsCustodian:t,pokeReward:s,tradeAmount:r}}),Db=Uo(f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Bo,f(om,Od,nm(Pb))))))))))),Ub=function(e){return{data:ba(f(pf,"getParameters()",mr)),decoder:Db,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Ob=function(e){return f(Gf,function(e){return Kf(1e3*e)},il(Il(e)))},Mb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return Ai(a)}var i=t.a;if("Err"===r.$){var a=r.a;return Ai(a)}var o=r.a;if("Err"===n.$){var a=n.a;return Ai(a)}var u=n.a;return Bi(l(e,i,o,u))}),Fb=function(e){var t=f(Pl,"error converting BigInt to Time.Posix",Ob(e.autoabortInterval)),r=f(Pl,"error converting BigInt to Time.Posix",Ob(e.autoreleaseInterval)),a=f(Pl,"error converting BigInt to Time.Posix",Ob(e.autorecallInterval));return d(Mb,n(function(t,r,n){return{abortPunishment:Vv(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Vv(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatorIsCustodian?Ff:ny,pokeReward:Vv(e.pokeReward),tradeAmount:Vv(e.tradeAmount)}}),a,t,r)},Vb=n(function(e,t,r){return f(mp,r,f(cp,Fb,f(ip,e.httpProvider,Ub(t))))}),Kb=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}}}}}}}}}}},Hb=Uo(f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,nm(Kb)))))))))))),jb=function(e){return{data:ba(f(pf,"getPhaseStartInfo()",mr)),decoder:Hb,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},qb=i(function(e,t,r,n,a){if("Nothing"===t.$)return Ca;var i=t.a;if("Nothing"===r.$)return Ca;var o=r.a;if("Nothing"===n.$)return Ca;var u=n.a;if("Nothing"===a.$)return Ca;var s=a.a;return ba(d(e,i,o,u,s))}),Gb=function(e){return h(qb,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}}),Ob(e.v6),Ob(e.v7),Ob(e.v8),Ob(e.v9))},zb=n(function(e,t,r){return f(mp,r,f(cp,Gb,f(ip,e.httpProvider,jb(t))))}),Yb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Wb=Uo(f(om,Gd,f(om,Od,f(om,Gd,f(om,Gd,f(om,Gd,nm(Yb))))))),Jb=function(e){return{data:ba(f(pf,"getState()",mr)),decoder:Wb,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Qb={$:"Aborted"},Xb={$:"Burned"},Zb={$:"NotClosed"},eC={$:"Recalled"},tC={$:"Released"},rC=function(e){switch(f(rc,99,il(Il(e)))){case 0:return ba(Zb);case 1:return ba(eC);case 2:return ba(Qb);case 3:return ba(tC);case 4:return ba(Xb);default:return Ca}},nC={$:"Closed"},aC={$:"Committed"},iC={$:"Judgment"},oC=function(e){switch(f(rc,99,il(Il(e)))){case 1:return ba(io);case 2:return ba(aC);case 3:return ba(iC);case 4:return ba(nC);default:return Ca}},uC=function(e){return $(e,nd("0x0000000000000000000000000000000000000000"))?Ca:ba(e)},sC=a(function(e,t,r,n){if("Nothing"===t.$)return Ca;var a=t.a;if("Nothing"===r.$)return Ca;var i=r.a;if("Nothing"===n.$)return Ca;var o=n.a;return ba(l(e,a,i,o))}),cC=function(e){var t=Ob(e.phaseStartTimestamp),r=oC(e.phase),a=rC(e.closedReason);return d(sC,n(function(t,r,n){return{balance:Vv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:uC(e.responder)}}),r,t,a)},fC=n(function(e,t,r){return f(mp,r,f(cp,cC,f(ip,e.httpProvider,Jb(t))))}),lC=i(function(e,t,r,n,a){return oo(F([l(Vb,e,t,r),l(fC,e,t,n),l(zb,e,t,a)]))}),dC=function(e){var t=Wp(e);if("Just"===t.$){return t.a}f(Rl,"Warning! BigInt to Int conversion failed!",Il(e));return 0},hC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),pC=n(function(e,t,r){for(;;){var n=f(li,32,e),a=n.a,i=n.b;if(_(Si(a),32)<0)return f(Ei,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(za,ci(a),t),s=r+1;e=o,t=u,r=s}}),gC=function(e){return e.b?l(pC,e,mr,0):si},vC=rn,yC=function(e){var t=h(vC,hC,f(Fd,"encapsulation",Lo),f(Fd,"iv",Lo),f(Fd,"tag",Lo),f(Fd,"encrypted",Lo)),r=Um(t),n=f(Jd,r,e);if("Err"===n.$){var a=n.a;return Ai(Zi(a))}var i=n.a;return function(e){var t=L(f(Sc,0,e),f(Sc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Bi(L(r,n))}return Ai("Decoded list has less than 2 items.")}(gC(i))},mC=function(e){var t=function(e){var t=yo(e);return t>1114111?Ai("string is too long"):Bi(f(zu,Hm(t),e))};return f(wo,zi(""),kd(f(nu,t,e)))},bC=function(e){var t=e.a,r=e.b;return mC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},CC=r(function(e,t){return Xd(F([L("message",Yd(e)),L("pubkeyHexStrings",f(Qd,Yd,F([t.initiatorPubkey,t.responderPubkey])))]))}),SC=function(e){return{$:"LoadedCommInfo",a:e}},EC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),TC=function(e){var t=L(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return SC(f(EC,r,n))}return em(e)},wC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return TC(U(r,{initiatorPubkey:ba(e)}))}var n=t.a;return SC(U(n,{initiatorPubkey:e}))}),IC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return TC(U(r,{responderPubkey:ba(e)}))}var n=t.a;return SC(U(n,{responderPubkey:e}))}),AC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return ny}r.a,r.b;return Ff}if("Buyer"===r.b.$){r.a,r.b;return Ff}r.a,r.b;return ny}),BC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=Li(r),i=f(ol,a,n),o=Zu(f(_s,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),kC=function(e){var t=gC(f(BC,Ss(e),mr));return l(Jl,Ag,h(qb,hC,f(Sc,0,t),f(Sc,1,t),f(Sc,2,t),f(Sc,3,t)),h(qb,hC,f(Sc,4,t),f(Sc,5,t),f(Sc,6,t),f(Sc,7,t)))},NC={$:"Aborted"},RC={$:"Burned"},$C={$:"Claimed"},xC=function(e){return{$:"Committed",a:e}},_C=function(e){return{$:"Encrypted",a:e}},LC={$:"FailedDecode"},PC={$:"Initiated"},DC={$:"Recalled"},UC={$:"Released"},OC=function(e){return{$:"StateChange",a:e}},MC=function(e){return{$:"Statement",a:e}},FC=lr,VC=fr,KC=r(function(e,t){var r=Si(e),n=32-Si(t.tail)-r,a=l(FC,32,t.tail,e);return n<0?{nodeList:f(za,ci(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(VC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(za,ci(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ui}}),HC=ur,jC=y,qC=a(function(e,t,r,n){var a=yc&t>>>e;if(_(a,Si(n))>-1){if(5===e)return f(HC,ci(r),n);var i=fi(d(qC,e-oi,t,r,ui));return f(HC,i,n)}var o=f(mc,a,n);if("SubTree"===o.$){var u=o.a,i=fi(d(qC,e-oi,t,r,u));return l(wc,a,i,n)}var i=fi(d(qC,e-oi,t,r,jC(o)));return l(wc,a,i,n)}),GC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=Si(i),u=Si(e),s=r+(u-o);if($(u,32)){if(_(s>>>oi,1<0){var c=n+oi,f=d(qC,c,r,e,jC(fi(a)));return d(ri,s,c,f,ui)}return d(ri,s,n,d(qC,n,r,e,a),ui)}return d(ri,s,n,a,e)}),zC=r(function(e,t){var r=(t.a,t.c,t.d),n=Si(e),a=32-Si(r)-n,i=l(FC,32,r,e),o=f(GC,i,t);if(a<0){var u=l(VC,a,n,e);return f(GC,u,o)}return o}),YC=sr,WC=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(YC,i,t,r)}return f(za,e,t)});return{nodeList:l(YC,i,mr,n),nodeListSize:t/32|0,tail:a}},JC=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(_(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(YC,o,t,r)}var n=e.a;return f(zC,n,t)});return f(zC,i,l(YC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(YC,o,t,r)}var n=e.a;return f(KC,n,t)});return f(Ei,!0,f(KC,i,l(YC,o,WC(e),a)))}),QC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(za,r,t)}),XC=f(Xa,QC,mr),ZC=n(function(e,t,r){var n=AC(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ba(OC(PC));case"CommittedEvent":var r=t.a;return ba(OC(xC(r.responder)));case"RecalledEvent":return ba(OC(DC));case"ClaimedEvent":return ba(OC($C));case"AbortedEvent":return ba(OC(NC));case"ReleasedEvent":return ba(OC(UC));case"BurnedEvent":return ba(OC(RC));case"InitiatorStatementLogEvent":var r=t.a;return ba(MC({blocknum:e,message:function(){var e=kC(r.statement);if("Just"===e.$){var t=e.a;return _C(t)}return LC}(),who:n(vb)}));case"ResponderStatementLogEvent":var r=t.a;return ba(MC({blocknum:e,message:function(){var e=kC(r.statement);if("Just"===e.$){var t=e.a;return _C(t)}return LC}(),who:n(yb)}));default:return Ca}}(),i=f(Gf,function(t){return{blocknum:e,eventInfo:t,time:Ca}},a);return L(U(r,{history:f(JC,r.history,gC(XC(F([i]))))}),function(){return"Just"===a.$&&"Statement"===a.a.$}())}),eS=zr,tS=function(e){var t=l(kf,Ag,f(Fd,"id",eS),f(Fd,"message",Lo));return f(zl,Zi,f(Jd,t,e))},rS=function(e){return{$:"Decrypted",a:e}},nS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),aS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(ZC,n,a,t),o=i.a,u=i.b;return d(nS,o,u,Ca,mr);case"MessageInputChanged":var s=e.a;return d(nS,U(t,{messageInput:s}),!1,Ca,mr);case"MessageSubmit":return d(nS,U(t,{messageInput:""}),!1,ba(t.messageInput),mr);default:var c=e.a,h=tS(c);if("Ok"===h.$){var p=h.a,g=p.a,v=p.b,y=f(Sc,g,t.history);if("Just"===y.$){var m=y.a,b=m.eventInfo;if("Statement"===b.$){var C=b.a,S=U(C,{message:rS(v)}),E=U(m,{eventInfo:MC(S)}),T=l(Ac,g,E,t.history);return d(nS,U(t,{history:T}),!1,Ca,mr)}return d(nS,t,!1,Ca,F([Tf(f(Xp,"got a decryption result, but for an event that is not a message!",m))]))}return d(nS,t,!1,Ca,F([Tf(f(Xp,"got a decryption result, but for an id out of bounds!",L(g,t.history)))]))}var w=h.a;return d(nS,t,!1,Ca,F([Tf(f(Xp,"Error decoding decryption result",w))]))}}),iS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),oS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),uS=function(e){return{onBroadcast:Ca,onMined:ba(L(iS(e),Ca)),onSign:ba(oS(e))}},sS=qe("encryptToPubkeys",no),cS=n(function(e,t,r){return{data:ba(f(pf,"commit(address,string)",F([ud(t),wp(r)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),fS=n(function(e,t,r){return{data:ba(f(pf,"commit(address,string)",F([ud(t),wp(r)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),lS=function(e){return{$:"CommitMined",a:e}},dS={$:"CommitNeedsSig"},hS=function(e){return{$:"CommitSigned",a:e}},pS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?fS:cS}(),i=Cf(function(){return"Token"===e.factoryType.$?no:_p(qf(bb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ba(dS),f(yf,{onBroadcast:Ca,onMined:ba(L(lS,Ca)),onSign:ba(hS)},i))}),gS=r(function(e,t){return Xd(F([L("id",bh(e)),L("encapsulation",Yd(t.encapsulatedKey)),L("iv",Yd(t.iv)),L("tag",Yd(t.tag)),L("encrypted",Yd(t.message))]))}),vS=qe("decryptMessage",no),yS=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(za,L(r,e),n))});return l(Fa,n,L(t-1,mr),e).b},mS=r(function(e,t){return oo(f(nu,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 vS(f(gS,r,s))}return uo}return uo},yS(e.history)))}),bS=function(e){if("Just"===e.$){return e.a}return Ca},CS=function(e){var t=bS(l(Jl,mb,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ba(r)}return Ca}(),f(Gf,function(e){return e.address},e.userInfo))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(mS,n,a)}return uo},SS=r(function(e,t){return f(Gf,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return Ff}r.a,r.b;return ny}if("Seller"===r.b.$){r.a,r.b;return ny}r.a,r.b;return Ff},f(mb,e,t))}),ES=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b;if(!e.b)return L(r,n);var a=e.a,i=a.a,o=a.b,u=e.b,s=l(ZC,i,o,r),c=s.a,f=s.b,d=u,h=L(c,n||f);e=d,t=h}}),e,L(t,!1))}),TS=o(function(e,t,r,n,a,i){return{history:a,initiatorRole:n,messageInput:i,userInfo:t,userRole:r,web3Context:e}}),wS=i(function(e,t,r,n,a){return f(ES,a,p(TS,e,t,r,n,si,""))}),IS=a(function(e,t,r,n){var a=L(t,r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$){var i=a.a.a,o=a.b.a,u=f(SS,i,o.address);if("Just"===u.$){var s=u.a;return f(Zo,ba,h(wS,e,o,s,i.parameters.initiatorRole,n))}return L(Ca,!1)}return L(Ca,!1)}),AS={$:"Abort"},BS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),kS=function(e){return{$:"ActionNeedsSig",a:e}},NS=function(e){return{$:"ApproveMining",a:e}},RS={$:"ApproveNeedsSig"},$S=function(e){return{$:"ApproveSigned",a:e}},xS={$:"Burn"},_S=function(e){return{$:"ChatHistoryMsg",a:e}},LS={$:"Claim"},PS=function(e){return{$:"CommitMining",a:e}},DS=function(e){return{$:"ConfirmingAction",a:e}},US=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),OS=function(e){return{$:"EventLogFetched",a:e}},MS=function(e){return{$:"ParametersFetched",a:e}},FS=function(e){return{$:"PhaseInfoFetched",a:e}},VS={$:"Poke"},KS={$:"Recall"},HS={$:"Release"},jS=function(e){return{$:"StartContractAction",a:e}},qS=function(e){return{$:"StateFetched",a:e}},GS=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"}},zS=function(e){return d(hm,e,uo,lo,mr)},YS={mainParagraphs:F([F([Qp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Zp},WS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(eg,e,r)}if("Nothing"===t.a.$){t.a;return f(Xp,"Couldn't decode the fetched \""+e+'" result.',Ca)}return f(Xp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),JS={mainParagraphs:F([F([Qp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Zp},QS=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),XS=n(function(e,t,r){return l(Oh,e,Gf(function(e){return U(e,{logCount:Fi(t)+e.logCount})}),r)}),ZS=r(function(e,t){var r=t.a;return mm(f(Uh,e,r))}),eE=n(function(e,t,r){var n=e.a,a=f(Th,t,n.requests);if("Nothing"===a.$)return L(ym(n),uo);var i=a.a,o=L(i.watchOnce,el(r));if("Nothing"===o.b.$){o.b;return L(ym(U(n,{requests:l(XS,t,r,n.requests)})),uo)}if(o.a){var u=o.b.a;return L(ym(U(n,{requests:l(XS,t,r,n.requests),watching:f(ZS,t,n.watching)})),f(hg,i.tagger,Zh(u)))}return L(ym(U(n,{requests:l(XS,t,r,n.requests)})),oo(f(nu,function(e){return f(hg,i.tagger,Zh(e))},r)))}),tE=_e,rE=r(function(e,t){return f(mp,f(_a,vm,t),f(up,function(t){return gm(e)},tE(2e3)))}),nE=se,aE=fe,iE=n(function(e,t,r){var n=function(e){return aE(F([e,nE(r)]))};return f(xo,function(a){var i=f(Jd,e,a);if("Ok"===i.$){var o=i.a,u=f(Jd,n(t),o);if("Ok"===u.$){var s=u.a;return Po(s)}var c=u.a;return _o(Zi(c))}return Po(r)},to)}),oE=a(function(e,t,r,n){return f(pd,l(iE,f(Fd,e,to),t,r),n)}),uE=n(function(e,t,r){return f(pd,f(Fd,e,t),r)}),sE=Do(Ud),cE=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),fE=function(e){return{$:"BlockHash",a:e}},lE=function(e){return cE(e)?Bi(fE(No(e))):Ai("Given blockHash "+Dd(e)+" is not valid.")},dE=Do(lE),hE=function(e){return{$:"TxHash",a:e}},pE=function(e){return cE(e)?Bi(hE(No(e))):Ai("Given txHash "+Dd(e)+" is not valid.")},gE=Do(pE),vE=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}}),yE=Yr,mE=l(uE,"blockNumber",pm,l(uE,"blockHash",dE,l(uE,"transactionHash",gE,l(uE,"transactionIndex",pm,l(uE,"logIndex",pm,d(oE,"removed",yE,!1,l(uE,"topics",Um(db),l(uE,"data",Lo,l(uE,"address",sE,Po(vE)))))))))),bE=function(e){return f(Qd,function(e){if("Just"===e.$){var t=e.a;return Yd(hf(t))}return ch},e)},CE=function(e){return Xd(F([L("fromBlock",ih(e.fromBlock)),L("toBlock",ih(e.toBlock)),L("address",oh(e.address)),L("topics",bE(e.topics))]))},SE=r(function(e,t){return rp({decoder:Um(mE),method:"eth_getLogs",params:F([CE(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(up,function(r){return f(cp,_i(r),f(SE,e,U(t,{fromBlock:EE(n),toBlock:EE(a)})))},f(SE,e,t)):f(SE,e,t)}),wE=n(function(e,t,r){var n=r.a,a=r.b;return f(SE,e,U(t,{fromBlock:EE(n),toBlock:EE(a)}))}),IE=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(IE,e,t,i)),c=o;e=u,t=s,r=c}}),AE=r(function(e,t){return l(IE,Nh,t,e)}),BE=r(function(e,t){var r=e.a,n=t.a;return mm(f(AE,r,n))}),kE=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 oo(f(nu,function(t){return f(mp,f(_a,QS(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},XC(f(nu,function(e){return f(Th,e,r.requests)},Ga(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(ym(U(r,{blockNumber:ba(a)})),oo(F([f(rE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,wE)]))):L(t,f(rE,r.nodePath,r.tagger))}return L(ym(U(r,{blockNumber:ba(a),pending:bm,watching:f(BE,r.watching,r.pending)})),oo(F([f(rE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,TE),l(i,L(a,a),r.watching,wE)])))}var s=e.a.a;return L(ym(U(r,{errors:f(za,s,r.errors)})),f(rE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(eE,t,c,d)}var s=e.b.a;return L(ym(U(r,{errors:f(za,s,r.errors)})),uo)}),NE=r(function(e,t){var r=t.a;return mm(l(Nh,e,vr,r))}),RE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=U(a,{ref:a.ref+1,requests:l(Nh,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(ym(U(o,{watching:f(NE,a.ref,o.watching)})),f(mp,f(_a,QS(a.ref),a.tagger),e),a.ref)}(l(TE,a.nodePath,n,L(s,s)))}return P(ym(U(o,{pending:f(NE,a.ref,o.pending)})),uo,a.ref)}),$E=RE(!1),xE=function(e){return F([e])},_E=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(lm,t.web3Context,r.id):uo}return uo}()),n=function(){var e=P(t.userInfo,t.trade,t.web3Context.factoryType);if("Just"===e.a.$&&"LoadedTrade"===e.b.$&&"Token"===e.c.$){var r=e.a.a,n=e.b.a,a=e.c.a;return h(bp,t.web3Context,a,r.address,n.creationInfo.address,Ly)}return uo}(),a=function(){return"Nothing"===t.chatHistoryModel.$?d(IS,t.web3Context,t.trade,t.userInfo,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1)}(),i=a.a,o=a.b,u=U(t,{chatHistoryModel:i}),s=o?CS(t):uo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(hm,u,oo(F([l(fC,t.web3Context,p.creationInfo.address,qS),s,r,n])),lo,mr)}return zS(u);case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var v=g.a,u=U(t,{allowance:ba(v)}),y=P(u.txChainStatus,u.trade,u.userInfo);if("Just"===y.a.$&&"ApproveMining"===y.a.a.$&&"LoadedTrade"===y.b.$&&"Just"===y.c.$){var m=y.b.a,b=y.c.a;if($(f(Tu,v,qf(bb(m.parameters))),Oa))return zS(u);var C=d(pS,t.web3Context,m,b.address,b.commPubkey),S=C.a,E=C.b;return d(hm,U(u,{txChainStatus:S}),uo,E,mr)}return zS(u)}var T=g.a;return d(hm,t,uo,lo,F([Tf(f(eg,"allowance",T))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var w=g.a,I={address:w.address_,blocknum:dC(w.blocknum)},A=l($E,OS,t.eventSentry,{address:I.address,fromBlock:EE(I.blocknum),toBlock:ap,topics:mr}),B=A.a,k=A.b,u=U(t,{eventSentry:B,trade:f(Rb,I,t.trade)}),N=oo(F([k,h(lC,u.web3Context,I.address,MS,qS,FS)]));return d(hm,u,N,lo,mr)}if("BadBody"===g.a.$){g.a.a;return d(hm,t,uo,lo,F([Tf(YS)]))}var T=g.a;return d(hm,t,uo,lo,F([Tf(f(eg,"trade state",T))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var R=g.a.a,x=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,R.phase);default:return!1}}(),u=U(t,{expandedPhase:x?R.phase:t.expandedPhase,trade:f(_b,R,t.trade)});return d(hm,u,CS(u),lo,mr)}return d(hm,t,uo,lo,F([Tf(f(WS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var _=g.a.a;if(Cb(_)){var u=U(t,{trade:f($b,_,t.trade)});return d(hm,u,CS(u),lo,mr)}return d(hm,t,uo,lo,F([Tf(JS)]))}var D=g.a.a;return d(hm,t,uo,lo,F([Tf(f(Xp,"Error decoding fetched trade parameters",D))]))}var M=g.a;return d(hm,t,uo,lo,F([Tf(f(eg,"trade parameters",M))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var V=g.a.a,u=U(t,{trade:f(xb,V,t.trade)});return d(hm,u,CS(u),lo,mr)}return d(hm,t,uo,lo,F([Tf(f(WS,"trade state",g))]));case"EventLogFetched":var K=e.a,H=f(Zd,gb,K),j=H.returnData;if("Err"===j.$){var q=j.a;return d(hm,t,uo,lo,F([Tf(f(Xp,"Error decoding contract event",q))]))}var G=j.a,z=function(){switch(G.$){case"InitiatedEvent":var e=G.a;return f(wC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=G.a;return f(IC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),Y=function(){if("InitiatedEvent"===G.$){var e=G.a,r=Om(e.terms);if("Ok"===r.$){var n=r.a;return L(f(Lb,n,t.trade),Ca)}var a=r.a;return L(t.trade,ba(f(Xp,"Couldn't decode payment methods!",a)))}return L(t.trade,Ca)}(),W=Y.a,J=Y.b,Q=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return f(Zo,ba,l(ZC,H.blockNumber,G,r))}return d(IS,t.web3Context,W,t.userInfo,t.eventsWaitingForChatHistory)}(),i=Q.a,o=Q.b,X=function(){return"Nothing"===i.$?f(Za,t.eventsWaitingForChatHistory,F([L(H.blockNumber,G)])):mr}(),u=U(t,{chatHistoryModel:i,eventsWaitingForChatHistory:X,secureCommInfo:z,trade:W}),N=o?CS(u):uo;return d(hm,u,N,lo,f(nu,Tf,XC(F([J]))));case"ExpandPhase":var Z=e.a;return zS(U(t,{expandedPhase:Z}));case"ToggleChat":var ee=!t.showChatHistory;return zS(U(t,{showChatHistory:ee}));case"ToggleStatsModal":var te=!t.showStatsModal;return zS(U(t,{showStatsModal:te}));case"ViewUserHistory":var re=e.a,ne=t.trade;if("LoadedTrade"===ne.$){var m=ne.a;return d(hm,t,uo,lo,F([po(f(mf,m.parameters.initiatorAddress,re))]))}return d(hm,t,uo,lo,F([Tf(f(Xp,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var m=e.a,b=e.b,ae=e.c;return zS(U(t,{txChainStatus:ba(l(US,m,b,ae))}));case"AbortAction":return zS(U(t,{txChainStatus:Ca}));case"ConfirmCommit":var m=e.a,b=e.b,ae=e.c,ie=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return d(pS,t.web3Context,m,b.address,b.commPubkey);var r=e.a,n=function(){var e=Cf(l(fd,id(r),m.creationInfo.address,ae)),t={onBroadcast:Ca,onMined:Ca,onSign:ba($S)};return f(yf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Tu,i,qf(bb(m.parameters))),Oa)?L(ba(RS),n):d(pS,t.web3Context,m,b.address,b.commPubkey)}return L(ba(RS),n)}(),S=ie.a,E=ie.b;return d(hm,U(t,{txChainStatus:S}),uo,E,mr);case"ContractActionClicked":var oe=e.a;if($(oe,VS)||$(oe,KS)){var ue=jS(oe),se=t;e=ue,t=se;continue e}return zS(U(t,{txChainStatus:ba(DS(oe))}));case"StartContractAction":var ce=e.a,fe=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,lo,F([Tf(f(Xp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(ce.$){case"Recall":var a=Cf(Am(n.creationInfo.address));return P(ba(kS(KS)),f(yf,uS(KS),a),mr);case"Claim":var a=Cf(wm(n.creationInfo.address));return P(ba(kS(LS)),f(yf,uS(LS),a),mr);case"Abort":var a=Cf(Em(n.creationInfo.address));return P(ba(kS(AS)),f(yf,uS(AS),a),mr);case"Release":var a=Cf(Bm(n.creationInfo.address));return P(ba(kS(HS)),f(yf,uS(HS),a),mr);case"Burn":var a=Cf(Tm(n.creationInfo.address));return P(ba(kS(xS)),f(yf,uS(xS),a),mr);default:var a=Cf(gf(n.creationInfo.address));return P(ba(kS(VS)),f(yf,uS(VS),a),mr)}}(),S=fe.a,E=fe.b,le=fe.c;return d(hm,U(t,{txChainStatus:S}),uo,E,le);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return zS(U(t,{txChainStatus:ba(NS(he))}))}var D=de.a;return d(hm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"approve",D))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return zS(U(t,{txChainStatus:ba(PS(he))}))}var D=de.a;return d(hm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"commit",D))]));case"CommitMined":return zS(U(t,{txChainStatus:Ca}));case"ActionSigned":var oe=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return zS(U(t,{txChainStatus:ba(f(BS,oe,he))}))}var D=de.a;return d(hm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,GS(oe),D))]));case"ActionMined":var oe=e.a;return zS(U(t,{txChainStatus:Ca}));case"EventSentryMsg":var pe=e.a,ge=f(kE,pe,t.eventSentry),ve=ge.a,N=ge.b;return d(hm,U(t,{eventSentry:ve}),N,lo,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(aS,ye,be),Se=U(t,{chatHistoryModel:ba(Ce.model)}),s=Ce.shouldCallDecrypt?CS(t):uo,Ee=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(sS(f(CC,r,a)),Ca)}return L(uo,ba(f(Xp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(uo,Ca)}(),Te=Ee.a,we=Ee.b;return d(hm,Se,oo(F([s,Te])),lo,O(f(Mf,_S,Ce.appCmds),f(rc,mr,f(Gf,xE,f(Gf,Tf,we)))))}return d(hm,t,uo,lo,F([Tf(f(Xp,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(rh,bC,yC(Ie)),Be=P(t.userInfo,t.trade,Ae);if("Ok"===Be.c.$){if("Just"===Be.a.$&&"LoadedTrade"===Be.b.$){var b=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(mb,p,b.address);if("Nothing"===Ne.$)return d(hm,t,uo,lo,F([Tf(f(Xp,"Trying to encrypt, but the user is not involved in this trade.",Ca))]));var Re=Ne.a,$e=function(){return Cf("Initiator"===Re.$?f(Im,p.creationInfo.address,ke):f(km,p.creationInfo.address,ke))}();return d(hm,t,uo,f(yf,{onBroadcast:Ca,onMined:Ca,onSign:Ca},$e),mr)}var xe=Be.a,_e=Be.b;return d(hm,t,uo,lo,F([Tf(f(Xp,"Encryption successful, but the user or trade is no longer valid.",L(xe,_e)))]))}var Le=Be.c.a;return d(hm,t,uo,lo,F([Tf(f(Xp,"Error translating JS encryption result into Elm.",Le))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return zS(t)}var D=e.a.a;return d(hm,t,uo,lo,F([Tf(f(tg,"message",D))]));default:return d(hm,t,uo,lo,F([wf]))}}),LE=function(e){return{$:"EventSentryMsg",a:e}},PE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),DE=function(e){var t=f(Cm,LE,e.httpProvider),r=t.a,n=t.b;return L({dataFetchStatus:l(PE,Ca,0,0),eventSentry:r,trades:si,web3Context:e},n)},UE=function(e){return{data:ba(f(pf,"numTrades()",mr)),decoder:Uo(Gd),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},OE=r(function(e,t){return f(mp,t,f(ip,e.httpProvider,UE(ad(e.factoryType))))}),ME=function(e){return{$:"InitialNumTradesFetched",a:e}},FE=function(e){return f(OE,e.web3Context,ME)},VE=function(e){var t=DE(e),r=t.a,n=t.b;return L(r,oo(F([n,FE(r)])))},KE=r(function(e,t){return{address:e,blocknum:t}}),HE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(RE,!0,e,t,r))}),jE=n(function(e,t,r){var n=function(e){return r(f(Zd,Wm,e).returnData)},a={address:t.address,fromBlock:EE(t.blocknum),toBlock:EE(t.blocknum),topics:F([ba(pb("Initiated(string,string)"))])};return l(HE,n,e,a)}),qE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(za,a,r)}return r}),GE=r(function(e,t){return l(Xa,qE(e),mr,t)}),zE=function(e){return f(GE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ba(t)}return Ca},Va(e.trades))},YE=function(e){return f(Wa,r(function(t,r){return e(t)?r+1:r}),0)},WE=function(e){return f(YE,pi(Sb),Va(e.trades))},JE=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:WE(e),loaded:Fi(zE(e))})})},QE=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),XE=r(function(e,t){var r=f(Sc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Ac,e,Sb,t.trades));return l(QE,JE(U(t,{trades:n})),uo,mr)}return l(QE,t,uo,F([Tf(f(Xp,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),ZE=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Rb,t,a),o=l(Ac,e,i,r.trades);return L(JE(U(r,{trades:o})),mr)}return L(r,F([f(Xp,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),eT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f($b,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),tT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(xb,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),rT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(_b,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),nT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Lb,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),aT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),iT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),oT=function(e){return{$:"NumTradesFetchedAgain",a:e}},uT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),sT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),cT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),fT=function(e){return l(QE,e,uo,mr)},lT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=dC(n),i=gC(f(nu,Xy,f(Hi,0,a-1))),o=oo(f(nu,function(e){return l(cm,t.web3Context,hu(e),aT(e))},f(Hi,0,a-1)));return l(QE,U(t,{dataFetchStatus:l(PE,ba(a),0,0),trades:i}),o,mr)}var u=r.a;return l(QE,t,uo,F([Tf(f(eg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(QE,t,f(OE,t.web3Context,oT),mr);case"NumTradesFetchedAgain":var r=e.a,s=L(r,t.dataFetchStatus.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=dC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=oo(f(nu,function(e){return l(cm,t.web3Context,hu(e),aT(e))},f(Hi,c,d-1))),g=gC(f(nu,Xy,f(Hi,c,d-1)));return l(QE,U(t,{dataFetchStatus:U(p,{total:ba(d)}),trades:f(JC,t.trades,g)}),o,mr)}return fT(t)}s.b;return l(QE,t,uo,F([Tf(f(Xp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(QE,t,uo,F([Tf(f(eg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(KE,y.address_,dC(y.blocknum)),b=l(jE,t.eventSentry,m,iT(v)),C=b.a,S=b.b,E=oo(F([h(lC,t.web3Context,m.address,uT(v),cT(v),sT(v)),S])),T=l(ZE,v,m,t),w=T.a,I=T.b;return l(QE,JE(U(w,{eventSentry:C})),E,f(nu,Tf,I))}var u=r.a;return l(QE,t,uo,F([Tf(f(eg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(QE,t,uo,F([Tf(f(eg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(eT,v,B,t)}var k=r.a.a;return l(QE,t,uo,F([Tf(f(Xp,"Can't decode fetched trade parameters",k))]));case"StateFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var N=r.a.a;return l(rT,v,N,t)}return l(QE,t,uo,F([Tf(f(WS,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(tT,v,R,t)}return l(QE,t,uo,F([Tf(f(WS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Om($.terms);if("Ok"===x.$){var P=x.a;return l(nT,v,P,t)}var D=x.a;return f(XE,v,t)}var D=r.a;return l(QE,t,uo,F([Tf(f(Xp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(kE,O,t.eventSentry),V=M.a,E=M.b;return l(QE,U(t,{eventSentry:V}),E,mr)}}),dT=function(e){return{$:"AgentHistoryMsg",a:e}},hT=function(e){return{$:"AppCmd",a:e}},pT={$:"BetaLandingPage"},gT={$:"ConnectToWeb3"},vT=function(e){return{$:"MarketplaceMsg",a:e}},yT=function(e){return{$:"TradeCacheMsg",a:e}},mT=r(function(e,t){return f(jn,e,Yd(t))}),bT=function(e){return f(mT,"href",it(e))},CT=qn("rel"),ST=mT("target"),ET=function(e){return{$:"Height",a:e}},TT=ET,wT={$:"Content"},IT=wT,AT=function(e){return{$:"Width",a:e}},BT=AT,kT=function(e){return{$:"Attr",a:e}},NT=function(e){return{$:"NodeName",a:e}},RT=function(e){return{$:"Unkeyed",a:e}},$T={$:"AsEl"},xT=$T,_T=r(function(e,t){return{$:"Field",a:e,b:t}}),LT=f(_T,0,0),PT={$:"NoNearbyChildren"},DT={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",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputText:"it",italic:"i",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"},UT=DT.any+" "+DT.column,OT=DT.any+" "+DT.grid,MT=DT.any+" "+DT.page,FT=DT.any+" "+DT.paragraph,VT=DT.any+" "+DT.row,KT=DT.any+" "+DT.single,HT=function(e){switch(e.$){case"AsRow":return VT;case"AsColumn":return UT;case"AsEl":return KT;case"AsGrid":return OT;case"AsParagraph":return FT;default:return MT}},jT=function(e){return{$:"Keyed",a:e}},qT={$:"NoStyleSheet"},GT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return O(r,e);case"ChildrenInFront":var n=t.a;return O(e,n);default:var r=t.a,n=t.b;return O(r,O(e,n))}}),zT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(nu,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(nu,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return O(f(nu,function(t){return L(e,t)},n),O(t,f(nu,function(t){return L(e,t)},a)))}}),YT={$:"AsParagraph"},WT=YT,JT=On("div"),QT=On("p"),XT=On("s"),ZT=On("u"),ew=mT("className"),tw=function(e){return Fn(rt(e))},rw=function(e){return On(rt(e))},nw=function(e){return{$:"Flag",a:e}},aw=function(e){return{$:"Second",a:e}},iw=function(e){return e>31?aw(1< .ctr > ."+DT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",oI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Bw(DT.any)+Bw(DT.row)+" > "+Bw(DT.any)+" { flex-basis: auto !important; } "+Bw(DT.any)+Bw(DT.row)+" > "+Bw(DT.any)+Bw(DT.container)+" { flex-basis: auto !important; }}\n\n/* General Input Reset */\ninput[type=range] {\n -webkit-appearance: none; /* Hides the slider so that custom slider can be made */\n /* width: 100%; Specific width is required for Firefox. */\n background: transparent; /* Otherwise white in Chrome */\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\n/* Hide all syling for track */\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\n/* Thumbs */\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"+iI,uI=function(e){return{$:"Intermediate",a:e}},sI=r(function(e,t){return uI({closing:t,others:mr,props:mr,selector:e})}),cI=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 U(t,{props:f(za,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return U(t,{others:f(za,uI({closing:"\n}",others:mr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return U(t,{others:f(za,f(cI,f(sI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(za,f(cI,f(sI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(za,f(cI,f(sI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(za,f(cI,f(sI,n.selector,""),v),t.others)})}});return uI(l(Xa,a,n,t))}),fI=O(oI,function(e){var t=function(e){return Tl(f(nu,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 O(n(t),Tl(f(nu,a,t.others)))};return Tl(f(nu,a,l(Xa,r(function(e,t){var r=e.a,n=e.b;return f(za,f(cI,f(sI,r,""),n),t)}),mr,e)))}(O(rI,aI))),lI=l(rw,"style",mr,F([Nw(fI)])),dI=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+'"'}},hI=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}},pI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ed,hI,t.variants)}return!1},gI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),vI=r(function(e,t){return e+" {"+f(zi,"",f(nu,function(e){return e.a+": "+e.b+";"},t))+"}"}),yI=n(function(e,t,r){var n=r.a,a=r.b;return F([f(vI,"."+e+"."+t+", ."+e+" ."+t,n),f(vI,"."+e+"."+t+"> ."+DT.text+", ."+e+" ."+t+" > ."+DT.text,a)])}),mI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(zi," ",O(l(yI,i,DT.sizeByCapital,a),l(yI,i,DT.fullSize,n)))}),bI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(zi," ",F([f(vI,"."+r+"."+DT.sizeByCapital+", ."+r+" ."+DT.sizeByCapital,F([L("line-height","1")])),f(vI,"."+r+"."+DT.sizeByCapital+"> ."+DT.text+", ."+r+" ."+DT.sizeByCapital+" > ."+DT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),CI=function(e){if(e.b){var t=e.a,r=e.b;return ba(l(Wa,mi,t,r))}return Ca},SI=function(e){if(e.b){var t=e.a,r=e.b;return ba(l(Wa,qs,t,r))}return Ca},EI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),TI=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(rc,e.descender,SI(t)),n=f(rc,e.baseline,SI(f(th,function(e){return!$(e,r)},t))),a=f(rc,e.capital,CI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(EI,i,a-n,o),full:l(EI,u,a-r,s)}},wI=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",ww(e.height)),L("vertical-align",ww(e.vertical)+"em"),L("font-size",ww(e.size)+"em")]))},II=function(e){return l(Wa,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 ba(L(wI(function(e){return e.full}(TI(a))),wI(function(e){return e.capital}(TI(a)))))}return t}return t}),Ca,e)},AI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ba("@import url('"+t+"');")}return Ca},r=function(e){var r=(e.a,e.b);return f(zi,"\n",f(GE,t,r))},n=f(nu,gi,e),a=function(e){var t=e.a,r=e.b,a=II(r);if("Nothing"===a.$)return f(zi,"",f(nu,bI(t),n));var i=a.a;return f(zi,"",f(nu,f(mI,t,i),n))};return O(f(zi,"\n",f(nu,r,e)),f(zi,"\n",f(nu,a,e)))},BI=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+'" '+Gi(r)}},kI=function(e){if("FontWith"===e.$){var t=e.a;return ba(f(zi,", ",f(nu,BI,t.variants)))}return Ca},NI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ba(L(t,r))}return Ca},RI=function(e){switch(e.$){case"Untransformed":return Ca;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ba("translate3d("+ww(r)+"px, "+ww(n)+"px, "+ww(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("+ww(o)+"px, "+ww(u)+"px, "+ww(s)+"px)",b="scale3d("+ww(f)+", "+ww(l)+", "+ww(d)+")",C="rotate3d("+ww(p)+", "+ww(g)+", "+ww(v)+", "+ww(y)+"rad)";return ba(m+" "+b+" "+C)}},$I=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Wa,gI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Wa,gI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Wa,gI(!1),"",n)+"\n}"}case"Focus":var a=l(Wa,gI(!1),"",n);return f(zi,"\n",F([r+"-fs:focus {"+a+"\n}","."+DT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+DT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+DT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Wa,gI(!1),"",n)+"\n}"}}),i=r(function(e,t){switch(e.$){case"Style":var r=e.a,o=e.b;return l(a,t,r,o);case"Shadows":var u=e.a,s=e.b;return l(a,t,"."+u,F([f(Ew,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(mi,0,f(qs,1,1-c));return l(a,t,"."+u,F([f(Ew,"opacity",ww(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Gi(h),F([f(Ew,"font-size",Gi(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(zi,", ",f(GE,kI,p)),v=F([f(Ew,"font-family",f(zi,", ",f(nu,dI,p))),f(Ew,"font-feature-settings",g),f(Ew,"font-variant",f(Ed,pI,p)?"small-caps":"normal")]);return f(zi," ",F([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,F([f(Ew,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Ew,s,Iw(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=Gi(E)+"px",w=Gi(S)+"px",I="."+DT.row,A="."+(DT.wrapped+I),B="."+DT.alignRight,k="."+DT.paragraph,N="."+DT.page,R="."+DT.alignLeft,$=ww(E/2)+"px",x=ww(S/2)+"px",_="."+DT.column,y="."+C,P="."+DT.any;return Tl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Ew,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Ew,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Ew,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Ew,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Ew,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Ew,"margin-left",w)])),l(a,t,O(y,k),F([f(Ew,"line-height","calc(1em + "+Gi(E)+"px)")])),l(a,t,"textarea"+y,F([f(Ew,"line-height","calc(1em + "+Gi(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Ew,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Ew,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Ew,"content","''"),f(Ew,"display","block"),f(Ew,"height","0"),f(Ew,"width","0"),f(Ew,"margin-top",Gi(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Ew,"content","''"),f(Ew,"display","block"),f(Ew,"height","0"),f(Ew,"width","0"),f(Ew,"margin-bottom",Gi(-1*(E/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Ew,"padding",Gi(D)+"px "+Gi(B)+"px "+Gi(U)+"px "+Gi(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Ew,"border-width",Gi(D)+"px "+Gi(B)+"px "+Gi(U)+"px "+Gi(R)+"px")]));case"GridTemplateStyle":var M=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Gi(n)+"px";case"Content":var a=L(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, "+Gi(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Gi(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Gi(o)+"px, "+Gi(i)+"px)";case"Fill":var u=r.a,s=L(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Gi(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Gi(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Gi(o)+"px, "+Gi(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Gi(o)+"px, "+Gi(i)+"px)";case"Min":var c=r.a,f=r.b,l=ba(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ba(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,Ca,Ca,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(zi," ",f(nu,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(zi,H,f(nu,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(zi,H,f(nu,K,M.columns))),z="grid-row-gap:"+K(M.spacing.b)+";",Y="grid-column-gap:"+K(M.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(zi," ",f(nu,K,M.columns))),y=".grid-rows-"+f(zi,"-",f(nu,yw,M.rows))+"-cols-"+f(zi,"-",f(nu,yw,M.columns))+"-space-x-"+yw(M.spacing.a)+"-space-y-"+yw(M.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return O(X,Q);case"GridPosition":var Z=e.a,ee=f(zi," ",F(["-ms-grid-row: "+Gi(Z.row)+";","-ms-grid-row-span: "+Gi(Z.height)+";","-ms-grid-column: "+Gi(Z.col)+";","-ms-grid-column-span: "+Gi(Z.width)+";"])),te=f(zi," ",F(["grid-row: "+Gi(Z.row)+" / "+Gi(Z.row+Z.height)+";","grid-column: "+Gi(Z.col)+" / "+Gi(Z.col+Z.width)+";"])),y=".grid-pos-"+Gi(Z.row)+"-"+Gi(Z.col)+"-"+Gi(Z.width)+"-"+Gi(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(zi," ",f(nu,function(e){return f(i,e,ba(y))},re));default:var ne=e.a,m=RI(ne),y=bw(ne),ae=L(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return l(a,t,"."+C,F([f(Ew,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,Ca)),topLevel:function(){var r=NI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(za,n,t.topLevel)}()}}),u=l(Wa,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(AI(s),c)}),xI=r(function(e,t){return l(rw,"style",mr,F([Nw(f($I,e,t))]))}),_I=a(function(e,t,r,n){return e?f(za,L("static-stylesheet",lI),f(za,L("dynamic-stylesheet",f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b)),n)):f(za,L("dynamic-stylesheet",f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b)),n)}),LI=a(function(e,t,r,n){return e?f(za,lI,f(za,f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b),n)):f(za,f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b),n)}),PI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(tw,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(_I,!1,e,t,r);default:var e=i.a,t=i.b;return d(_I,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return JT;case"p":return QT;default:return rw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(LI,!1,e,t,n);default:var e=i.a,t=i.b;return d(LI,!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(rw,e,n,F([f(u,r,F([ew(DT.any+" "+DT.single)]))]))}}();switch(o.$){case"AsRow":return f(dw,pw,e)&&!f(dw,hw,e)?s:f(dw,uw,e)?f(ZT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.contentCenterY,DT.alignContainerRight])))]),F([s])):f(dw,sw,e)?f(XT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.contentCenterY,DT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(dw,lw,e)&&!f(dw,fw,e)?s:f(dw,cw,e)?f(XT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.alignContainerCenterY])))]),F([s])):f(dw,ow,e)?f(ZT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.alignContainerBottom])))]),F([s])):s;default:return s}}),DI=Nw,UI=function(e){return f(JT,F([ew(f(zi," ",F([DT.any,DT.text,DT.widthContent,DT.heightContent])))]),F([DI(e)]))},OI=function(e){return l(rw,"div",F([ew(f(zi," ",F([DT.any,DT.text,DT.widthFill,DT.heightFill])))]),F([Nw(e)]))},MI=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,WT),L(f(za,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,WT),L(f(za,L(n,f(s.html,qT,e)),i),Go(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(za,L(n,$(e,xT)?OI(c):UI(c)),i),o);default:return L(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,WT),L(f(za,i(e),n),a);case"Styled":var o=t.a;return $(e,WT),L(f(za,f(o.html,qT,e),n),Go(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(za,$(e,xT)?OI(u):UI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Xa,a,L(mr,mr),o),s=u.a,c=u.b,p=Go(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return xf({html:d(PI,n.has,n.node,n.attributes,jT(l(zT,"nearby-element-pls",s,n.children))),styles:g})}return Lf(h(PI,n.has,n.node,n.attributes,jT(l(zT,"nearby-element-pls",s,n.children)),qT))}var v=t.a,y=l(Xa,i,L(mr,mr),v),m=y.a,c=y.b,p=Go(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return xf({html:d(PI,n.has,n.node,n.attributes,RT(f(GT,m,n.children))),styles:g})}return Lf(h(PI,n.has,n.node,n.attributes,RT(f(GT,m,n.children)),qT))}),FI=r(function(e,t){return f(qn,nt(e),ot(t))}),VI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(_T,a|r,n)}var i=e.a;return f(_T,r,i|n)}),KI=iw(7),HI=iw(36),jI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(_T,r|a,n|i)}),qI=iw(6),GI=iw(38),zI=iw(30),YI=iw(29),WI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),JI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),QI=function(e){return{$:"Transform",a:e}},XI=function(e){return{$:"ChildrenBehind",a:e}},ZI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),eA=function(e){return{$:"ChildrenInFront",a:e}},tA=r(function(e,t){return f(JT,F([ew(function(){switch(e.$){case"Above":return f(zi," ",F([DT.nearby,DT.single,DT.above]));case"Below":return f(zi," ",F([DT.nearby,DT.single,DT.below]));case"OnRight":return f(zi," ",F([DT.nearby,DT.single,DT.onRight]));case"OnLeft":return f(zi," ",F([DT.nearby,DT.single,DT.onLeft]));case"InFront":return f(zi," ",F([DT.nearby,DT.single,DT.inFront]));default:return f(zi," ",F([DT.nearby,DT.single,DT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return Nw("");case"Text":var e=t.a;return UI(e);case"Unstyled":return(0,t.a)(xT);default:return f(t.a.html,qT,xT)}}()]))}),rA=n(function(e,t,r){var n=f(tA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?XI(F([n])):eA(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?XI(f(za,n,a)):f(ZI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(ZI,F([n]),i):eA(f(za,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(ZI,f(za,n,a),i):f(ZI,a,f(za,n,i))}}),nA=r(function(e,t){switch(t.$){case"Generic":return NT(e);case"NodeName":var r=t.a;return f(WI,r,e);default:var n=t.a,a=t.b;return f(WI,n,a)}}),aA=function(e){switch(e.$){case"Left":return DT.alignedHorizontally+" "+DT.alignLeft;case"Right":return DT.alignedHorizontally+" "+DT.alignRight;default:return DT.alignedHorizontally+" "+DT.alignCenterX}},iA=function(e){switch(e.$){case"Top":return DT.alignedVertically+" "+DT.alignTop;case"Bottom":return DT.alignedVertically+" "+DT.alignBottom;default:return DT.alignedVertically+" "+DT.alignCenterY}},oA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),uA=function(e){return{$:"Moved",a:e}},sA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return uA(P(r,0,0));case"MoveY":var n=t.a;return uA(P(0,n,0));case"MoveZ":var a=t.a;return uA(P(0,0,a));case"MoveXYZ":var i=t.a;return uA(i);case"Rotate":var i=t.a,o=t.b;return d(oA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(oA,P(0,0,0),i,P(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 uA(P(s,n,a));case"MoveY":var c=t.a;return uA(P(r,c,a));case"MoveZ":var f=t.a;return uA(P(r,n,f));case"MoveXYZ":var i=t.a;return uA(i);case"Rotate":var i=t.a,o=t.b;return d(oA,u,P(1,1,1),i,o);default:var l=t.a;return d(oA,u,l,P(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(oA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(oA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(oA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(oA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(oA,u,h,v,y);default:var m=t.a;return d(oA,u,m,p,o)}}}),cA=function(e){switch(e.$){case"Px":var t=e.a,r=Gi(t),n="height-px-"+r;return P(LT,n,F([l(JI,n,"height",r+"px")]));case"Content":return P(f(VI,HI,LT),DT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(VI,lw,LT),DT.heightFill,mr):P(f(VI,lw,LT),DT.heightFillPortion+" height-fill-"+Gi(a),F([l(JI,DT.any+"."+DT.row+" > "+Bw("height-fill-"+Gi(a)),"flex-grow",Gi(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Gi(i),s=l(JI,u,"min-height",Gi(i)+"px"),c=cA(o),d=c.a,h=c.b,p=c.c;return P(f(VI,fw,d),u+" "+h,f(za,s,p));default:var g=e.a,o=e.b,u="max-height-"+Gi(g),s=l(JI,u,"max-height",Gi(g)+"px"),v=cA(o),d=v.a,h=v.b,p=v.c;return P(f(VI,fw,d),u+" "+h,f(za,s,p))}},fA=function(e){switch(e.$){case"Px":var t=e.a;return P(LT,DT.widthExact+" width-px-"+Gi(t),F([l(JI,"width-px-"+Gi(t),"width",Gi(t)+"px")]));case"Content":return P(f(VI,GI,LT),DT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(VI,pw,LT),DT.widthFill,mr):P(f(VI,pw,LT),DT.widthFillPortion+" width-fill-"+Gi(r),F([l(JI,DT.any+"."+DT.row+" > "+Bw("width-fill-"+Gi(r)),"flex-grow",Gi(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Gi(n),o=l(JI,i,"min-width",Gi(n)+"px"),u=fA(a),s=u.a,c=u.b,d=u.c;return P(f(VI,hw,s),i+" "+c,f(za,o,d));default:var h=e.a,a=e.b,i="max-width-"+Gi(h),o=l(JI,i,"max-width",Gi(h)+"px"),p=fA(a),s=p.a,c=p.b,d=p.c;return P(f(VI,hw,s),i+" "+c,f(za,o,d))}},lA=iw(27),dA=r(function(e,t){if($(e,lA)){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}}),hA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=bw(n);if("Nothing"===s.$)return{attributes:f(za,ew(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(za,ew(e+" "+c),i),children:o,has:r,node:t,styles:f(za,QI(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,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Class":var E=d.a,T=d.b;if(f(dw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=T+" "+e,g=t,v=f(VI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(za,w,i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"StyleClass":var E=d.a,I=d.b;if(f(dw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(f(dA,E,I)){var p=Cw(I)+" "+e,g=t,v=f(VI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=Cw(I)+" "+e,g=t,v=f(VI,E,r),y=n,m=f(za,I,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"TransformComponent":var E=d.a,A=d.b,p=e,g=t,v=f(VI,E,r),y=f(sA,n,A),m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Width":var B=d.a;if(f(dw,qI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(B.$){case"Px":var k=B.a,p=DT.widthExact+" width-px-"+Gi(k)+" "+e,g=t,v=f(VI,qI,r),y=n,m=f(za,l(JI,"width-px-"+Gi(k),"width",Gi(k)+"px"),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=e+" "+DT.widthContent,g=t,v=f(VI,GI,f(VI,qI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+DT.widthFill,g=t,v=f(VI,pw,f(VI,qI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+DT.widthFillPortion+" width-fill-"+Gi(N),g=t,v=f(VI,pw,f(VI,qI,r)),y=n,m=f(za,l(JI,DT.any+"."+DT.row+" > "+Bw("width-fill-"+Gi(N)),"flex-grow",Gi(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var R=fA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(jI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Height":var L=d.a;if(f(dw,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(L.$){case"Px":var k=L.a,P=Gi(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(VI,KI,r),y=n,m=f(za,l(JI,D,"height ",P),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=DT.heightContent+" "+e,g=t,v=f(VI,HI,f(VI,KI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=L.a;if(1===N){var p=DT.heightFill+" "+e,g=t,v=f(VI,lw,f(VI,KI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+DT.heightFillPortion+" height-fill-"+Gi(N),g=t,v=f(VI,lw,f(VI,KI,r)),y=n,m=f(za,l(JI,DT.any+"."+DT.column+" > "+Bw("height-fill-"+Gi(N)),"flex-grow",Gi(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var U=cA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(jI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(nA,"main",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Navigation":var p=e,g=f(nA,"nav",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"ContentInfo":var p=e,g=f(nA,"footer",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Complementary":var p=e,g=f(nA,"aside",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(nA,"h1",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(F<7){var p=e,g=f(nA,"h"+Gi(F),t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e,g=f(nA,"h6",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return NT("p");case"NodeName":var e=t.a;return NT(e);default:var r=t.a,n=t.b;return f(WI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"role","button"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"aria-label",K),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"aria-live","polite"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"aria-live","assertive"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Nearby":var H=d.a,j=d.b,_=function(){switch(j.$){case"Empty":return a;case"Text":j.a;return a;case"Unstyled":j.a;return a;default:var e=j.a;return O(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(rA,H,j,o),S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"AlignX":var q=d.a;if(f(dw,zI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=aA(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(VI,sw,e);case"Right":return f(VI,uw,e);default:return e}}(f(VI,zI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var G=d.a;if(f(dw,YI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=iA(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(VI,cw,e);case"Bottom":return f(VI,ow,e);default:return e}}(f(VI,YI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}}}),pA={$:"Untransformed"},gA=pA,vA=a(function(e,t,r,n){return l(MI,e,n,v(hA,HT(e),t,LT,gA,mr,mr,PT,Ja(r)))}),yA=function(e){return kT(ew(e))},mA=r(function(e,t){var r=t.url,n=t.label;return d(vA,xT,NT("a"),f(za,kT(bT(r)),f(za,kT(CT("noopener noreferrer")),f(za,kT(ST("_blank")),f(za,BT(IT),f(za,TT(IT),f(za,yA(DT.contentCenterX+" "+DT.contentCenterY),e)))))),RT(F([n])))}),bA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),CA=n(function(e,t,r){return d(bA,e,t,r,1)}),SA=iw(14),EA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),TA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),wA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return mw(t)+"-"+mw(r)+"-"+mw(n)+"-"+mw(a)},IA=function(e){return f(TA,SA,l(EA,"fc-"+wA(e),"color",e))},AA={mainParagraphs:F([F([Qp("You need a web3 provider (such as "),f(mA,F([IA(l(CA,0,0,1))]),{label:Qp("Metamask"),url:"https://metamask.io/"}),Qp(") to Connect.")]),F([Qp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:rg},BA={mainParagraphs:F([F([Qp("I don't understand that URL...")]),F([Qp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Zp},kA={mainParagraphs:F([F([Qp("Your wallet is set to an incorrect network.")]),F([Qp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Zp},NA=Do(f(_a,df,f(_a,qd,Pl("Error decoding hex to BigInt")))),RA=function(){return Do(function(e){switch(e){case"0x0":return Bi(!1);case"0x1":return Bi(!0);default:return Ai("Error decoding "+e+"as bool.")}})}(),$A=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}}}}}}}}}}}},xA=function(e){return aE(F([f(Bf,ba,e),Po(Ca)]))},_A=f(pd,xA(f(Fd,"status",RA)),f(pd,xA(f(Fd,"root",Lo)),l(uE,"logsBloom",Lo,l(uE,"logs",Um(mE),f(pd,xA(f(Fd,"contractAddress",sE)),l(uE,"cumulativeGasUsed",NA,l(uE,"gasUsed",NA,l(uE,"blockNumber",pm,l(uE,"blockHash",dE,l(uE,"transactionIndex",pm,l(uE,"transactionHash",gE,Po($A)))))))))))),LA=function(e){var t=e.a;return df(t)},PA=f(_a,LA,Yd),DA=r(function(e,t){return rp({decoder:_A,method:"eth_getTransactionReceipt",params:F([PA(t)]),url:e})}),UA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),OA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),MA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),FA=r(function(e,t){return f(Gf,function(e){return e.toMsg},f(ag,function(e){return e.b},f(ag,function(e){return e.onMinedTagger},f(Th,t,e))))}),VA=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}}}}}}}}}}}},KA=function(e){return aE(F([nE(Ca),f(Bf,ba,e)]))},HA=l(uE,"input",Lo,l(uE,"gas",pm,l(uE,"gasPrice",NA,l(uE,"value",NA,l(uE,"to",KA(sE),l(uE,"from",sE,l(uE,"transactionIndex",pm,l(uE,"blockNumber",KA(pm),l(uE,"blockHash",function(e){return f(xo,function(t){return"0x"===t||"0x0"===t?Po(Ca):f(qi,function(e){return $(e,D("0"))},No(t))?Po(Ca):f(Bf,ba,e)},Lo)}(dE),l(uE,"nonce",pm,l(uE,"hash",gE,Po(VA)))))))))))),jA=r(function(e,t){return rp({decoder:HA,method:"eth_getTransactionByHash",params:F([PA(t)]),url:e})}),qA=r(function(e,t){return{attempts:e,sleep:t}}),GA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(yp,function(e){return a>0?f(up,function(e){return f(GA,f(qA,a,n),t)},tE(1e3*n)):Xh(e)},t)}),zA=r(function(e,t){return f(up,function(r){return f(GA,{attempts:30,sleep:1},f(jA,e,t))},tE(250))}),YA=r(function(e,t){return f(GA,{attempts:60,sleep:5},f(DA,e,t))}),WA=function(e){return{$:"Mined",a:e}},JA=function(e){return Gf(function(t){return U(t,{status:WA(e)})})},QA=function(e){return{$:"Sent",a:e}},XA=function(e){return Gf(function(t){return U(t,{status:QA(e)})})},ZA=function(e){return{$:"Signed",a:e}},eB=function(e){return Gf(function(t){return U(t,{status:ZA(e)})})},tB=function(e){return"Nothing"!==e.$},rB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(xg(r),uo);case"TxSigned":var n=e.a,a=e.b,i=f(Th,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(hg,t,Zh(a))}return uo}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return uo;if("Just"===t.b.$){var r=t.b.a;return f(hg,r,Zh(Ai(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(hg,a,Zh(Ai(e)))}t.a,t.b,t.c;return uo};if("Ok"===a.$){var c=a.a,d=tB(o.onBroadcastTagger)||tB(o.onMinedTagger)?f(Dg,r.tagger,f(mp,MA(n),f(zA,r.nodePath,c))):uo;return L(xg(U(r,{txs:l(Oh,n,eB(c),r.txs)})),oo(F([u,d])))}var h=a.a;return L(xg(r),oo(F([u,s(h)])))}return L(xg(r),uo);case"TxSent":var n=e.a,p=e.b,g=f(Th,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Dg,r.tagger,f(mp,OA(n),f(YA,r.nodePath,v.hash))):uo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(hg,t,Zh(Bi(v)))}return uo}();return L(xg(U(r,{txs:l(Oh,n,XA(v),r.txs)})),oo(F([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(hg,t,Zh(Ai("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(hg,n,Zh(Ai("Error with TxSent stuff")))}e.a,e.b;return uo}();return L(xg(r),s)}return L(xg(r),uo);case"TxMined":var n=e.a,m=e.b,b=f(Th,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(hg,a,Zh(Bi(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 oo(F([f(Dg,r.tagger,f(mp,f(UA,n,s),gm(r.nodePath))),f(hg,a,Zh(Bi(C))),f(hg,u.toMsg,Zh(s))]))}return uo}();return L(xg(U(r,{txs:l(Oh,n,JA(C),r.txs)})),S)}var h=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(hg,r,Zh(Ai("TxReceipt decoding failure")))}return uo}();return L(xg(r),E)}return L(xg(r),uo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=U(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(FA,r.txs,n);if("Just"===A.$){var B=A.a;return L(xg(r),f(hg,B,f(yp,function(e){return Zh(U(I,{doneWatching:!0,reOrg:!0}))},f(up,function(e){return Zh(U(I,{doneWatching:!0}))},f(DA,r.nodePath,T.txHash)))))}return L(xg(r),uo)}if($(w,T.lastCheckedBlock))return L(xg(r),f(Dg,r.tagger,f(mp,f(UA,n,T),f(up,function(e){return gm(r.nodePath)},tE(2e3)))));var k=f(FA,r.txs,n);if("Just"===k.$){var B=k.a;return L(xg(r),oo(F([f(Dg,r.tagger,f(mp,f(UA,n,I),f(up,function(e){return gm(r.nodePath)},tE(2e3)))),f(hg,B,Zh(I))])))}return L(xg(r),uo)}var n=e.a,h=e.c.a;return L(xg(r),uo);default:var h=e.a;return L(xg(r),uo)}}),nB=Qt,aB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Gi(r)}),iB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),oB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(iB,"#",e.fragment,l(iB,"?",e.query,O(f(aB,e.port_,O(t,e.host)),e.path)))},uB=r(function(e,t){if(e<0)return t;var r=Nd(f(ol,e,t)),n=f(_s,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(Za,n,a)}),sB=r(function(e,t){zv(t);switch(t.$){case"Home":return L(U(e,{submodel:pT}),uo);case"Create":var r=f(td,e.web3Context,e.userInfo),n=f(Mg,e.txSentry,f(Vg,Oy,r.chainCmd)),a=n.a,i=n.b;return f(fB,f(Mf,Oy,r.appCmds),L(U(e,{submodel:Uy(r.model),txSentry:a}),oo(F([f(Dg,Oy,r.cmd),i]))));case"QuickCreate":var r=f(wv,e.web3Context,e.userInfo),o=f(Mg,e.txSentry,f(Vg,Vy,r.chainCmd)),a=o.a,i=o.b;return f(fB,f(Mf,Vy,r.appCmds),L(U(e,{submodel:Fy(r.model),txSentry:a}),oo(F([f(Dg,Vy,r.cmd),i]))));case"Trade":var u=t.a,r=l(Sm,e.web3Context,e.userInfo,u),s=f(Mg,e.txSentry,f(Vg,Hy,r.chainCmd)),a=s.a,i=s.b;return f(fB,f(Mf,Hy,r.appCmds),L(U(e,{submodel:Ky(r.model),txSentry:a}),oo(F([f(Dg,Hy,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(iv,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:My(p)}),oo(F([f(Dg,vT,g)])));case"AgentHistory":var v=t.a,y=t.b,m=d(so,e.web3Context,v,y,e.userInfo),b=m.a,C=m.b;return L(U(e,{submodel:Dy(b)}),oo(F([f(Dg,dT,C)])));default:return L(f(ei,BA,e),uo)}}),cB=r(function(e,t){var r=t.a,n=t.b,a=f(lB,hT(e),r),i=a.a,o=a.b;return L(i,oo(F([n,o])))}),fB=r(function(e,t){var r=t.a,n=t.b;return l(Wa,cB,L(r,n),e)}),lB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(lB,gT,t);case"GotoRoute":var n=r.a;return L(t,f(wy,t.key,n));case"GTag":var a=r.a;return L(t,ky(Ay(a)));default:var i=r.a;return L(f(ei,i,t),uo)}case"DismissNotice":var o=e.a;return L(U(t,{userNotices:f(uB,o,t.userNotices)}),uo);case"LinkClicked":var u=e.a,s=function(){if("Internal"===u.$){var e=u.a;return f(Ty,t.key,oB(e))}var r=u.a;return nB(r)}();return L(t,s);case"UrlChanged":var c=e.a;return f(dB,c,t);case"GotoRoute":var d=e.a;return L(t,f(wy,t.key,d));case"Tick":var h=e.a;return L(U(t,{time:h}),uo);case"NetworkUpdate":var p=e.a,g=f(wo,xa,f(Jd,eS,p)),v=f(ag,Sa,Ql(g)),y=L(g,v);if("Ok"===y.a.$){if("Just"===y.b.$){var m=y.a.a,b=y.b.a;if($(m,Kg(t.web3Context.factoryType)))return L(t,uo);var C=Da(b),S=VE(C),E=S.a,T=S.b,w=f(Wy,C,t.submodel),I=w.a,A=w.b,B=w.c;return L(U(t,{submodel:I,tradeCache:E,web3Context:C}),oo(F([f(Dg,yT,T),function(){if("Just"===B.$){var e=B.a;return f(wy,t.key,e)}return A}()])))}y.b;return L(f(ei,kA,t),uo)}var k=y.a.a;return L(l(ma,ei,f(Xp,"Can't decode networkID from Javascript",k),t),uo);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(ei,AA,t),uo):L(t,Iy(vr));case"WalletStatus":var N=e.a,R=function(){var e=N.account;if("Nothing"===e.$)return uo;var t=e.a;return Ny(f(By,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 L(U(t,{userAddress:N.account}),R);case"UserPubkeySet":var x=e.a,_=f(Jd,Lo,x);if("Ok"===_.$){var P=_.a,D=t.userAddress;if("Just"===D.$){var O=D.a,M=ba({address:O,commPubkey:P}),V=f(jy,M,t.submodel),I=V.a,s=V.b;return L(U(t,{submodel:I,userInfo:M}),s)}return L(f(ei,f(Xp,"User pubkey set, but I can no longer find the user address!",Ca),t),uo)}var K=_.a;return L(l(ma,ei,f(Xp,"error decoding commPubkey from JS",K),t),uo);case"CreateMsg":var H=e.a,j=t.submodel;if("CreateModel"===j.$){var q=j.a,G=f(Rg,H,q),z=f(Mg,t.txSentry,f(Vg,Oy,G.chainCmd)),Y=z.a,W=z.b;return f(fB,f(Mf,Oy,G.appCmds),L(U(t,{submodel:Uy(G.model),txSentry:Y}),oo(F([f(Dg,Oy,G.cmd),W]))))}return L(t,uo);case"QuickCreateMsg":var J=e.a,Q=t.submodel;if("QuickCreateModel"===Q.$){var X=Q.a,G=f(Kv,J,X),Z=f(Mg,t.txSentry,f(Vg,Vy,G.chainCmd)),Y=Z.a,W=Z.b;return f(fB,f(Mf,Vy,G.appCmds),L(U(t,{submodel:Fy(G.model),txSentry:Y}),oo(F([f(Dg,Vy,G.cmd),W]))))}return L(t,uo);case"TradeMsg":var ee=e.a,te=t.submodel;if("TradeModel"===te.$){var re=te.a,G=f(_E,ee,re),ne=f(Mg,t.txSentry,f(Vg,Hy,G.chainCmd)),Y=ne.a,W=ne.b;return f(fB,f(Mf,Hy,G.appCmds),L(U(t,{submodel:Ky(G.model),txSentry:Y}),oo(F([f(Dg,Hy,G.cmd),W]))))}return L(t,uo);case"MarketplaceMsg":var ae=e.a,ie=t.submodel;if("MarketplaceModel"===ie.$){var oe=ie.a,G=f(mv,ae,oe);return f(fB,f(Mf,vT,G.appCmds),L(U(t,{submodel:My(G.model)}),f(Dg,vT,G.cmd)))}return L(t,uo);case"AgentHistoryMsg":var ue=e.a,se=t.submodel;if("AgentHistoryModel"===se.$){var ce=se.a,G=f(Sf,ue,ce),fe=f(Mg,t.txSentry,f(Vg,dT,G.chainCmd)),Y=fe.a,W=fe.b;return f(fB,f(Mf,dT,G.appCmds),L(U(t,{submodel:Dy(G.model),txSentry:Y}),oo(F([f(Dg,dT,G.cmd),W]))))}return L(t,uo);case"TxSentryMsg":var le=e.a,de=f(rB,le,t.txSentry),I=de.a,he=de.b;return L(U(t,{txSentry:I}),he);case"TradeCacheMsg":var pe=e.a,G=f(lT,pe,t.tradeCache);return L(U(t,{tradeCache:G.tradeCache}),f(Dg,yT,G.cmd));case"NoOp":return L(t,uo);default:var K=e.a;f(Rl,"test",K);return L(t,uo)}}),dB=r(function(e,t){return f(sB,t,Ey(e))}),hB={$:"AllGood"},pB={$:"NoWeb3"},gB=function(e){return{$:"TxSentryMsg",a:e}},vB={$:"WrongNetwork"},yB={mainParagraphs:F([F([Qp("No web3 provider detected. Is "),f(mA,F([IA(l(CA,0,0,1))]),{label:Qp("Metamask"),url:"https://metamask.io/"}),Qp(" or some other web3 provider installed and unlocked?")])]),noticeType:rg},mB={mainParagraphs:F([F([Qp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:rg},bB=n(function(e,t,r){var n=e.a,a=e.b;return xg({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Eh})}),CB=n(function(e,t,r){var n=e.width<1024?ba(mB):Ca,a=function(){if(e.networkId){var t=La(e.networkId);if("Nothing"===t.$)return L(la(da),vB);return L(t.a,hB)}return L(la(da),pB)}(),i=a.a,o=a.b,u=Da(i),s=VE(u),c=s.a,d=s.b,h=l(bB,L(ao,ro),gB,u.httpProvider),p=function(){switch(o.$){case"NoWeb3":return ba(yB);case"WrongNetwork":return ba(kA);default:return Ca}}(),g=XC(F([n,p])),v=f(dB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:pT,time:Kf(0),tradeCache:c,txSentry:h,userAddress:Ca,userInfo:Ca,userNotices:mr,web3Context:u}),y=v.a,m=v.b;return L(f(ti,g,y),oo(F([f(Dg,yT,d),m])))}),SB=ze("networkSentryPort",to),EB=Me,TB=EB(mr),wB=function(e){return TB},IB=function(e){return{$:"Refresh",a:e}},AB=r(function(e,t){return{$:"Every",a:e,b:t}}),BB=r(function(e,t){return{processes:t,taggers:e}}),kB=Zh(f(BB,Eh,Eh)),NB=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(_(c,r)<0){var p=r,g=n,v=L(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return _(c,r)>0?L(o,l(a,r,n,u)):L(h,d(t,c,f,n,u))}return L(o,l(a,r,n,u))}}),c=l(IE,s,L(ja(i),u),o),f=c.a,h=c.b;return l(Wa,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),RB=Re,$B=r(function(e,t){var r=e.a,n=e.b,a=f(Th,r,t);if("Nothing"===a.$)return l(Nh,r,F([n]),t);var i=a.a;return l(Nh,r,f(za,n,i),t)}),xB=ke,_B=r(function(e,t){return{$:"Zone",a:e,b:t}}),LB=fa,PB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=xB(f(LB,n,f(Vh,e,n)));return f(up,function(t){return l(PB,e,a,l(Nh,n,t,r))},i)}return Zh(r)}),DB=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 P(n,a,f(up,function(e){return i},RB(t)))}),u=l(Wa,$B,Eh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(za,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(a,l(Nh,e,r,i),o)}),d=p(NB,s,c,o,u,i,P(mr,Eh,Zh(vr))),h=d.a,g=d.b,v=d.c;return f(up,function(e){return Zh(f(BB,u,e))},f(up,function(t){return l(PB,e,h,g)},v))}),UB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Kf),OB=n(function(e,t,r){var n=f(Th,t,r.taggers);if("Nothing"===n.$)return Zh(r);var a=n.a,i=function(t){return lp(f(nu,function(r){return f(Fh,e,r(t))},a))};return f(up,function(e){return Zh(r)},f(up,i,UB))}),MB=r(function(e,t){var r=t.a,n=t.b;return f(AB,r,f(Af,e,n))});gn.Time=De(kB,DB,OB,0,MB);var FB=Oe("Time"),VB=r(function(e,t){return FB(f(AB,e,t))}),KB=function(e){return f(VB,2e3,IB)},HB=function(e){return TB},jB=function(e){return{$:"Refresh",a:e}},qB=function(e){return f(VB,2e3,jB)},GB=function(e){return{$:"DecryptionFinished",a:e}},zB=ze("decryptionFinished",to),YB=ze("encryptionFinished",to),WB=function(e){return{$:"EncryptionFinished",a:e}},JB=function(e){return{$:"Refresh",a:e}},QB=function(e){return EB(F([f(VB,3e3,JB),YB(WB),zB(function(e){return _S(GB(e))})]))},XB=mn,ZB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return TB;case"CreateModel":t.a;return f(XB,Oy,KB());case"QuickCreateModel":t.a;return f(XB,Vy,qB());case"TradeModel":t.a;return f(XB,Hy,QB());case"MarketplaceModel":t.a;return f(XB,vT,HB());default:t.a;return f(XB,dT,wB())}},ek=ze("userPubkeyResult",to),tk=ze("walletSentryPort",to),rk={$:"CheckForNewTrades"},nk=function(e){return f(VB,5e3,function(e){return rk})},ak=function(e){return{$:"NetworkUpdate",a:e}},ik=function(e){return{$:"Tick",a:e}},ok=function(e){return{$:"UserPubkeySet",a:e}},uk=function(e){return{$:"WalletStatus",a:e}},sk=function(e){return f(Xp,"Error decoding JS walletSentry: "+e,Ca)},ck=function(e){return{$:"ErrorDecoding",a:e}},fk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),lk=l(kf,r(function(e,t){return{ref:e,txHash:t}}),f(Fd,"ref",eS),f(Fd,"txHash",xA(gE))),dk=function(e){var t=f(Jd,lk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(fk,r.ref,Bi(a))}return f(fk,r.ref,Ai("Problem signing/broadcasting Tx. Ref #"+Gi(r.ref)))}t.a;return ck("Error decoding tx data")},hk=function(e){var t=e.a;return f(XB,t.tagger,t.inPort(dk))},pk=f(Bf,xa,eS),gk=Do(f(_a,il,f(_a,Pl("Failure decoding stringy int"),wo(xa)))),vk=aE(F([gk,pk])),yk=r(function(e,t){return{account:e,networkId:t}}),mk=l(kf,yk,f(Fd,"account",xA(sE)),f(Fd,"networkId",vk)),bk=n(function(e,t,r){var n=f(Jd,mk,r);if("Err"===n.$){var a=n.a;return e(Zi(a))}return t(n.a)}),Ck=function(e){var t=f(_a,sk,f(_a,Tf,hT));return EB(O(F([f(VB,1e3,ik),tk(f(bk,t,uk)),hk(e.txSentry),ek(ok),f(XB,yT,nk(e.tradeCache)),SB(ak)]),F([ZB(e)])))},Sk=function(e){return{$:"LinkClicked",a:e}},Ek=function(e){return{$:"UrlChanged",a:e}},Tk=n(function(e,t,r){return d(bA,e/255,t/255,r/255,1)}),wk=l(Tk,10,33,108),Ik={$:"Generic"},Ak=Ik,Bk=r(function(e,t){return d(vA,xT,Ak,f(za,BT(IT),f(za,TT(IT),e)),RT(F([t])))}),kk=function(e){return{$:"Fill",a:e}},Nk=kk(1),Rk=$f,$k=function(e){return{$:"Px",a:e}},xk=$k,_k=iw(8),Lk=function(e){return f(TA,_k,l(EA,"bg-"+wA(e),"background-color",e))},Pk=f(Bk,F([BT(Nk),TT(xk(150)),Lk(wk)]),Rk),Dk=function(e){return{$:"GotoRoute",a:e}},Uk={$:"Active"},Ok={$:"Important"},Mk={$:"Normal"},Fk=l(CA,1,1,1),Vk=iw(2),Kk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Hk=r(function(e,t){return $(e,t)?f(TA,Vk,h(Kk,"p-"+Gi(e),e,e,e,e)):f(TA,Vk,h(Kk,"p-"+Gi(e)+"-"+Gi(t),t,e,t,e))}),jk=iw(21),qk=r(function(e,t){return{$:"Class",a:e,b:t}}),Gk=f(qk,jk,DT.cursorPointer),zk=iw(17),Yk=function(e){return f(TA,zk,l(JI,"br-"+Gi(e),"border-radius",Gi(e)+"px"))},Wk=function(e){return{$:"Normal",a:e}},Jk=Kn,Qk=r(function(e,t){return f(Jk,e,Wk(t))}),Xk=function(e){return f(Qk,"click",Po(e))},Zk=f(Af,kT,Xk),eN=iw(13),tN=f(qk,eN,DT.textSemiBold),rN=iw(4),nN=function(e){return{$:"FontSize",a:e}},aN=function(e){return f(TA,rN,nN(e))},iN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Yk(4),Lk(l(CA,0,0,1))]);default:return F([Yk(4),Lk(l(CA,.9,0,0))])}}();return f(Bk,O(F([f(Hk,23,12),aN(22),tN,IA(Fk),Gk,Zk(t)]),n),Qp(e))}),oN=l(Tk,244,0,103),uN=function(e){return{$:"AlignX",a:e}},sN={$:"CenterX"},cN=uN(sN),fN=iw(3),lN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),dN=r(function(e,t){return"spacing-"+Gi(e)+"-"+Gi(t)}),hN=function(e){return f(TA,fN,l(lN,f(dN,e,e),e,e))},pN=function(e){return{$:"Describe",a:e}},gN={$:"Paragraph"},vN=r(function(e,t){return d(vA,WT,Ak,f(za,pN(gN),f(za,BT(Nk),f(za,hN(5),e))),RT(t))}),yN=f(qk,eN,DT.bold),mN=f(Bk,F([aN(29),IA(Fk),yN,cN,Gk,Zk(Dk(Jv))]),f(vN,mr,F([Qp("DAI"),f(Bk,F([IA(oN)]),Qp("Hard"))]))),bN=function(e){var t=e.web3Context.factoryType;if("Native"!==t.$){if("EthDai"===t.a.$){t.a;return"Mainnet Dai"}t.a;return"Testnet Dai"}switch(t.a.$){case"Eth":t.a;return"Mainnet ETH";case"Kovan":t.a;return"Testnet ETH";case"Rootstock":t.a;return"Rootstock SBTC";case"RootstockTest":t.a;return"RskTest SBTC";default:t.a;return"xDai"}},CN=yA(DT.italic),SN=function(e){return f(Bk,F([aN(18),IA(l(CA,.8,.8,1)),tN,CN,cN]),Qp(bN(e)))},EN={$:"Right"},TN=uN(EN),wN={$:"AsColumn"},IN=wN,AN=r(function(e,t){return d(vA,IN,Ak,f(za,yA(DT.contentTop+" "+DT.contentLeft),f(za,TT(IT),f(za,BT(IT),e))),RT(t))}),BN={$:"AsRow"},kN=BN,NN=r(function(e,t){return d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY),f(za,BT(IT),f(za,TT(IT),e))),RT(t))}),RN=function(e){return f(NN,F([BT(Nk),hN(30),f(Hk,30,17)]),F([l(iN,"Buy "+Zf(e.web3Context.factoryType),Dk(Qv(ny)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ny)?Uk:Mk}return Mk}()),l(iN,"Sell "+Zf(e.web3Context.factoryType),Dk(Qv(Ff)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Ff)?Uk:Mk}return Mk}()),l(iN,"Create a New Offer",Dk(Wv),function(){return"CreateModel"===e.submodel.$?Uk:Mk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(iN,"My Trades",Dk(f(mf,r.address,Ff)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Uk:Mk}return Mk}())}return l(iN,"Connect to Wallet",gT,Ok)}(),f(AN,F([TN,hN(0),f(Hk,8,0)]),F([mN,SN(e)]))]))},$N=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ba(e.agentAddress))}},xN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},_N=function(e){return r(function(e,t){var r=f(fu,xN(e.state.phase),xN(t.state.phase));return $(r,Ua)?r:f(Hg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},LN=Er,PN=r(function(e,t){return f(_a,th(e),LN(t))}),DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=iw(20),FN=f(qk,MN,DT.clip),VN=kk,KN=function(e){return f(TA,Vk,h(Kk,"p-"+Gi(e),e,e,e,e))},HN=function(e){var t=e.a,r=e.b;return f(Bk,F([BT(VN(t)),TT(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,BT(Nk)]),r))},jN=f(qk,eN,DT.textMedium),qN=function(e){return f(Bk,F([jN,aN(17)]),Qp(e))},GN=function(e){return{$:"Poke",a:e}},zN=iw(33),YN={$:"Hover"},WN=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),JN=zn,QN=r(function(e,t){return{$:"Nearby",a:e,b:t}}),XN={$:"NoAttribute"},ZN=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),eR=r(function(e,t){switch(t.$){case"NoAttribute":return XN;case"Describe":var r=t.a;return pN(r);case"AlignX":var n=t.a;return uN(n);case"AlignY":var a=t.a;return DN(a);case"Width":var n=t.a;return AT(n);case"Height":var n=t.a;return ET(n);case"Class":var n=t.a,a=t.b;return f(qk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(TA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QN,u,f(Pf,e,s));case"Attr":var c=t.a;return kT(f(JN,e,c));default:var l=t.a,d=t.b;return f(ZN,l,d)}}),tR=function(e){return f(eR,dg,e)},rR=r(function(e,t){var r=t.a,n=t.b,a=tR(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(za,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(sA,n,o));default:return L(r,n)}}),nR=function(e){var t=l(Wa,rR,L(mr,pA),e),r=t.a,n=t.b;return f(za,QI(n),r)},aR=function(e){return f(TA,zN,f(WN,YN,nR(e)))},iR=a(function(e,t,r,n){return d(bA,e/255,t/255,r/255,n)}),oR=me,uR=r(function(e,t){return f(jn,e,oR(t))}),sR=uR("disabled"),cR=function(e){return f(qn,"tabIndex",Gi(e))},fR=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},lR=function(e){return f(Ed,fR,e)?XN:yA("focusable")},dR=function(e){return{$:"MayPreventDefault",a:e}},hR=r(function(e,t){return f(Jk,e,dR(t))}),pR=r(function(e,t){var r=function(r){return $(r,e)?Po(t):_o("Not the enter key")},n=f(xo,r,f(Fd,"key",Lo));return kT(f(hR,"keyup",f(Bf,function(e){return L(e,!0)},n)))}),gR=function(e){return f(pR,"Enter",e)},vR={$:"Button"},yR=r(function(e,t){var r=t.onPress,n=t.label;return d(vA,xT,Ak,f(za,BT(IT),f(za,TT(IT),f(za,yA(DT.contentCenterX+" "+DT.contentCenterY+" "+DT.seButton+" "+DT.noTextSelection),f(za,Gk,f(za,lR(e),f(za,pN(vR),f(za,kT(cR(0)),function(){if("Nothing"===r.$)return f(za,kT(sR(!0)),e);var t=r.a;return f(za,Zk(t),f(za,gR(t),e))}()))))))),RT(F([n])))}),mR=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(5),Yk(4),BT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,IA(l(Tk,16,7,234)),jN,aN(14)]),Qp("Poke")),onPress:ba(GN(e))})},bR=function(e){return{$:"TimeLeft",a:e}},CR=function(e){return{$:"TimeUp",a:e}},SR=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 Kf(0)}}),ER=r(function(e,t){return Kf(Yl(e)-Yl(t))}),TR=r(function(e,t){var r=f(SR,t.state.phase,t),n=f(ER,e,t.state.phaseStartTime),a=f(ER,r,n);return Yl(a)>0?bR(L(a,r)):CR(r)}),wR=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},IR=l(CA,0,0,0),AR=l(Tk,233,237,242),BR={$:"Behind"},kR=function(e){return f(QN,BR,e)},NR=r(function(e,t){var r=Bg(200*e),n=200-r,a=f(Bk,F([BT(VN(n))]),Rk),i=F([TT(xk(3)),Yk(20)]),o=f(Bk,O(i,F([BT(VN(r)),Lk(t)])),Rk),u=f(Bk,O(i,F([BT(Nk),Lk(AR)])),Rk);return f(NN,F([BT(Nk),kR(u)]),F([o,a]))}),RR=l(Tk,51,183,2),$R=function(e){return Yl(e)<0},xR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),_R=function(e){var t=Pp(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(xR,dC(t),dC(r),dC(n),dC(a))}(f(rc,L(hu(0),hu(0)),f(qu,n,hu(60))))}(f(rc,L(hu(0),hu(0)),f(qu,r,hu(3600))))}(f(rc,L(hu(0),hu(0)),f(qu,t,hu(86400))))},LR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!$R(a)){var u=r(function(e,t){return O(l(Xu,2,D("0"),Gi(e)),t)}),s=Yl(a)>0?i:o,c=_R(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(NN,O(F([hN(5)]),e),F([f(Bk,O(F([IA(h)]),t),Qp(f(u,c.days,"d"))),f(Bk,O(F([IA(d)]),t),Qp(f(u,c.hours,"h"))),f(Bk,O(F([IA(s)]),t),Qp(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Kf(0);e=p,t=g,n=v,a=y}}),PR=l(CA,1,1,0),DR=r(function(e,t){return Yl(e)/Yl(t)}),UR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(DR,o,u),c=(f(Bk,F([cN]),d(LR,mr,mr,L(a,i),o)),s<.1?oN:s<.2?PR:RR);return f(AN,O(F([hN(5)]),e),F([d(LR,F([cN]),t,L(a,i),o),f(NR,1-s,c)]))}),OR=a(function(e,t,r,n){var a=f(TR,e,t);if("TimeLeft"===a.$){var i=a.a,o=r&&f(DR,i.a,i.b)<.05?oN:IR;return d(UR,F([BT(Nk)]),F([aN(16)]),L(o,AR),i)}return f(AN,F([hN(4),BT(Nk)]),O(F([f(Bk,F([cN,aN(14)]),Qp(wR(t.state.phase)))]),n?F([f(Bk,F([cN]),mR(t.creationInfo.address))]):mr))}),MR=function(e){return{$:"JustImage",a:e}},FR=MR,VR=function(e){return l(Wa,r(function(e,t){var r=e.a,n=e.b;return l(Nh,r,n,t)}),Eh,e)}(f(nu,function(e){var t=e.a;return L(t,L(e.b,FR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},F([L("AUD","$"),L("CLP","$"),L("EUR","€"),L("IDR","Rp"),L("KRW","₩"),L("NZD","$"),L("RUB","₽"),L("TRY","₺"),L("BRL","R$"),L("CNY","¥"),L("GBP","£"),L("ILS","₪"),L("MXN","$"),L("PHP","₱"),L("SEK","kr"),L("TWD","NT$"),L("CAD","$"),L("CZK","Kč"),L("HKD","$"),L("INR","₹"),L("MYR","RM"),L("PKR","₨"),L("SGD","$"),L("USD","$"),L("CHF","Fr"),L("DKK","kr"),L("HUF","Ft"),L("JPY","¥"),L("NOK","kr"),L("PLN","zł"),L("THB","฿"),L("ZAR","R"),L("VND","₫")]))),KR=function(e){return f(rc,"",f(Gf,gi,f(Th,e,VR)))},HR=function(e){return yo(e)<=3?e:HR(f(Al,3,e))+","+f(Ao,3,e)},jR=function(e){return HR(Il(e))},qR=function(e){return O(KR(e.fiatType),jR(e.amount))},GR=mT("alt"),zR=function(e){return f(mT,"src",ot(e))},YR=r(function(e,t){var r=t.src,n=t.description,a=f(th,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(vA,xT,Ak,f(za,yA(DT.imageContainer),e),RT(F([d(vA,xT,NT("img"),O(F([kT(zR(r)),kT(GR(n))]),a),RT(mr))])))}),WR=r(function(e,t){if("None"===t.$)return Rk;var r=t.a;return f(YR,e,r)}),JR=bA,QR=function(e){var t=function(){var t=f(Th,e.fiatType,VR);if("Nothing"===t.$)return f(Bk,F([IA(oN)]),Qp("!"));var r=t.a,n=(r.a,r.b);return f(WR,F([TT(xk(26))]),n)}();return f(NN,F([hN(4)]),F([t,f(Bk,F([IA(d(JR,0,0,0,.5)),jN,BT(xk(50))]),Qp(e.fiatType)),Qp(qR(e))]))},XR=function(e){return QR(e)},ZR=function(e){return f(Bk,F([BT(Nk),TT(Nk),FN]),f(vN,F([aN(12)]),F([Qp(e.info)])))},e$=function(e){return f(rc,Rk,f(Gf,ZR,el(e)))},t$=MR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),r$=function(e){return f(WR,f(za,TT(xk(26)),e),t$)},n$=function(e){var t=Bl(qf(e)),r=f(tl,".",t);if(!r.b)return t;if(r.b.b){Rl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Eo,3,t);case 1:return f(Eo,4,f(rc,t,f(Gf,ww,f(Gf,function(e){return e/100},f(Gf,ii,f(Gf,Bg,f(Gf,bi(100),$l(t))))))));default:var n=r.a;return f(rc,f(Eo,n,t),f(Gf,Gi,f(Gf,Bg,$l(t))))}},a$=function(e){var t=n$(e);return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(16)]),Qp(t))]))},i$=function(e){return a$(e)},o$=function(e){return{$:"TradeClicked",a:e}},u$=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),BT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,IA(l(Tk,16,7,234)),jN]),Qp("View Offer")),onPress:ba(o$(e))})},s$=i(function(e,t,r,n,a){return f(NN,F([BT(Nk),hN(1)]),F([function(){switch(n.$){case"Open":return HN(L(2,d(OR,e,a,!1,t)));case"Committed":return HN(L(2,d(OR,e,a,$(r,ny),t)));case"Judgment":return HN(L(2,d(OR,e,a,$(r,Ff),t)));default:return Rk}}(),HN(L(1,i$(a.parameters.tradeAmount))),HN(L(2,XR(a.terms.price))),HN(L(6,e$(a.terms.paymentMethods))),HN(L(2,u$(a.id)))]))}),c$=iw(28),f$=function(e){return f(TA,c$,l(EA,"bc-"+wA(e),"border-color",e))},l$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),d$=function(e){return f(TA,lA,h(l$,"b-"+Gi(e),e,e,e,e))},h$=n(function(e,t,r){var n=function(){switch(r.viewPhase.$){case"Open":return"Expires in";case"Committed":return"Payment Due";case"Judgment":return"Auto-Release";default:return""}}(),a=function(){return"Buyer"===r.agentRole.$?"Buying":"Selling"}();return f(AN,F([BT(Nk),TT(Nk),f(Hk,30,10),hN(5)]),F([f(NN,F([BT(Nk)]),F([$(r.viewPhase,nC)?Rk:HN(L(2,qN(n))),HN(L(1,qN(a))),HN(L(2,qN("For Fiat"))),HN(L(6,qN("Payment Methods"))),HN(L(2,Rk))])),f(AN,F([BT(Nk),d$(1),Yk(8),f$(AR),hN(1),Lk(AR),FN]),f(nu,d(s$,e,!$(r.userInfo,Ca),r.agentRole,r.viewPhase),t))]))}),p$=n(function(e,t,r){return $(f(SS,e,r),ba(t))}),g$=l(Tk,150,150,150),v$=function(e){return f(th,function(e){return Cb(e.parameters)},zE(e))},y$=n(function(e,t,r){var n=l(PN,$N(r),_N(),v$(t)),a=f(th,function(e){return l(p$,e,r.agentRole,r.agentAddress)&&$(e.state.phase,r.viewPhase)},n),i=function(e){return f(Bk,F([aN(24),tN,IA(g$),cN,KN(20)]),Qp(e))},o=L(t.dataFetchStatus.total,a);if("Nothing"===o.a.$){o.a;return i("Querying Factory contract...")}if(o.a.a){if(o.b.b){var u=o.a.a;return l(h$,e,a,r)}var u=o.a.a;return i(_(t.dataFetchStatus.loaded,u-t.dataFetchStatus.invalid)<0?"Searching for user trades...":"No matching trades found.")}return i("No trades found.")}),m$=r(function(e,t){return f(Bk,F([Yk(4),Lk(d(JR,0,0,1,.1)),IA(l(Tk,16,7,234)),aN(e),tN,f(Hk,15,13)]),Qp(eh(t)))}),b$=a(function(e,t,r,n){return"pad-"+Gi(e)+"-"+Gi(t)+"-"+Gi(r)+"-"+Gi(n)}),C$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(TA,Vk,h(Kk,"p-"+Gi(t),t,t,t,t)):f(TA,Vk,h(Kk,d(b$,t,r,n,a),t,r,n,a))},S$=function(e){return function(){var t=e.userInfo;return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(Bk,F([f(Hk,30,10),aN(24),tN]),Qp("Your Trades")):f(NN,F([hN(10),C$({bottom:30,left:30,right:30,top:10})]),F([f(Bk,F([aN(24),tN]),Qp("Trade History for User")),f(m$,18,e.agentAddress)]))},E$=function(e){return{$:"ViewPhaseChanged",a:e}},T$=l(CA,0,0,1),w$=function(e){var t=F([aN(20),yN,Gk]),r=function(e){return e?O(t,F([IA(T$)])):t};return f(NN,F([hN(30)]),F([f(Bk,O(F([Zk(E$(io))]),r($(e,io))),Qp("Open")),f(Bk,O(F([Zk(E$(aC))]),r($(e,aC))),Qp("Payment Due")),f(Bk,O(F([Zk(E$(iC))]),r($(e,iC))),Qp("Release Due")),f(Bk,O(F([Zk(E$(nC))]),r($(e,nC))),Qp("Closed"))]))},I$=function(e){return f(Bk,F([f(Hk,30,10)]),w$(e.viewPhase))},A$=function(e){return{$:"ViewUserRoleChanged",a:e}},B$=d(iR,1,31,52,.13),k$=function(e){var t=F([aN(24),tN,Gk]),r=function(){return"Buyer"===e.$?L(t,O(t,F([IA(B$)]))):L(O(t,F([IA(B$)])),t)}(),n=r.a,a=r.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(A$(Ff))]),a),Qp("As the Seller")),f(Bk,O(F([Zk(A$(ny))]),n),Qp("As the Buyer"))]))},N$=function(e){return f(Bk,F([f(Hk,30,10)]),k$(e.agentRole))},R$=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),BT(Nk),TT(Nk),f(Hk,0,20)]),F([S$(r),N$(r),I$(r),l(y$,e,t,r)]))}),$$=function(e){return{$:"ShowCurrencyDropdown",a:e}},x$={$:"AbortCreate"},_$=r(function(e,t){return{$:"ConfirmCreate",a:e,b:t}}),L$=function(e){return f(nu,function(e){return F([f(Bk,F([IA(oN)]),Qp("Caution! ")),Qp(e)])},XC(F([$(f(Hg,e.autoreleaseInterval,Kf(12e5)),Oa)?ba(function(){return"Buyer"===e.initiatorRole.$?"That Release Window time is quite small! It might take a while to find a committed Seller.":"That Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing."}()):Ca,$(f(Hg,e.autoabortInterval,Kf(36e5)),Oa)?ba(function(){return"Buyer"===e.initiatorRole.$?'That Payment Window time is quite small! If you fail to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.':'That Payment Window time is quite small! If the Buyer fails to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.'}()):Ca])))},P$=function(e){return f(Bk,F([C$({bottom:5,left:5,right:5,top:0}),Zk(e),Yk(30),Lk(d(JR,1,1,1,.4)),d$(1),f$(d(JR,0,0,0,.3)),Gk,aN(14)]),f(Bk,F([IA(d(JR,0,0,0,.7))]),Qp("x")))},D$=Hn,U$=D$,O$=kT,M$=r(function(e,t){return f(Bk,F([kR(f(Bk,F([Lk(e),O$(f(U$,"position","fixed")),O$(f(U$,"z-index","1000")),O$(f(U$,"top","0")),O$(f(U$,"left","0")),O$(f(U$,"width","100%")),O$(f(U$,"height","100%"))]),Rk)),BT(Nk),TT(Nk)]),t)}),F$={$:"Top"},V$=DN(F$),K$={$:"InFront"},H$=function(e){return f(QN,K$,e)},j$=r(function(e,t){return{$:"Max",a:e,b:t}}),q$=r(function(e,t){return f(j$,e,t)}),G$=n(function(e,t,r){return l(ma,M$,d(JR,0,0,.3,.6),f(Bk,O(F([cN,ON,BT(f(q$,500,IT)),Lk(Fk),Yk(8),H$(f(Bk,F([TN,V$]),P$(r)))]),e),t))}),z$=r(function(e,t){if("Nothing"===t.$)return Rk;var r=t.a;return f(Bk,O(F([Yk(5),f$(l(CA,.9,0,0)),d$(1),Lk(l(CA,1,.4,.4)),KN(5),cN,ON,BT(f(q$,200,IT)),aN(14)]),e),f(vN,mr,F([Qp(r)])))}),Y$={$:"Above"},W$=function(e){return f(QN,Y$,e)},J$=iw(26),Q$=function(e){return{$:"MoveY",a:e}},X$=function(e){return f(ZN,J$,Q$(-e))},Z$=r(function(e,t){return f(Bk,F([Yk(4),f(Hk,25,17),aN(18),tN,Lk(AR),W$(f(z$,F([X$(5)]),t))]),Qp(e))}),ex=d(iR,1,31,52,.64),tx=iw(32),rx={$:"Active"},nx=function(e){return f(TA,tx,f(WN,rx,nR(e)))},ax=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Bk,F([Yk(4),Gk,Zk(n),f(Hk,25,17),IA(t),aN(18),tN,Lk(a),nx(F([Lk(o)])),aR(F([Lk(i)]))]),Qp(r))}),ix=r(function(e,t){return d(ax,P(d(JR,1,0,0,1),d(JR,1,0,0,.8),d(JR,1,0,0,.6)),Fk,e,t)}),ox=iw(12),ux=f(qk,ox,DT.textCenter),sx=function(e){return M$(d(JR,0,0,.3,.6))(f(AN,F([hN(10),cN,ON,Lk(d(JR,0,0,0,.5)),Yk(8),KN(20)]),f(nu,function(e){return f(vN,F([cN,ON,aN(20),tN,IA(Fk),ux]),F([e]))},e)))},cx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+LA(t)}e.a;return"https://kovan.etherscan.io/tx/"+LA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+LA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+LA(t);case"XDai":e.a;return"https://blockscout.com/poa/dai/tx/"+LA(t);case"Rootstock":e.a;return"https://explorer.rsk.co/tx/"+LA(t);default:e.a;return""}}),fx={$:"Bottom"},lx=DN(fx),dx=yA(DT.underline),hx=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=Zf(t.web3Context.factoryType),a=function(){var e=t.depositAmount;if("Just"===e.$){var n=e.a;return L(Qp(n$(Vv(n))),f(ix,"Yes, I definitely want to open this trade.",f(_$,r,n)))}return L(Qp("??"),f(Z$,"(loading exact fees...)",Ca))}(),i=a.a,o=a.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,TT(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Qp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(nu,vN(F([cN,aN(18),jN,IA(ex)])),O(L$(r),O(F([F([Qp("You will deposit "),i,Qp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Qp("This ususally requires two Metamask signatures. Your "+n+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(Bk,F([lx,cN]),o)])),x$);case"ApproveNeedsSig":return sx(F([Qp("Waiting for user signature for the approve call."),Qp("(check Metamask!)"),Qp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var r=e.a,u=e.b;return sx(F([Qp("Mining the initial approve transaction..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Qp("Funds will not leave your wallet until you sign the next transaction.")]));case"CreateNeedsSig":return sx(F([Qp("Waiting for user signature for the create call."),Qp("(check Metamask!)")]));default:var u=e.a;return sx(F([Qp("Mining the final create call..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Qp("You will be redirected when it's mined.")]))}}),px=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;var r=t.a;return f(hx,r,e)},gx=function(e){return{$:"TradeAmountChanged",a:e}},vx=mT("id"),yx=O$(vx("inputError")),mx=l(Tk,109,127,138),bx=function(e){return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(24),jN,IA(mx)]),Qp(Zf(e)))]))},Cx={$:"Left"},Sx=uN(Cx),Ex=function(e){return{$:"HiddenLabel",a:e}},Tx=Ex,wx=mT("type"),Ix=function(e){return L(e,!0)},Ax=function(e){return{$:"MayStopPropagation",a:e}},Bx=r(function(e,t){return f(Jk,e,Ax(t))}),kx=r(function(e,t){return l(Xa,Fd,t,e)}),Nx=f(kx,F(["target","value"]),Lo),Rx=function(e){return f(Bx,"input",f(Bf,Ix,f(Bf,e,Nx)))},$x=iw(0),xx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),_x=function(e){var t=function(e){return 1-e}(f(qs,1,f(mi,0,e)));return f(TA,$x,f(xx,"transparency-"+mw(t),t))},Lx=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),Px=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(vA,IN,NT("label"),e,RT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(vA,xT,Ak,a,RT(F([i])));switch(n.$){case"Above":return d(vA,IN,NT("label"),e,RT(F([o,r])));case"Below":return d(vA,IN,NT("label"),e,RT(F([r,o])));case"OnRight":return d(vA,kN,NT("label"),e,RT(F([r,o])));default:return d(vA,kN,NT("label"),e,RT(F([o,r])))}}),Dx=FI,Ux=f(Af,kT,Dx("autocomplete")),Ox=l(CA,136/255,138/255,133/255),Mx=l(CA,186/255,189/255,182/255),Fx=f(Hk,12,12),Vx=l(CA,1,1,1),Kx=F([Fx,Yk(3),f$(Mx),Lk(Vx),d$(1),hN(3),BT(Nk)]),Hx=function(e){return{$:"Label",a:e}},jx=function(e){if("HiddenLabel"===e.$){var t=e.a;return pN(Hx(t))}return XN},qx=function(e){e:for(;;){if("StyleClass"!==e.$)break e;switch(e.b.$){case"PaddingStyle":e.b;return!0;case"BorderWidth":e.b;return!0;case"Transform":return!0;default:break e}}return!1},Gx=function(e){return"HiddenLabel"===e.$},zx=uR("spellcheck"),Yx=f(Af,kT,zx),Wx=J,Jx=iw(47),Qx=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Fi(Wx(e))),o=(i-1)*t+f(rc,0,f(Gf,a,r))+f(rc,0,f(Gf,a,n));return f(TA,Jx,l(JI,"textarea-height-"+Gi(i),"height",function(e){return"calc("+Gi(e)+"em + "+Gi(o)+"px) !important"}(i)))}),Xx=mT("value"),Zx=f(Af,kT,Xx),e_={$:"LivePolite"},t_=pN(e_),r_=function(e){return l(Xa,r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"NoAttribute":return L(r,n);case"Class":e.a;return L(f(za,e,r),n);case"Attr":e.a;return L(f(za,e,r),n);case"StyleClass":e.b;return L(f(za,e,r),n);case"Width":e.a;return f(vw,"width",n)?L(r,n):L(f(za,e,r),f(NE,"width",n));case"Height":e.a;return f(vw,"height",n)?L(r,n):L(f(za,e,r),f(NE,"height",n));case"Describe":e.a;return f(vw,"described",n)?L(r,n):L(f(za,e,r),f(NE,"described",n));case"Nearby":e.a,e.b;return L(f(za,e,r),n);case"AlignX":return f(vw,"align-x",n)?L(r,n):L(f(za,e,r),f(NE,"align-x",n));case"AlignY":return f(vw,"align-y",n)?L(r,n):L(f(za,e,r),f(NE,"align-y",n));default:return f(vw,"transform",n)?L(r,n):L(f(za,e,r),f(NE,"transform",n))}}),L(mr,bm),e).a},n_=r(function(e,t){return l(Xa,r(function(e,r){return t(e)?f(za,e,r):r}),mr,r_(e))}),a_=function(e){e:for(;;)switch(e.$){case"Content":return!0;case"Max":case"Min":var t=e.b,r=t;e=r;continue e;default:return!1}},i_=f(Af,Lf,Fu),o_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([kT(Rx(n.onChange))]),o=O(Kx,t),u=f(n_,o,function(e){e:for(;;)switch(e.$){case"Width":case"Height":if("Fill"===e.a.$)return!0;break e;case"AlignX":case"AlignY":return!0;case"StyleClass":switch(e.b.$){case"SpacingStyle":e.b;return!0;case"FontSize":return!0;case"FontFamily":e.b;return!0;default:break e}default:break e}return!1}),s=f(th,qx,o),c=f(n_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(n_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(n_,o,function(e){return"Nearby"===e.$})),p=f(th,f(Af,Iu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([Zx(n.text),kT(wx(a)),Yx(e.spellchecked),yA(DT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return XN;var r=t.a;return Ux(r)}()]),p),mr)}var i=l(Xa,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes),heightContent:ba(a_(r))}):t;case"StyleClass":switch(e.b.$){case"BorderWidth":var a=e.b,i=a.b,o=a.c,u=a.d,s=a.e,c=t.maybeBorder;return"Nothing"===c.$?U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes),maybeBorder:ba(d(Lx,i,o,u,s))}):t;case"PaddingStyle":var l=e.b,i=l.b,o=l.c,u=l.d,s=l.e,h=t.maybePadding;return"Nothing"===h.$?U(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:ba(d(Lx,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes),maybeSpacing:ba(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:Ca,maybeBorder:Ca,maybePadding:Ca,maybeSpacing:Ca},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(rc,5,c);return P("textarea",O(F([Yx(e.spellchecked),yA(DT.inputMultiline),f(rc,XN,f(Gf,Ux,e.autofill)),function(){if("Nothing"===u.$)return XN;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return C$({bottom:f(mi,0,n-(v/2|0)),left:a,right:r,top:f(mi,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?XN:s.a?d(Qx,n.text,v,u,g):XN}()]),h),F([i_(DI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(vA,xT,Ak,f(za,BT(Nk),sy(F([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return mr;var t=e.a,r=t.a,a=t.b;return F([H$(f(Bk,f(za,Fx,O(s,O(F([IA(Ox),yA(DT.noTextSelection+" "+DT.passPointerEvents),f$(d(JR,0,0,0,0)),Lk(d(JR,0,0,0,0)),TT(Nk),BT(Nk),_x(""===n.text?1:0)]),r))),a))])}()]))),RT(F([d(vA,xT,NT(v),sy(F([F([lR(t),jx(n.label)]),y,i])),RT(m))])));return l(Px,f(za,f(qk,jk,DT.cursorText),f(za,Gx(n.label)?XN:hN(5),f(za,t_,u))),n.label,b)}),u_=o_({autofill:Ca,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),s_=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(u_,F([BT(Nk),TT(xk(40)),d$(0)]),{label:Tx(r),onChange:i,placeholder:n,text:a});return f(NN,O(F([hN(5)]),e),XC(F([f(Gf,Bk(F([Sx])),o),ba(s),f(Gf,Bk(F([TN])),u)])))}),c_={$:"Below"},f_=function(e){return f(QN,c_,e)},l_=function(e){return f(ZN,J$,Q$(e))},d_=n(function(e,t,r){return p(s_,F([BT(xk(150)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),r))]),L(Ca,ba(bx(e))),"dai input",Ca,t,gx)}),h_=r(function(e,t){return f(TA,lA,h(l$,"b-"+Gi(e)+"-"+Gi(t),t,e,t,e))}),p_=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?d$(r):f(h_,n,r):f(TA,lA,h(l$,"b-"+Gi(r)+"-"+Gi(a)+"-"+Gi(t)+"-"+Gi(n),r,a,t,n))},g_=Bk(F([f$(AR),p_({bottom:2,left:0,right:0,top:0})])),v_=r(function(e,t){return f(AN,F([hN(10)]),F([f(Bk,F([aN(17),tN]),Qp(e)),t]))}),y_=function(e){return g_(f(v_,function(){return"Buyer"===e.inputs.userRole.$?"You're buying":"You're selling"}(),l(d_,e.web3Context.factoryType,e.inputs.daiAmount,e.errors.daiAmount)))},m_=function(e){var t=function(){var t=bl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Yf,r,100))+" "+Zf(e.web3Context.factoryType)+"."}return"There is a 1% fee."}();return f(NN,F([cN,f(Hk,20,10),Lk(l(Tk,10,33,108)),Yk(8),hN(5)]),F([f(Bk,F([aN(18),IA(l(Tk,0,226,255)),tN]),Qp(t)),f(Bk,F([aN(17),IA(Fk),jN]),Qp("We only collect this fee when trades resolve successfully."))]))},b_=function(e){return{$:"FiatAmountChanged",a:e}},C_=function(e){return{$:"FiatTypeChanged",a:e}},S_=r(function(e,t){return l(IE,n(function(t,r,n){return f(e,t,r)?l(Nh,t,r,n):n}),Eh,t)}),E_=function(e){return f(S_,r(function(t,r){return f(vg,e,t)}),VR)},T_=MR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),w_=function(e){return f(WR,F([TT(xk(26))]),f(rc,T_,f(Gf,Ro,f(Th,e,VR))))},I_=function(e){return O$(f(Bx,"click",Po(L(e,!0))))},A_=i_,B_=function(e){return{$:"AppendProperty",a:e}},k_=r(function(e,t){return B_(e+":"+t)}),N_=r(function(e,t){return f(k_,e,t.value)}),R_=N_("cursor"),$_={$:"Compatible"},x_={cursor:$_,value:"default"},__=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),L_=function(e){return{$:"PseudoClassSelector",a:e}},P_=function(e){return __(L_(e))}("hover"),D_=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),U_=D_,O_=U_,M_=O_("span"),F_=r(function(e,t){return f(jn,at(e),ot(t))}),V_=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),K_=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),H_=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),j_=r(function(e,t){return t<>>32-e}),q_=function(e){var t=e.hash?e.seed^f(H_,461845907,f(j_,15,f(H_,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(H_,2246822507,r^r>>>16),a=f(H_,3266489909,n^n>>>13);return(a^a>>>16)>>>0},G_=r(function(e,t){return f(H_,5,f(j_,13,e^f(H_,461845907,f(j_,15,f(H_,3432918353,t)))))+3864292196}),z_=r(function(e,t){var r=t.hash|(255&Li(e))<";default:return""}},tP=function(e){switch(e.$){case"ClassSelector":var t=e.a;return"."+t;case"IdSelector":var t=e.a;return"#"+t;case"PseudoClassSelector":var t=e.a;return":"+t;default:var t=e.a;return"["+t+"]"}},rP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(zi,"",f(za,t,f(nu,tP,r)));case"UniversalSelectorSequence":var r=e.a;return Go(r)?"*":f(zi,"",f(nu,tP,r));default:var t=e.a,r=e.b;return f(zi,"",f(za,t,f(nu,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(zi," ",F([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(za,rP(t),f(nu,nP,r)),i=f(zi,"",F([f(rc,"",f(Gf,ZL,n))]));return f(ks,f(zi," ",f(th,f(Af,Iu,Dl),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(zi,", ",f(nu,aP,f(za,r,n)));return f(zi,"",F([i," {\n",e,XL(a),"\n",e,"}"]))}),oP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(iP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(zi,",\n",f(nu,GL,r))+" {\n"+f(zi,"\n\n",f(nu,f(Af,JL,iP(" ")),n))+"\n}";case"SupportsRule":case"DocumentRule":case"PageRule":case"FontFace":return"TODO";case"Keyframes":return"@keyframes "+e.a.name+" {\n"+e.a.declaration+"\n}";case"Viewport":case"CounterStyle":default:return"TODO"}},uP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(zi,"\n\n",f(th,f(Af,Iu,Dl),F([HL(t),f(zi,"\n",f(nu,YL,r)),f(zi,"\n",f(nu,WL,n)),f(zi,"\n\n",f(nu,oP,a))])))},sP=function(e){return uP(KL(ML(e)))},cP=function(e){return f(zi,"\n\n",f(nu,sP,e))},fP=function(e){return{$:"Snippet",a:e}},lP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),dP=function(e){return{$:"StyleBlockDeclaration",a:e}},hP=r(function(e,t){var r=l(dL,t,mr,Ca);return fP(F([dP(l(lP,r,mr,e))]))}),pP=function(e){return Go(e)?"unstyled":f(zu,D("_"),ns(f(Y_,15739,cP(xE(W_(xE(f(hP,e,wL(mr)))))))))},gP=function(e){var t=pP(e),r=f(F_,"className",Yd(t));return l(V_,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(za,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(Nw(e))},bP=mP,CP=r(function(e,t){return f(Mn,e,rt(t))}),SP=function(e){return Un(rt(e))},EP=r(function(e,t){var r=e.b,n=e.c;return Go(r)?t:l(Nh,n,r,t)}),TP=function(e){return e.a},wP=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;switch(n.$){case"Unstyled":var o=n.a;return L(f(za,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Wa,EP,i,s),p=l(Wa,IP,L(mr,h),c),g=p.a,v=p.b,o=l(rw,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Wa,EP,i,s),m=l(Wa,IP,L(mr,h),c),g=m.a,v=m.b,o=d(SP,y,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Wa,EP,i,s),b=l(Wa,wP,L(mr,h),c),g=b.a,v=b.b,o=l(tw,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Wa,EP,i,s),C=l(Wa,wP,L(mr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v)}}),IP=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(za,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Wa,EP,n,o),c=l(Wa,IP,L(mr,s),u),h=c.a,p=c.b,a=l(rw,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Wa,EP,n,o),v=l(Wa,IP,L(mr,s),u),h=v.a,p=v.b,a=d(SP,g,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Wa,EP,n,o),y=l(Wa,wP,L(mr,s),u),h=y.a,p=y.b,a=l(tw,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Wa,EP,n,o),m=l(Wa,wP,L(mr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p)}}),AP=r(function(e,t){return h(Ih,wh,e,t,Sh,Sh)}),BP=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Dl(a)){var o=e,u=i;e=o,t=u}else{var o=ba(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,Ca,e);if("Nothing"===t.$)return Eh;var r=t.a,n=r.a,a=r.b;return f(AP,n,a)},NP=function(e){return{$:"ClassSelector",a:e}},RP=function(e){var t=e.a,r=e.b;return f(hP,r,wL(F([NP(t)])))},$P=function(e){return cP(xE(W_(f(nu,RP,ja(e)))))},xP=function(e){return l(rw,"style",mr,xE(Nw($P(e))))},_P=n(function(e,t,r){var n=f(nu,TP,t),a=kP(t),i=l(Wa,IP,L(mr,a),r),o=i.a,u=i.b,s=xP(u);return l(rw,e,n,f(za,s,Ja(o)))}),LP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if($(e,n))return!0;var i=e,o=a;e=i,t=o}}),PP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(LP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),DP=r(function(e,t){return L(f(PP,"_",t),xP(e))}),UP=n(function(e,t,r){var n=f(nu,TP,t),a=kP(t),i=l(Wa,wP,L(mr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(tw,e,n,f(za,s,Ja(o)))}),OP=a(function(e,t,r,n){var a=f(nu,TP,r),i=kP(r),o=l(Wa,wP,L(mr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(za,c,Ja(u)))}),MP=a(function(e,t,r,n){var a=f(nu,TP,r),i=kP(r),o=l(Wa,IP,L(mr,i),n),u=o.a,s=o.b,c=xP(s);return d(SP,e,t,a,f(za,c,Ja(u)))}),FP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(_P,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(MP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(UP,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(OP,a,t,r,n)}},VP=FP,KP=function(e){return A_(VP(d(vP,M_,F([P_(F([R_(x_)]))]),mr,F([bP(e)]))))},HP=Q,jP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),qP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),GP=function(e){return l(Xa,r(function(e,t){var r=t.a,n=t.b;return L(function(){if("Just"===r.$){r.a;return r}if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=e.b,n=t.a,a=t.b,i=t.c,o=t.d,u=t.e;return ba(h(jP,n,a,i,o,u))}return Ca}(),function(){if("Just"===n.$){var t=n.a;return n}if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,a=r.a,t=r.b,i=r.c;return ba(l(qP,a,t,i))}return Ca}())}),L(Ca,Ca),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY+" "+DT.wrapped),f(za,BT(IT),f(za,TT(IT),e))),RT(t));var i=a.a,o=i.a,u=i.b,s=i.c,c=function(){if("Just"===n.$){var e=n.a,t=(e.a,e.b),r=e.c,a=e.d,i=e.e;return _(r,u/2|0)>-1&&_(a,s/2|0)>-1?ba(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):Ca}return Ca}();if("Just"===c.$){var h=c.a;return d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY+" "+DT.wrapped),f(za,BT(IT),f(za,TT(IT),O(e,F([h]))))),RT(t))}var p=-s/2,g=-u/2;return d(vA,xT,Ak,e,RT(F([d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY+" "+DT.wrapped),f(za,kT(f(U$,"margin",ww(p)+"px "+ww(g)+"px")),f(za,kT(f(U$,"width","calc(100% + "+Gi(u)+"px)")),f(za,kT(f(U$,"height","calc(100% + "+Gi(s)+"px)")),f(za,f(TA,fN,l(lN,o,u,s)),mr))))),RT(t))])))}),YP=a(function(e,t,r,n){var a=f(u_,F([BT(xk(80)),TT(xk(40)),aN(24),jN,f$(AR),I_(r)]),{label:Tx("currency type"),onChange:f(_a,HP,n),placeholder:Ca,text:t}),i=f(Th,t,VR),o=function(){var r=L(e,i);if(r.a){if("Just"===r.b.$)return Rk;r.b;return f(zP,F([BT(xk(350)),f$(IR),d$(1),Lk(Fk),KN(10),cN]),f(nu,function(e){var t=e.a,r=e.b,a=r.b;return f(NN,F([BT(xk(80)),hN(9),f(Hk,0,5),I_(n(t)),aR(F([Lk(l(CA,.8,.8,1))]))]),F([f(WR,F([TT(xk(26))]),a),f(Bk,F([aN(16),tN]),KP(t))]))},ja(E_(t))))}return Rk}();return f(NN,F([hN(4),f_(o)]),F([w_(t),a]))}),WP=i(function(e,t,r,n,a){var i=Qp(KR(e)),o=f(Bk,F([f_(f(z$,F([yx,l_(5)]),a))]),d(YP,r,e,$$(!0),C_));return p(s_,F([BT(xk(250)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),n))]),L(ba(i),ba(o)),"fiat input",Ca,t,b_)}),JP=function(e){return g_(f(v_,"For fiat",h(WP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},QP=function(e){return{$:"ChangeRole",a:e}},XP=r(function(e,t){var r=F([aN(24),jN,Gk]),n=function(){return"Buyer"===t.$?L(r,O(r,F([IA(B$)]))):L(O(r,F([IA(B$)])),r)}(),a=n.a,i=n.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(QP(Ff))]),i),Qp("Sell "+Zf(e))),f(Bk,O(F([Zk(QP(ny))]),a),Qp("Buy "+Zf(e)))]))}),ZP=function(e){return f(v_,"Trade Type",f(XP,e.web3Context.factoryType,e.inputs.userRole))},eD=iw(19),tD=function(e){return Tl(F([e.inset?"box-inset":"box-",ww(e.offset.a)+"px",ww(e.offset.b)+"px",ww(e.blur)+"px",ww(e.size)+"px",wA(e.color)]))},rD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(TA,eD,l(JI,tD(t),"box-shadow",Aw(t)))},nD=rD({blur:20,color:d(iR,0,0,0,.04),offset:L(0,3),size:0}),aD=f(qk,fN,DT.spaceEvenly),iD=function(e){return f(AN,F([BT(Nk),hN(20),Lk(Fk),Yk(5),KN(20),nD]),F([f(NN,F([BT(Nk),aD]),F([ZP(e),y_(e),JP(e)])),m_(e)]))},oD=function(e){return{$:"CreateClicked",a:e}},uD={$:"Web3Connect"},sD=function(e){return f(Bk,F([cN]),function(){if("Just"===e.$){var t=e.a;return f(ix,"Open Trade",oD(t))}return f(ix,"Connect to Wallet",uD)}())},cD=function(e){return{$:"AutoabortIntervalChanged",a:e}},fD=function(e){return{$:"ChangePaymentMethodText",a:e}},lD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),dD=lD,hD=function(e){return f(dD,mr,function(){return Qp("Seller"===e.$?"Some examples:\n\nI can accept transfers to a Schwab bank account (routing 121202211)\nI can meet in person to accept cash in London, weekdays after 6, with a day of notice.\nHide the cash in Hume Park, Bulawayo, and tell me the location over chat.":"Some examples:\n\nI can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice.\nTransferWise\nInterac e-Transfer\n")}())},pD={$:"TextArea"},gD=r(function(e,t){return l(o_,{autofill:Ca,spellchecked:t.spellcheck,type_:pD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),vD=n(function(e,t,r){var n=f(Bk,F([aN(22),tN]),Qp("Payment Method")),a=f(gD,F([BT(Nk),TT(xk(150)),Lk(d(JR,1,1,1,.5))]),{label:Tx("payment method"),onChange:fD,placeholder:""===r?ba(hD(t)):Ca,spellcheck:!0,text:r});return f(AN,F([hN(10),BT(Nk),W$(f(z$,F([yx,l_(30),KN(10),aN(20),BT(xk(400))]),e))]),F([n,a]))}),yD=function(e){return"Buyer"===e.$?"After committing, you and the Seller have this long to complete the fiat payment, using one of your payment methods indicated below. If you fail to confirm payment within this window, 1/4 of your deposit is burned from both parties and the rest is refunded.":"After committing, you and the Buyer have this long complete the fiat payment, using one of your payment methods indicated below. If the Buyer aborts or fails to confirm within this window, 1/12 of the trade amount is burned from both parties and the rest is refunded."},mD=a(function(e,t,r,n){var a=l(Xu,e,D("0"),Gi(n));return f(Bk,F([aN(22),IA(t)]),Qp(O(a,r)))}),bD=function(e){return Yl(e)<0?Kf(0):e},CD=MR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),SD=MR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),ED=n(function(e,t,n){var a=r(function(e,r){return f(AN,F([hN(4)]),F([f(Bk,F([KN(4),Gk,Zk(n(f(wb,t,e)))]),f(WR,F([TT(xk(10))]),SD)),r,f(Bk,F([KN(4),Gk,Zk(n(function(e){return Yl(e)?e:Kf(3e5)}(bD(f(ER,t,e)))))]),f(WR,F([TT(xk(10))]),CD))]))}),i=_R(t);return f(NN,F([aD,hN(10)]),F([f(a,Kf(864e5),d(mD,3,e," days",i.days)),f(a,Kf(36e5),d(mD,2,e," hours",i.hours)),f(a,Kf(3e5),d(mD,2,e," min",i.min))]))}),TD=o(function(e,t,r,n,a,i){var o=f(AN,F([hN(6)]),F([f(Bk,F([aN(22),tN]),Qp(t)),f(Bk,F([Lk(d(JR,1,1,1,.5)),Yk(5),KN(5),rD({blur:4,color:d(JR,0,0,0,.15),offset:L(-3,3),size:0}),W$(f(z$,F([yx]),a))]),l(ED,IR,n,i))])),u=f(Bk,F([BT(xk(80))]),f(WR,F([cN]),e)),s=f(vN,F([aN(17),jN,IA(ex)]),F([Qp(r)]));return f(NN,F([BT(Nk),hN(15),Yk(10)]),F([u,o,s]))}),wD=d(JR,0,0,1,.2),ID=MR({description:"",src:"/DAIHard/static/img/payment-window-icon.svg"}),AD=i(function(e,t,r,n,a){return f(AN,F([KN(8),hN(15),Yk(8),Lk(wD),rD({blur:5,color:d(JR,0,0,0,.3),offset:L(-3,3),size:0})]),F([p(TD,ID,"Payment Window",yD(a),r,n,cD),l(vD,t,a,e)]))}),BD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},kD=function(e){return"Buyer"===e.$?"Once you confirm payment, the Seller has this time window to decide whether to release the funds to you or burn everything. If he doesn't decide before the time is up, funds are released to you by default.":"Once the Buyer confirms payment, you have this long to decide whether to release the funds to the Buyer or, in the case of an attempted scam, burn everything. If you don't decide before the time is up, funds are released to the Buyer by default."},ND=MR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),RD=n(function(e,t,r){return f(Bk,F([KN(8),Yk(8),Lk(wD),rD({blur:5,color:d(JR,0,0,0,.3),offset:L(-3,3),size:0})]),p(TD,ND,"Judgment Window",kD(r),e,t,BD))}),$D=function(e){return{$:"AutorecallIntervalChanged",a:e}},xD=function(e){var t=function(){return"Buyer"===e.$?"Seller":"Buyer"}();return"The offer will expire by this time window if a "+t+" does not commit to the trade, returning the balance and the 1% fee to your wallet. This can also be manually triggered anytime before a "+t+" commits."},_D=MR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),LD=n(function(e,t,r){return f(Bk,F([KN(8),Yk(8),Lk(wD),rD({blur:5,color:d(JR,0,0,0,.3),offset:L(-3,3),size:0})]),p(TD,_D,"Open Window",xD(r),e,t,$D))}),PD=function(e){return f(AN,F([BT(Nk),f(Hk,10,0),hN(20)]),F([l(LD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(AD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(RD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},DD=function(e){return f(AN,F([BT(f(q$,1e3,Nk)),cN,hN(20),C$({bottom:30,left:40,right:40,top:0}),Zk($$(!1)),H$(px(e))]),F([iD(e),PD(e),sD(e.userInfo)]))},UD=Yu(Hm(8226)),OD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(za,e,f(za,t,r))}),o=l(Xa,i,mr,a);return f(za,n,o)}return mr}),MD=r(function(e,t){return l(Wa,za,t,e)}),FD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(MD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),VD=r(function(e,t){var r=Fi(t);return!r||$(r,e)?t:_(r,e)<0?Ja(f(MD,f(_s,e%r,t),l(FD,mr,e/r|0,t))):f(_s,e,t)}),KD=a(function(e,t,r,n){for(;;){if(!r.b)return Ja(n);var a=r.a,i=r.b,o=e(a);if(f(vw,o,t)){var u=e,s=t,c=i,l=n;e=u,t=s,r=c,n=l}else{var u=e,s=f(NE,o,t),c=i,l=f(za,a,n);e=u,t=s,r=c,n=l}}}),HD=function(e){return d(KD,no,bm,e,mr)},jD=r(function(e,t){return f(Bk,F([BT(Nk),H$(f(NN,F([hN(3),BT(VN(100)),BT(t),FN]),f(OD,f(Bk,F([IA(d(JR,0,0,0,.1)),aN(14)]),Qp(UD)),f(nu,f(Af,Bk(F([IA(d(JR,0,0,0,.2))])),Qp),f(VD,100,(e?Ja:no)(HD(f(nu,f(_a,Ro,gi),ja(VR)))))))))]),Qp(" "))}),qD=function(e){return f(AN,F([BT(Nk),TT(Nk),Lk(Fk),Yk(6),rD({blur:20,color:d(iR,0,0,0,.1),offset:L(0,3),size:0}),Yk(10),aD,KN(20)]),F([f(jD,!1,Nk),f(AN,F([cN,hN(15),BT(f(q$,700,Nk))]),f(nu,vN(F([BT(Nk),aN(17),jN,IA(ex),ux])),F([F([f(Bk,F([aN(22),IA(IR)]),Qp("Hold on a second!"))]),F([Qp("This version of DAIHard is live and functional, but a Factory upgrade is coming soon.")]),F([Qp("When that upgrade hits, all current trades will be hidden in the new interface. So feel free to play around here if you want, but don't use the tool seriously in its current state.")]),F([Qp("If you'd like to keep up to date with our upgrades and progress, join our "),f(mA,F([IA(T$),dx]),{label:Qp("Telegram group"),url:"https://t.me/daihardexchange_group"}),Qp(".")])]))),f(Bk,F([cN,Zk(hT(Ef({category:"landing-page",event:"lets-go-clicked",label:'"Let\'s Go" clicked',value:0})))]),f(ix,"Okay, got it. let's go!",e)),f(jD,!0,Nk)]))},GD=function(e){return{$:"ShowCurrencyDropdown",a:e}},zD=n(function(e,t,r){return f(_a,th(t(e)),LN(r))}),YD={$:"AutoabortWindow"},WD={$:"AutoreleaseWindow"},JD={$:"Expiring"},QD={$:"Fiat"},XD={$:"Margin"},ZD={$:"TradeAmount"},eU=function(e){var t=e.a,r=e.b;return f(Bk,F([BT(VN(t)),TT(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,BT(Nk)]),r))},tU={$:"Descending"},rU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),nU=function(e){return f(Bk,F([jN,aN(17)]),Qp(e))},aU=n(function(e,t,r){return f(NN,F([hN(8)]),F([nU(e),f(AN,F([hN(2)]),F([f(Bk,F([KN(4),Gk,Zk(f(rU,t,cv))]),f(WR,F([BT(xk(8)),cN,ON]),SD)),f(Bk,F([KN(4),Gk,Zk(f(rU,t,tU))]),f(WR,F([BT(xk(8)),cN,ON]),CD))]))]))}),iU=r(function(e,t){var r=function(){return"Buyer"===e.$?oN:RR}(),n=_(Yl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoabortInterval)}),oU=r(function(e,t){var r=function(){return"Buyer"===e.$?RR:oN}(),n=_(Yl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoreleaseInterval)}),uU=r(function(e,t){var r=f(TR,e,t);if("TimeLeft"===r.$){var n=r.a,a=f(DR,n.a,n.b)<.05?oN:IR;return d(UR,F([BT(Nk)]),F([aN(16)]),L(a,AR),n)}var i=r.a;return d(UR,F([BT(Nk)]),F([aN(16)]),L(oN,AR),L(Kf(0),i))}),sU=function(e){return QR(e.terms.price)},cU=function(e){var t=du(100*e),r=t-yi(t),n=Gi(yi(t)),a=f(mi,0,3-yo(n));return n+(function(){if(a){return f(Eo,a+1,f(bo,1,ww(r)))}return""}()+"%")},fU=r(function(e,t){return MR({description:"",src:function(){var r=L(e,t);if(r.a){if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-up-green.svg":"/DAIHard/static/img/margin-up-red.svg";r.b;return"/DAIHard/static/img/margin-up.svg"}if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-down-green.svg":"/DAIHard/static/img/margin-down-red.svg";r.b;return"/DAIHard/static/img/margin-down.svg"}()})}),lU=n(function(e,t,r){return f(WR,f(za,TT(xk(34)),e),f(fU,t,r))}),dU=r(function(e,t){var r=cU(t);if("0%"===r)return f(Bk,F([aN(16)]),Qp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?RR:oN;return f(NN,F([hN(4)]),F([l(lU,mr,a,ba(i)),f(Bk,F([IA(o),aN(16)]),Qp(n))]))}),hU=r(function(e,t){return f(rc,Rk,f(Gf,dU(t),e.derived.margin))}),pU=function(e){return f(rc,Rk,f(Gf,ZR,el(e)))},gU=function(e){return a$(e.parameters.tradeAmount)},vU=function(e){return{$:"TradeClicked",a:e}},yU=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),BT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,IA(l(Tk,16,7,234)),jN]),Qp("View Offer")),onPress:ba(vU(e))})},mU=n(function(e,t,r){return f(NN,F([BT(Nk),hN(1),Lk(AR)]),F([f(AN,F([BT(Nk),hN(1),BT(VN(7))]),F([f(NN,F([BT(VN(6)),hN(1)]),f(nu,eU,F([L(2,f(uU,e,r)),L(1,gU(r)),L(2,sU(r)),L(1,f(hU,r,!$(t,ny))),L(2,f(iU,t,r)),L(2,f(oU,t,r))]))),eU(L(1,pU(r.terms.paymentMethods)))])),f(Bk,F([BT(VN(1)),TT(Nk),FN,Lk(Fk)]),f(Bk,F([cN,ON]),yU(r.id)))]))}),bU=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(AN,F([BT(Nk),TT(Nk),KN(30),hN(5)]),F([f(NN,F([BT(Nk)]),F([f(NN,F([BT(VN(7))]),F([eU(L(2,l(aU,"Expires",JD,Ca))),eU(L(1,l(aU,n,ZD,Ca))),eU(L(2,l(aU,"For Fiat",QD,Ca))),eU(L(1,l(aU,"Margin",XD,Ca))),eU(L(2,l(aU,"Payment Window",YD,Ca))),eU(L(2,l(aU,"Auto-Release",WD,Ca)))])),f(Bk,F([BT(VN(1))]),Rk)])),f(AN,F([BT(Nk),d$(2),Yk(8),f$(g$),hN(1),Lk(g$),FN]),f(nu,f(mU,e,r.browsingRole),t))]))}),CU=n(function(e,t,r){var n=d(zD,e,r.filterFunc,r.sortFunc,v$(t)),a=function(e){return f(Bk,F([aN(24),tN,IA(g$),cN,KN(20)]),Qp(e))},i=L(t.dataFetchStatus.total,n);if("Nothing"===i.a.$){i.a;return a("Querying Factory contract...")}if(i.a.a){if(i.b.b){var o=i.a.a;return l(bU,e,n,r)}var o=i.a.a;return a(_(t.dataFetchStatus.loaded,o-t.dataFetchStatus.invalid)<0?"Searching trades for Open offers...":"No open offers found.")}return a("No trades found.")}),SU={$:"ApplyInputs"},EU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([IA(Fk),cN,ON]),Qp("Apply")),onPress:ba(SU)}),TU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(TA,zk,l(JI,"br-"+Gi(t)+"-"+Gi(r)+Gi(n)+"-"+Gi(a),"border-radius",Gi(t)+"px "+Gi(r)+"px "+Gi(a)+"px "+Gi(n)+"px"))},wU=function(e){return f(Qk,"focus",Po(e))},IU=f(Af,kT,wU),AU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([IU(e(!0)),I_(e(!0))])}();return f(NN,O(e,F([TT(xk(40)),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Bk,F([Lk(AR),TT(xk(40)),TU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Bk,F([ON,f(Hk,10,0)]),r)),f(u_,O(s,O(t,F([BT(xk(100)),TT(xk(40)),f$(AR),TU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),p_({bottom:1,left:0,right:1,top:1})]))),{label:Tx(n),onChange:u,placeholder:i,text:a})]))}),BU=function(e){return{$:"MaxDaiChanged",a:e}},kU=function(e){return{$:"MinDaiChanged",a:e}},NU=r(function(e,t){return f(AN,F([BT(Nk),hN(8)]),F([f(Bk,F([aN(17),jN]),Qp(e)),t]))}),RU=iw(25),$U=function(e){return{$:"MoveX",a:e}},xU=function(e){return f(ZN,RU,$U(-e))},_U={$:"OnLeft"},LU=function(e){return f(QN,_U,e)},PU=a(function(e,t,r,n){var a=r$(F([ON])),i=f(NN,F([hN(8),ON,BT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Qp("max"))])),o=f(NN,F([hN(8),ON,BT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Qp("min"))]));return f(NU,Zf(e)+" Range",f(AN,F([hN(5),BT(xk(200))]),F([v(AU,F([LU(f(z$,F([xU(5),BT(xk(200))]),n.minDai))]),F([IU(GD(!1))]),o,"min "+Zf(e),t,Ca,Ca,kU),v(AU,F([LU(f(z$,F([xU(5),BT(xk(200))]),n.maxDai))]),F([IU(GD(!1))]),i,"max "+Zf(e),r,Ca,Ca,BU)])))}),DU=function(e){var t=f(Th,e,VR);if("Nothing"===t.$)return Qp("*");var r=t.a,n=r.b;return f(WR,F([TT(xk(26))]),n)},UU=function(e){return{$:"FiatTypeInputChanged",a:e}},OU=function(e){return{$:"MaxFiatChanged",a:e}},MU=function(e){return{$:"MinFiatChanged",a:e}},FU=i(function(e,t,r,n,a){var i=DU(t),o=f(NN,F([hN(8),ON,BT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Qp("max"))])),u=f(NN,F([hN(8),ON,BT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Qp("min"))]));return f(NU,"Fiat Type",f(NN,F([hN(5),BT(IT)]),F([f(Bk,F([V$,BT(xk(120))]),d(YP,e,t,GD(!0),UU)),f(AN,F([hN(5),V$,BT(xk(200))]),F([v(AU,F([W$(f(z$,F([X$(5),BT(f(q$,200,IT))]),a.minFiat))]),F([IU(GD(!1))]),u,"min",r,Ca,Ca,MU),v(AU,F([f_(f(z$,F([l_(5),BT(f(q$,200,IT))]),a.maxFiat))]),F([IU(GD(!1))]),o,"max",n,Ca,Ca,OU)]))])))}),VU={$:"AddSearchTerm"},KU=function(e){return{$:"PaymentMethodInputChanged",a:e}},HU=f(Fd,"keyCode",eS),jU=function(e){return f(Qk,"keyup",f(xo,function(t){return 13===t?Po(e):_o(Gi(t))},HU))},qU=function(e){return f(NU,"Search Payment Methods",f(u_,F([V$,BT(xk(250)),TT(xk(40)),f$(AR),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0}),O$(jU(VU))]),{label:Tx("payment methods search"),onChange:KU,placeholder:Ca,text:e}))},GU={$:"ResetSearch"},zU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([IA(Fk),cN,ON]),Qp("Reset")),onPress:ba(GU)}),YU=function(e){return{$:"RemoveTerm",a:e}},WU=function(e){return f(Bk,F([KN(3),V$,Gk,Zk(YU(e)),aN(10),IA(oN)]),Qp("x"))},JU=function(e){if(e.b){var t=e;return f(NN,F([BT(Nk),KN(10),hN(10)]),f(nu,function(e){return f(NN,F([Lk(d(iR,16,7,234,.2)),Yk(5),KN(4),hN(3)]),F([Qp(e),WU(e)]))},t))}return Rk},QU=a(function(e,t,r,n){return f(AN,F([hN(10),BT(IT),cN]),F([f(NN,F([BT(IT),hN(10)]),F([f(Bk,F([BT(IT),V$]),d(PU,e,t.minDai,t.maxDai,r)),f(Bk,F([BT(IT),V$]),h(FU,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(AN,F([BT(IT),V$,hN(5)]),F([qU(t.paymentMethod),JU(t.paymentMethodTerms)])),f(NU," ",f(AN,F([hN(5),BT(IT)]),F([EU,zU])))]))]))}),XU=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),BT(Nk),TT(Nk),Zk(GD(!1))]),F([f(NN,F([BT(Nk),hN(10),KN(30)]),F([d(QU,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(CU,e,t,r)]))}),ZU=f(_a,hu,Nm("USD")),eO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),tO=function(e){return Vv(f(xu,f(yl,hu(10),hu(18)),hu(e)))},rO=F([d(eO,Ff,tO(5),ZU(4),P(Kf(1728e5),Kf(1728e5),Kf(2592e5))),d(eO,ny,tO(2),ZU(7),P(Kf(1728e5),Kf(1728e5),Kf(2592e5)))]),nO=function(e){return f(Yf,Ov(e),3)},aO=PR,iO=r(function(e,t){return n$(t)+" "+Zf(e)}),oO=r(function(e,t){return f(Bk,F([IA(aO),aN(20)]),Qp(f(iO,e,t)))}),uO=RR,sO=function(e){return"$"+Il(e.amount)+" USD"},cO=function(e){return f(Bk,F([IA(uO),aN(20)]),Qp(sO(e)))},fO=function(e){return $(e,Kf(6048e5))?Qp("1 week"):b("QuickCreate.View",{start:{line:132,column:9},end:{line:132,column:19}})("lol bet u forgot about dis. summarizeIntervalElement is a hack! A dirty hack!!")},lO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(oO,e,f(dd,Ov(t),nO(t))):cO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(AN,F([hN(5)]),F([f(oO,e,t.daiAmountIn),cO(t.fiatValue)])):f(oO,e,t.daiAmountIn)}(),a=fO(function(e){var t=e.a,r=e.b,n=e.c;return f(wb,n,f(wb,r,t))}(t.intervals)),i=Qp("---\x3e");return f(AN,F([hN(8)]),F([f(NN,F([hN(4)]),F([n,i,r])),a]))}),dO=r(function(e,t){return d(ax,P(d(JR,0,0,1,1),d(JR,0,0,1,.8),d(JR,0,0,1,.6)),Fk,e,t)}),hO=function(e){return{$:"StartClicked",a:e}},pO=function(e){return f(dO,"Start",hO(e))},gO=n(function(e,t,r){return f(NN,F([hN(40)]),F([f(lO,e,r),t?pO(r):Rk]))}),vO=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),yO=r(function(e,t){if("Just"!==e.$)return f(Z$,"Can't find userInfo...",ba("You shouldn't be seeing this. Maybe your web3 provider changed something just now?"));var r=e.a;if("Spec"!==t.$)return Rk;var n=t.a,a=t.b;switch(a.$){case"ApproveMining":a.a;return f(Z$,"Mining Prepare tx...",Ca);case"ReadyToOpen":return f(ix,"Open Trade",f(vO,r,n));case"OpenNeedsSig":default:return Rk}}),mO=function(e){return{$:"TextInputChanged",a:e}},bO=function(e){return f(dD,mr,f(AN,F([hN(5)]),f(nu,f(Af,vN(mr),xE),function(){return F("Buyer"===e.$?[Qp("Some ideas:"),f(Bk,F([CN]),Qp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Bk,F([CN]),Qp("I'll send you $7 in Steam credit.")),f(Bk,F([CN]),Qp("TransferWise")),f(Bk,F([CN]),Qp("Cash drop in Hume Park, Bulawayo"))]:[Qp("Some ideas:"),f(Bk,F([CN]),Qp("I accept money orders or cashier checks into my Schwab bank account.")),f(Bk,F([CN]),Qp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Bk,F([CN]),Qp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Bk,F([CN]),Qp("Ship me a potato."))])}())))},CO=r(function(e,t){return f(gD,F([BT(Nk),TT(xk(200))]),{label:Tx("payment details"),onChange:mO,placeholder:""===t?ba(bO(e)):Ca,spellcheck:!0,text:t})}),SO=r(function(e,t){return f(AN,F([hN(10)]),f(nu,vN(mr),F([function(){return F("Seller"===e.$?[Qp("How must the "),cO(t),Qp(" be paid?")]:[Qp("How can you deliver the "),cO(t),Qp("?")])}(),F([Qp("You will be able to chat with the "),Qp(function(){return"Seller"===e.$?"buyer":"seller"}()),Qp(" to coordinate further once the trade is in progress.")])])))}),EO=function(e){return{$:"ApproveClicked",a:e}},TO=function(e){return{$:"ChangeState",a:e}},wO={$:"Web3Connect"},IO=n(function(e,t,r){return f(rc,Rk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ba(l(G$,mr,f(AN,F([hN(15),cN,KN(20)]),F([Qp("Text about approving"),function(){if("Just"===t.$){t.a;return f(dO,"Prepare "+n$(n.daiAmountIn)+" "+Zf(e)+" for deposit",EO(n))}return f(ix,"Connect to Wallet",wO)}()])),TO(Sv(Ev))));case"ApproveNeedsSig":var n=r.a.a;return ba(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Qp("Waiting for sig text")])),TO(Sv(Ev))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ba(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Qp("Text about opening")])),TO(f(Pv,n,Lv))));case"OpenMining":var n=r.a;r.b;return ba(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Qp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Qp("You will be redirected when the trade is finished opening.")])),TO(Sv(Ev))));default:break e}return Ca}())}),AO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(AN,F([hN(10),cN]),f(nu,f(gO,e.web3Context.factoryType,!0),rO))}var r=t.a;t.b;return f(AN,F([hN(20),cN]),F([l(gO,e.web3Context.factoryType,!1,r),f(AN,F([hN(10),cN]),F([f(SO,r.initiatorRole,r.fiatValue),f(CO,r.initiatorRole,e.textInput),f(yO,e.userInfo,e.state)]))]))}(),F([l(IO,e.web3Context.factoryType,e.userInfo,e.state)]))},BO=function(e){return{$:"MessageInputChanged",a:e}},kO={$:"MessageSubmit"},NO=function(e){return f(AN,F([BT(Nk),hN(10)]),F([f(gD,F([BT(Nk),TT(xk(100))]),{label:Tx("messageInput"),onChange:BO,placeholder:Ca,spellcheck:!1,text:e.messageInput}),f(yR,F([cN,aN(24)]),{label:Qp("Submit"),onPress:ba(kO)})]))},RO=f(qk,MN,DT.scrollbarsY),$O=r(function(e,t){return f(Bk,F([TT(Nk),BT(Nk)]),f(Bk,O(F([O$(f(U$,"position","absolute")),O$(f(U$,"top","0")),O$(f(U$,"right","0")),O$(f(U$,"bottom","0")),O$(f(U$,"left","0")),RO]),e),t))}),xO=l(Tk,200,205,210),_O=n(function(e,t,r){var n=F([TN,Lk(T$),IA(Fk),TU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([Sx,Lk(xO),IA(IR),TU({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(Bk,O(F([KN(7)]),u),f(vN,mr,F([Qp(O(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 ba(P(l(CA,0,0,1),Fk,"Initiator opened the trade"));case"Recalled":return ba(P(l(CA,0,0,1),Fk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Eo,8,eh(t))+"..";return ba(P(l(CA,1,0,1),Fk,r+" committed to the trade"));case"Aborted":return ba(P(l(CA,1,0,0),Fk,"Buyer aborted the trade"));case"Claimed":return ba(P(l(CA,0,1,0),Fk,"Buyer marked the fiat transfer complete"));case"Released":return ba(P(l(CA,0,0,1),Fk,"Seller released the "+Zf(e)+" and closed the contract"));default:return ba(P(l(CA,0,0,1),Fk,"Seller burned the "+Zf(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Rk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Bk,F([Yk(3),d$(1),f$(l(CA,1,0,1)),cN,Lk(h)]),f(vN,F([IA(p)]),F([Qp(g)])))}),LO=n(function(e,t,r){if(r.b){var n=r;return f($O,F([BT(Nk),TT(Nk),Yk(5),d$(1),f$(IR),KN(10)]),f(AN,F([BT(Nk),TT(Nk),hN(10)]),f(nu,f(_O,e,t),n)))}return f(Bk,F([BT(Nk),TT(Nk),Yk(5),d$(1),f$(IR),cN,IA(l(CA,.5,.5,.5)),CN]),Qp("no messages found."))}),PO=Sr,DO=function(e){return f(AN,F([BT(Nk),TT(Nk),hN(10),d$(1),Yk(5),KN(20)]),F([l(LO,e.web3Context.factoryType,e.userRole,f(PO,function(e){return e.blocknum},Va(e.history))),NO(e)]))},UO=function(e){return f(Bk,F([Lk(Fk),Yk(8),nD,BT(Nk),TT(Nk)]),DO(e))},OO={$:"ToggleChat"},MO=function(e){if(e.showChatHistory){var t=f(rc,Rk,f(Gf,UO,e.chatHistoryModel));return f(Bk,F([TT(Nk),BT(xk(500)),KN(20),TN]),l(G$,F([TT(Nk),BT(Nk)]),f(Df,_S,t),OO))}return Rk},FO=function(e){return"Buyer"===e.initiatorRole.$?Ff:ny},VO=function(e){return qR(e)+" "+e.fiatType},KO={$:"AbortAction"},HO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),jO=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;switch(t.a.$){case"ConfirmingCommit":var r=t.a,n=r.a,a=r.b,i=r.c,o=VO(n.terms.price),u=n$(Vv(i)),s=n$(n.parameters.tradeAmount)+" "+Zf(e.web3Context.factoryType),c=function(){return"Buyer"===FO(n.parameters).$?L(f(Bk,F([jN,IA(IR)]),Qp("buyer")),F([Qp("pay the seller "),f(Bk,F([IA(T$)]),Qp(o)),Qp(" in exchange for the "),f(Bk,F([IA(T$)]),Qp(s)),Qp(" held in this contract.")])):L(f(Bk,F([jN,IA(IR)]),Qp("seller")),F([Qp("accept "),f(Bk,F([IA(T$)]),Qp(o)),Qp(" from the buyer in exchange for the "),f(Bk,F([IA(T$)]),Qp(s)),Qp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,TT(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Qp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(nu,vN(F([cN,aN(18),jN,IA(ex)])),O(F([O(F([Qp("You will deposit "),f(Bk,F([IA(T$)]),Qp(u+" "+Zf(e.web3Context.factoryType))),Qp(", thereby becoming the "),d,Qp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Qp("(This ususally requires two Metamask signatures. Your "+Zf(e.web3Context.factoryType)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(Bk,F([lx,cN]),f(ix,"Yes, I definitely want to commit to this trade.",l(HO,n,a,i)))])),KO);case"ApproveNeedsSig":t.a;return sx(F([Qp("Waiting for user signature for the approve call."),Qp("(check Metamask!)"),Qp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return sx(F([Qp("Mining the initial approve transaction..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction on Etherscan"),url:f(cx,e.web3Context.factoryType,p)}),Qp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return sx(F([Qp("Waiting for user signature for the final commit call."),Qp("(check Metamask!)"),Qp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return sx(F([Qp("Mining the final commit transaction..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction"),url:f(cx,e.web3Context.factoryType,p)})]));case"ConfirmingAction":var g=t.a.a;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,TT(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Qp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(nu,vN(F([cN,aN(18),jN,IA(ex)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Qp('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 '+Zf(e.web3Context.factoryType)+" rather than release it to you.")])]);case"Abort":return F([F([Qp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Zf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Qp("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 F([F([Qp("This will destroy the "+Zf(e.web3Context.factoryType)+" 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(Bk,F([lx,cN]),function(e){return f(ix,e,jS(g))}(function(){switch(g.$){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 "+Zf(e.web3Context.factoryType)+".";default:return"I understand. Burn the "+Zf(e.web3Context.factoryType)+"."}}()))])),KO);case"ActionNeedsSig":var g=t.a.a;return sx(F([Qp("Waiting for user signature for the "+GS(g)+" call."),Qp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return Rk}},qO=NN(F([BT(Nk),Lk(Fk),Yk(5),KN(20),aD,nD])),GO=function(e){return f(NN,F([hN(8)]),F([f(WR,mr,t$),f(Bk,F([aN(24),jN]),Qp(n$(e)))]))},zO=r(function(e,t){var r=f(ag,mb(e),f(Gf,function(e){return e.address},t));return f(v_,function(){var t=L(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"}(),GO(e.parameters.tradeAmount))}),YO=function(e){return f(NN,F([hN(5)]),F([w_(e.fiatType),f(Bk,F([aN(24),jN]),Qp(VO(e)))]))},WO=function(e){return f(v_,"For Fiat",YO(e.terms.price))},JO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},QO=MR({description:"flame",src:"/DAIHard/static/img/flame.png"}),XO=MR({description:"release",src:"/DAIHard/static/img/release.png"}),ZO={$:"ToggleStatsModal"},eM=function(e){return f(PO,no,e)},tM=n(function(e,t,n){var a=f(th,function(e){return $(f(SS,e,n),ba(t))},f(GE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ba(t)}return Ca},Va(e.trades))),i=Fi(a),o=l(Wa,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(dd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(dd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Qf,amountReleased:Qf,numAborts:0,numBurns:0,numReleases:0},a),u=f(Gf,Kf,el(eM(f(GE,function(e){return function(e){return e?ba(e):Ca}(Yl(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}}),rM=function(e){return{$:"ViewUserHistory",a:e}},nM=f(_B,0,mr),aM=f(qk,MN,DT.clipX),iM=f(qk,MN,DT.clipY),oM=f(qk,eN,DT.textNormalWeight),uM=r(function(e,t){return yi(e/t)}),sM=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(_(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),cM=r(function(e,t){var r=e.a,n=e.b;return l(sM,r,f(uM,Yl(t),6e4),n)}),fM=r(function(e,t){return f(es,24,f(uM,f(cM,e,t),60))}),lM=r(function(e,t){return f(es,1e3,Yl(t))}),dM=r(function(e,t){return f(es,60,f(cM,e,t))}),hM={$:"Apr"},pM={$:"Aug"},gM={$:"Dec"},vM={$:"Feb"},yM={$:"Jan"},mM={$:"Jul"},bM={$:"Jun"},CM={$:"Mar"},SM={$:"May"},EM={$:"Nov"},TM={$:"Oct"},wM={$:"Sep"},IM=function(e){var t=f(uM,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)}},AM=r(function(e,t){switch(IM(f(cM,e,t)).month){case 1:return yM;case 2:return vM;case 3:return CM;case 4:return hM;case 5:return SM;case 6:return bM;case 7:return mM;case 8:return pM;case 9:return wM;case 10:return TM;case 11:return EM;default:return gM}}),BM=r(function(e,t){return f(es,60,f(uM,Yl(t),1e3))}),kM={$:"Fri"},NM={$:"Mon"},RM={$:"Sat"},$M={$:"Sun"},xM={$:"Thu"},_M={$:"Tue"},LM={$:"Wed"},PM=r(function(e,t){switch(f(es,7,f(uM,f(cM,e,t),1440))){case 0:return xM;case 1:return kM;case 2:return RM;case 3:return $M;case 4:return NM;case 5:return _M;default:return LM}}),DM=n(function(e,t,r){return e.toAmPm(f(fM,t,r))}),UM=r(function(e,t){return IM(f(cM,e,t)).day}),OM=UM,MM=F([$M,NM,_M,LM,xM,kM,RM]),FM=r(function(e,t){return function(e){return e.a}(f(rc,L(0,$M),el(f(th,function(r){return $(r.b,f(PM,e,t))},f(ji,r(function(e,t){return L(e,t)}),MM)))))}),VM=function(e){return l(Wa,Ya,0,e)},KM=r(function(e,t){return IM(f(cM,e,t)).year}),HM=function(e){return!f(es,4,e)&&(!!f(es,100,e)||!f(es,400,e))},jM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return HM(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}}),qM=F([yM,vM,CM,hM,SM,bM,mM,pM,wM,TM,EM,gM]),GM=r(function(e,t){return f(rc,L(0,yM),el(f(th,function(r){r.a;return $(r.b,f(AM,e,t))},f(ji,r(function(e,t){return L(e,t)}),qM))))}),zM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(GM,e,t))}),YM=r(function(e,t){var r=f(_s,f(zM,e,t)-1,qM);return VM(f(nu,jM(f(KM,e,t)),r))+f(OM,e,t)}),WM=r(function(e,t){return f(zM,e,t)/4|0}),JM=r(function(e,t){var r=Gi(t),n=e-yo(r);return O(f(zi,"",f(nu,function(e){return"0"},f(Hi,1,n))),r)}),QM=function(e){return e?e<=12?e:e-12:12},XM=Bg(315576e5),ZM=r(function(e,t){return Kf(XM*f(KM,e,t))}),eF=r(function(e,t){var r=f(ZM,e,t),n=f(FM,e,r);return 1+((f(YM,e,t)+n)/7|0)}),tF=r(function(e,t){return Gi(f(KM,e,t))}),rF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Gi(f(zM,t,r));case"MonthSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(zM,t,r));case"MonthFixed":return f(JM,2,f(zM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(AM,t,r));case"MonthNameFull":return e.toMonthName(f(AM,t,r));case"QuarterNumber":return Gi(1+f(WM,t,r));case"QuarterSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(1+f(WM,t,r));case"DayOfMonthNumber":return Gi(f(OM,t,r));case"DayOfMonthSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(OM,t,r));case"DayOfMonthFixed":return f(JM,2,f(OM,t,r));case"DayOfYearNumber":return Gi(f(YM,t,r));case"DayOfYearSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(YM,t,r));case"DayOfYearFixed":return f(JM,3,f(YM,t,r));case"DayOfWeekNumber":return Gi(f(FM,t,r));case"DayOfWeekSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(FM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(PM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(PM,t,r));case"WeekOfYearNumber":return Gi(f(eF,t,r));case"WeekOfYearSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(eF,t,r));case"WeekOfYearFixed":return f(JM,2,f(eF,t,r));case"YearNumberLastTwo":return f(Ao,2,f(tF,t,r));case"YearNumber":return f(tF,t,r);case"AmPmUppercase":return HP(l(DM,e,t,r));case"AmPmLowercase":return ll(l(DM,e,t,r));case"HourMilitaryNumber":return Gi(f(fM,t,r));case"HourMilitaryFixed":return f(JM,2,f(fM,t,r));case"HourNumber":return Gi(QM(f(fM,t,r)));case"HourFixed":return f(JM,2,QM(f(fM,t,r)));case"HourMilitaryFromOneNumber":return Gi(1+f(fM,t,r));case"HourMilitaryFromOneFixed":return f(JM,2,1+f(fM,t,r));case"MinuteNumber":return Gi(f(dM,t,r));case"MinuteFixed":return f(JM,2,f(dM,t,r));case"SecondNumber":return Gi(f(BM,t,r));case"SecondFixed":return f(JM,2,f(BM,t,r));case"MillisecondNumber":return Gi(f(lM,t,r));case"MillisecondFixed":return f(JM,3,f(lM,t,r));default:return n.a}}),nF=a(function(e,t,r,n){return f(zi,"",f(nu,l(rF,e,r,n),t))}),aF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),iF=function(e){return e>11?"pm":"am"},oF=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"}},uF=function(e){switch(f(es,100,e)){case 11:case 12:case 13:return"th";default:switch(f(es,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},sF=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"}},cF=p(aF,oF,f(_a,oF,Eo(3)),sF,f(_a,sF,Eo(3)),iF,uF),fF=nF(cF),lF={$:"MonthNameFull"},dF=lF,hF=function(e){return{$:"Text",a:e}},pF=hF,gF={$:"YearNumber"},vF=gF,yF=n(function(e,t,n){var a=r(function(e,t){return f(AN,F([aN(18),hN(6)]),F([f(Bk,F([yN]),Qp(e)),f(Bk,F([oM]),Qp(t))]))}),i=fF(F([dF,pF(", "),vF])),o=f(AN,F([hN(23),BT(Nk)]),O(f(nu,function(e){var t=e.a,r=e.b;return f(a,t,r)},F([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,nM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Gi(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+Zf(e)+" Released"),L("Abort Outcomes",Gi(n.numAborts)+" trades"),L("Burn Outcomes",Gi(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+Zf(e)+" Burned")])),F([f(Bk,F([cN]),f(dO,"View User History",rM(n.asRole)))])));return f(AN,F([Yk(8),aM,iM,Lk(AR),hN(1),rD({blur:20,color:d(JR,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Bk,F([BT(Nk),Lk(Fk),KN(17)]),f(m$,18,t)),f(Bk,F([BT(Nk),Lk(Fk),KN(17)]),o)]))}),mF=a(function(e,t,r,n){var a=l(tM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=JO(t.parameters.initiatorRole)+" Stats";return f(Bk,n?F([f_(f(Bk,F([l_(30),TN]),l(yF,e,t.parameters.initiatorAddress,a)))]):mr,f(v_,i,f(NN,F([BT(Nk),hN(30),Gk,Zk(ZO)]),F([f(NN,mr,F([f(WR,F([TT(xk(28))]),XO),f(Bk,F([aN(24),jN]),Qp(l(Xu,2,D("0"),Gi(a.numReleases))))])),f(NN,mr,F([f(WR,F([TT(xk(28))]),QO),f(Bk,F([aN(24),jN]),Qp(l(Xu,2,D("0"),Gi(a.numAborts))))])),f(NN,mr,F([f(WR,F([TT(xk(28))]),QO),f(Bk,F([aN(24),jN]),Qp(l(Xu,2,D("0"),Gi(a.numBurns))))]))]))))}),bF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+eh(t)}e.a;return"https://kovan.etherscan.io/address/"+eh(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+eh(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+eh(t);case"XDai":e.a;return"https://blockscout.com/poa/dai/address/"+eh(t);case"Rootstock":e.a;return"https://explorer.rsk.co/address/"+eh(t);default:e.a;return""}}),CF=n(function(e,t,r){return f(mA,e,{label:Qp(eh(r)),url:f(bF,t,r)})}),SF=r(function(e,t){return f(v_,"Trade Status",f(AN,F([aN(24),jN,hN(8)]),F([Qp(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(CF,F([aN(12),IA(T$),dx]),t,e.creationInfo.address)])))}),EF=o(function(e,t,r,n,a,i){return qO(F([f(SF,t,n),f(zO,t,r),WO(t),d(mF,n,t,a,i)]))}),TF=l(Tk,9,32,107),wF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),IF=a(function(e,t,r,n){return d(wF,e,t,r,n)}),AF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BF=function(e){return function(e){return d(IF,e.red,e.green,e.blue,e.alpha)}(AF(e))},kF=function(e){return{$:"Circle",a:e}},NF=kF,RF=d(wF,0,0,0,1),$F={$:"Flat"},xF={$:"Sharp"},_F=function(e){return{$:"Uniform",a:e}},LF=_F,PF={cap:$F,dashPattern:mr,dashPhase:0,fill:LF(RF),join:xF,thickness:2},DF=n(function(e,t,r){return U(PF,{dashPattern:e,fill:r,thickness:t})}),UF=DF(mr),OF={$:"Transparent"},MF=OF,FF=f(UF,0,MF),VF=r(function(e,t){return{$:"Shape",a:e,b:t}}),KF=function(e){return{basic:e,handlers:mr,name:Ca,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},HF=function(e){return f(Af,KF,VF(e))},jF=function(e){return HF(L(e,FF))},qF=function(e){return L(-e.a,-e.b)},GF=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return U(t,{shift:L(a.a+r,a.b+n)})}),zF=r(function(e,t){return f(GF,qF(e(t)),t)}),YF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(za,r,a),f(za,n,i))});return l(Xa,t,L(mr,mr),e)},WF=r(function(e,t){return{$:"Path",a:e,b:t}}),JF=Nr,QF=Rr,XF=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=QF(n),i=JF(n);return L(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 L(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Af,f(Af,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},ZF=function(e){return nu(function(t){var r=t.a,n=t.b,a=e/2;return L(r<0?r-a:r+a,n<0?n-a:n+a)})},eV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(ZF,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),tV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return F([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},rV=function(e){var t=nV(e.basic),r=YF(f(nu,XF(e),t)),n=r.a,a=r.b;return{toBottom:-f(rc,0,SI(a)),toLeft:-f(rc,0,SI(n)),toRight:f(rc,0,CI(n)),toTop:f(rc,0,CI(a))}},nV=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(eV,r,L(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(eV,r,L(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(eV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(ZF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(WF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(ZF,$(C,$F)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(eV,0,S);case"Group":var E=e.a;return f(ZF,0,sy(f(nu,f(_a,rV,tV),E)));default:var T=e.b;return f(ZF,0,tV(rV(T)))}},aV=function(e){var t=rV(e);return t.toTop+t.toBottom},iV=function(e){var t=rV(e);return L(-t.toLeft,t.toTop)},oV=function(e){var t=rV(e);return t.toLeft+t.toRight},uV=Un("http://www.w3.org/2000/svg"),sV=uV("svg"),cV=qn("height"),fV=qn("version"),lV=qn("width"),dV=uV("circle"),hV=uV("ellipse"),pV=uV("foreignObject"),gV=uV("g"),vV=uV("image"),yV=uV("polygon"),mV=uV("polyline"),bV=uV("rect"),CV=Nw,SV=uV("text"),EV=qn("id"),TV=qn("points"),wV=qn("r"),IV=qn("rx"),AV=qn("ry"),BV=function(e){return l(Gn,"http://www.w3.org/1999/xlink","xlink:href",it(e))},kV=function(e){return{$:"Group",a:e}},NV=qn("dominant-baseline"),RV=qn("fill"),$V=qn("fill-opacity"),xV=qn("font-family"),_V=qn("font-size"),LV=qn("font-style"),PV=qn("font-variant"),DV=qn("font-weight"),UV=qn("opacity"),OV=qn("stroke"),MV=qn("stroke-dasharray"),FV=qn("stroke-dashoffset"),VV=qn("stroke-linecap"),KV=qn("stroke-linejoin"),HV=qn("stroke-opacity"),jV=qn("stroke-width"),qV=qn("text-anchor"),GV=qn("text-decoration"),zV=qn("transform"),YV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},WV=function(e){return f(zi," ",f(nu,function(e){var t=e.a,r=e.b;return f(zi,",",F([Gi(t),Gi(r)]))},e))},JV=n(function(e,t,r){return d(wF,e,t,r,1)}),QV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Bg(1e4*e)/100};return Tl(F(["rgba(",ww(i(t)),"%,",ww(i(r)),"%,",ww(i(n)),"%,",ww(function(e){return Bg(1e3*e)/1e3}(a)),")"]))},XV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},ZV=function(e){var t=XV(e),r=t.red,n=t.green,a=t.blue;return QV(l(JV,r,n,a))},eK=function(e){if("Uniform"===e.$){var t=e.a;return ZV(t)}return"none"},tK=function(e){var t=XV(e),r=t.alpha;return ww(r)},rK=function(e){if("Uniform"===e.$){var t=e.a;return tK(t)}return"0"},nK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},aK=kr,iK=function(e){var t=ww(e.scale.b),r=ww(e.scale.a),n=ww(-e.rotation/2/aK*360),a=ww(-e.shift.b),i=ww(e.shift.a);return Tl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},oK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([OV(eK(r.fill)),HV(rK(r.fill)),jV(ww(r.thickness)),VV(YV(r.cap)),KV(nK(r.join)),RV("none"),UV(ww(e.opacity)),zV(iK(e)),FV(Gi(r.dashPhase)),MV(WV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([RV(eK(a)),$V(rK(a)),OV(eK(r.fill)),HV(rK(r.fill)),jV(ww(r.thickness)),VV(YV(r.cap)),KV(nK(r.join)),UV(ww(e.opacity)),zV(iK(e)),FV(Gi(r.dashPhase)),MV(WV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([RV(eK(_F(o.color))),xV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),_V(Gi(o.size)),DV(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"}}()),LV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),PV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),GV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),qV("middle"),NV("middle"),zV(iK(e))]);default:return F([zV(iK(e))])}},uK=qn("x"),sK=qn("y"),cK=r(function(e,t){return F([lV(ww(e)),cV(ww(t)),uK(ww(-e/2)),sK(ww(-t/2))])}),fK=function(e){return f(zi," ",f(nu,function(e){var t=e.a,r=e.b;return f(zi,",",F([ww(t),ww(-r)]))},e))},lK=Qk,dK=r(function(e,t){return f(e,t.a,t.b)}),hK=function(e){return f(nu,dK(lK),e)},pK=function(e){e:for(;;){var t=f(rc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(mV,O(F([EV(t),TV(fK(i))]),O(oK(e),hK(e.handlers))),mr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(yV,O(F([EV(t),TV(fK(i))]),O(oK(e),hK(e.handlers))),mr);case"Circle":var c=s.a;return f(dV,O(F([EV(t),wV(ww(c))]),O(oK(e),hK(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(hV,O(F([EV(t),IV(ww(d)),AV(ww(h))]),O(oK(e),hK(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(bV,O(F([EV(t),IV(ww(c)),AV(ww(c))]),O(f(cK,p,g),O(oK(e),hK(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(WF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(SV,O(F([EV(t)]),O(oK(e),hK(e.handlers))),F([CV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(vV,O(F([EV(t),BV(C)]),O(f(cK,p,g),O(oK(e),hK(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(pV,O(F([EV(t)]),O(f(cK,p,g),O(oK(e),hK(e.handlers)))),F([E]));case"Group":var T=n.a;return f(gV,f(za,EV(t),O(oK(e),hK(e.handlers))),l(Wa,r(function(e,t){return f(za,pK(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:kV(F([w,I]))});e=v;continue e}}},gK=r(function(e,t){var r=e.a,n=e.b,a=ww(r),i=ww(n);return f(JT,mr,F([f(sV,F([lV(a),cV(i),fV("1.1")]),F([pK(t)]))]))}),vK=function(e){return f(gK,L(oV(e),aV(e)),f(zF,iV,e))},yK=a(function(e,t,r,n){var a=A_(vK(f(jF,LF(BF(r)),NF(t/2))));return f(Bk,O(F([H$(n)]),e),a)}),mK=MR({description:"chat",src:"/DAIHard/static/img/chat-icon.svg"}),bK=function(e){return f(ZN,RU,$U(e))},CK=d(yK,F([Gk,Zk(OO)]),80,l(CA,1,1,1),f(WR,F([cN,ON,bK(5)]),mK)),SK=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},EK=function(e){return f(AN,F([Yk(12),Lk(AR),KN(15),hN(15)]),F([f(Bk,F([aN(24),tN,CN]),Qp("Fiat Payment Method")),f(vN,F([aN(18),TT(IT),Lk(Fk),rD({blur:5,color:d(JR,0,0,0,.2),offset:L(-3,3),size:0}),Yk(3),KN(5)]),F([f(rc,f(Bk,F([IA(B$),CN]),Qp("No payment methods found.")),f(Gf,Qp,f(Gf,function(e){return e.info},el(e))))]))]))},TK={$:"Active"},wK=function(e){return{$:"ExpandPhase",a:e}},IK=F([Lk(TF),IA(Fk)]),AK=r(function(e,t){return{$:"Min",a:e,b:t}}),BK=r(function(e,t){return f(AK,e,t)}),kK=function(e){return F(e?[Yk(12),V$,TT(f(BK,380,IT))]:[Yk(12),cN])},NK=F([Lk(Fk)]),RK=r(function(e,t){return jf(f(Lu,qf(e),qf(t)))}),$K=r(function(e,t){return d(ax,P(d(JR,1,.6,.2,1),d(JR,1,.6,.2,.8),d(JR,1,.6,.2,.6)),Fk,e,t)}),xK=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),_K=function(e){return{$:"ContractActionClicked",a:e}},LK={$:"Web3Connect"},PK=n(function(e,t,r){if("Just"===r.$){var n=r.a;return"TimeUp"===f(TR,e,t).$?Rk:f(NN,F([hN(8)]),function(){var e=P(t.state.phase,f(mb,t,n.address),f(SS,t,n.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return F([f(Df,jS,f(dO,"Remove and Refund this Trade",KS))])}break e}var r=(e.a,e.b,qf(bb(t.parameters)));return F([f(ix,"Deposit and Commit to Trade",l(xK,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Df,_K,f($K,"Abort Trade",AS)),f(Df,_K,f(ix,"Confirm Payment",LS)),CK])}e.a,e.c.a;return F([CK])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Df,_K,f(ix,"Burn it All!",xS)),f(Df,_K,f(dO,"Release Everything",HS)),CK])}e.a,e.c.a;return F([CK])}break e;default:break e}return mr}())}return f(ix,"Connect to Wallet",LK)}),DK={$:"Finished"},UK={$:"NotStarted"},OK=r(function(e,t){var r=L(xN(t),xN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?UK:$(n,a)?TK:DK}),MK=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(za,r,e),a=t-1,i=r;e=n,t=a,r=i}}),FK=r(function(e,t){return l(MK,mr,e,t)}),VK=i(function(e,t,r,n,a){var i=n$(f(dd,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Zf(e),o=n$(n.parameters.tradeAmount)+" "+Zf(e),u=f(NN,mr,f(FK,3,f(WR,F([TT(xk(18))]),QO))),s=f(Af,Bk(F([IA(l(CA,1,0,0))])),Qp),c=$(t,n.state.phase),d=f(ag,SS(n),f(Gf,function(e){return e.address},a)),h=c?Fk:IR,p=vN(F([IA(h),aN(18),tN])),g=VO(n.terms.price),v=c?l(Tk,0,226,255):l(Tk,16,7,234),y=f(Af,Bk(F([IA(v)])),Qp),m=n$(n.parameters.buyerDeposit)+" "+Zf(e),b=n.parameters.abortPunishment,C=n$(b)+" "+Zf(e),S=n$(f(RK,n.parameters.buyerDeposit,b))+" "+Zf(e),E=n$(f(RK,n.parameters.tradeAmount,b))+" "+Zf(e),T=function(){var r=L(t,d);if("Just"===r.b.$)switch(r.a.$){case"Open":var a=(r.a,r.b.a);return L("And Now, We Wait",function(){return"Buyer"===a.$?f(nu,p,F([F([Qp("Your "),s("burnable deposit"),Qp(" of "),y(m),Qp(" is now held in this contract, and your offer to buy "),y(o),Qp(" for "),y(g),Qp(" is now listed in the marketplace.")]),F([Qp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Qp(" into this contract.")]),F([Qp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Qp(" to you.")])])):f(nu,p,F([F([Qp("Your offer to sell the "),y(o),Qp(" held in this contract for "),y(g),Qp(" is now listed in the marketplace.")]),F([Qp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Qp(" of 1/3 of the trade amount "),y("("+m+")"),Qp(" into this contract.")]),F([Qp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Qp(" to you.")])]))}());case"Committed":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Time to Pay Up",f(nu,p,F([F([Qp("You must now pay the Seller "),y(g),Qp(" via the Fiat Payment Method, "),f(Bk,F([tN]),Qp("and then click ")),s("Confirm Payment"),Qp(" before the payment window runs out. Use the chat to coordinate.")]),F([Qp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(") will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to the Seller, "),y(S),Qp(" to you).")]),F([Qp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Qp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(nu,p,F([F([Qp("Work and communicate with the Buyer to receive "),y(g),Qp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Qp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(") will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to you, "),y(S),Qp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(nu,p,F([F([Qp("If the Seller confirms receipt of payment, or fails to decide within the release window, the combined balance of "),y(i),Qp(" will be released to you.")]),F([Qp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Qp(" In this case the "),y(i),Qp(" will be lost to both parties.")]),F([Qp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(nu,p,F([F([Qp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Qp("So, have you recieved the "),y(g),Qp("? If so, you can click "),y("Release Everything"),Qp(".")]),F([Qp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Qp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Qp("If you don't decide within the Release Window, the balance will be automatically released.")])])));default:r.a;return L("Contract closed.",F([p(F([Qp("Check the chat log for the full history.")]))]))}else switch(r.a.$){case"Open":r.a,r.b;return L("Get it while it's hot",function(){return"Seller"===n.parameters.initiatorRole.$?f(nu,p,F([F([Qp("The Seller has deposited "),y(o),Qp(" into this contract, and offers to sell it for "),y(g),Qp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Qp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Qp(".")]),F([Qp("If the trade is successful, the combined "+Zf(e)+" balance "),y("("+i+")"),Qp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Qp(" for both parties (see Payment Window for more on this).")]),F([Qp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Qp(" within the payment window.")])])):f(nu,p,F([F([Qp("The Buyer is offering to buy "),y(o),Qp(" for "),y(g),Qp(", and has deposited "),y(m),Qp(" into this contract as a "),s("burnable deposit"),Qp(". To become the Seller, deposit "),y(o),Qp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Qp(".")]),F([Qp("When you receive the "),y(g),Qp(" from the Buyer, the combined "+Zf(e)+" balance "),y("("+i+")"),Qp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Qp(" for both parties (see Payment Window for more on this).")]),F([Qp("Don't commit unless you can receive "),y(g),Qp(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":r.a,r.b;return L("Making the Payment",f(nu,p,F([F([Qp("During this phase, the Buyer is expected to transfer "),y(g),Qp(" to the Seller, as described in Fiat Payment Method, "),f(Bk,F([tN]),Qp("and ")),s("Confirm the Payment "),Qp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Qp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(" amount) will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to the Seller, "),y(S),Qp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(nu,p,F([F([Qp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Qp("If the Seller can verify he has received the "),y(g),Qp(", he will probably release the total balance of "),y(o),Qp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Qp(".")]),F([Qp("If the Seller has not made a decision before the Release Window expires, the "),y(o),Qp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(AN,F([BT(Nk),TT(Nk),KN(20),hN(30)]),F([f(NN,F([BT(Nk)]),F([f(Bk,F([aN(24),tN,IA(v),Sx]),Qp(w))])),f(AN,F([BT(Nk),ON,hN(13)]),I),f(Bk,F([TN]),function(){switch(f(OK,n,t).$){case"Active":return l(PK,r,n,a);case"NotStarted":return f(Bk,F([aN(20),tN,CN,IA(g$)]),Qp("Phase not yet started."));default:return f(Bk,F([aN(20),tN,CN]),Qp("Phase no longer active."))}}())]))}),KK=MR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),HK=MR({description:"judgment phase",src:"/DAIHard/static/img/phase-judgment.svg"}),jK={$:"None"},qK=jK,GK=MR({description:"open phase",src:"/DAIHard/static/img/phase-open.svg"}),zK=function(e){switch(e.$){case"Open":return GK;case"Committed":return KK;case"Judgment":return HK;default:return qK}},YK=r(function(e,t){var r=zK(e),n=function(){switch(t.$){case"NotStarted":return l(Tk,10,33,108);case"Active":return l(Tk,0,100,170);default:return l(Tk,1,129,104)}}(),a=A_(vK(f(jF,LF(BF(n)),NF(50))));return f(Bk,F([cN,H$(f(WR,F([cN,ON]),r))]),a)}),WK=function(e){var t=F([CN,tN,aN(20)]);switch(e.$){case"Active":return f(Bk,O(t,F([IA(oN)])),Qp("Active"));case"NotStarted":return f(Bk,O(t,F([IA(g$)])),Qp("Not Started"));default:return f(Bk,t,Qp("Finished"))}},JK=n(function(e,t,r){var n=f(OK,t,e),a=function(){return"Active"===n.$?l(Tk,0,226,255):IR}(),i=f(Bk,F([IA(a),aN(20),tN,cN]),Qp(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Release Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return Rk;switch(n.$){case"NotStarted":return d(LR,F([cN]),F([aN(22),jN]),L(IR,AR),f(SR,e,t));case"Active":var a=f(TR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(UR,F([cN]),F([aN(22),jN]),L(Fk,AR),i)}return f(AN,F([cN,hN(10)]),F([f(Bk,F([cN]),Qp(wR(e))),f(dO,"Poke",jS(VS))]));default:return f(Bk,F([TT(xk(1))]),Rk)}}();return f(AN,F([KN(20),hN(10),TT(Nk)]),F([f(Bk,F([V$,cN]),i),f(Bk,F([TT(Nk),cN]),f(Bk,F([ON]),f(YK,e,n))),f(AN,F([hN(10),lx,cN]),F([f(Bk,F([cN]),WK(n)),o]))]))}),QK=u(function(e,t,r,n,a,i,o){var u=f(OK,n,r),s=f(Bk,F([KN(10),BT(Nk),TT(Nk)]),h(VK,t,r,o,n,a)),c=function(){switch(r.$){case"Open":return n.parameters.autorecallInterval;case"Committed":return n.parameters.autoabortInterval;case"Judgment":return n.parameters.autoreleaseInterval;default:return Kf(0)}}(),d=l(JK,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(ER,f(wb,n.state.phaseStartTime,c),o);default:Kf(0)}}(),f(Bk,F([TT(Nk),BT(xk(1)),Lk(function(){return"Active"===u.$?l(CA,0,0,1):AR}())]),Rk)),g=i?f(NN,O(kK(e),O($(u,TK)?IK:NK,F([BT(Nk)]))),F([d,p,s])):f(NN,O(kK(e),O($(u,TK)?IK:NK,F([Gk,Zk(wK(r))]))),F([d]));return!e&&$(u,TK)?f(AN,F([BT(Nk),hN(20),C$({bottom:20,left:0,right:0,top:0})]),F([g,EK(n.terms.paymentMethods)])):g}),XK=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f(NN,F([cN,Yk(12),KN(30),hN(10),Lk(TF),aN(24),tN,IA(Fk)]),F([Qp("Trade "+SK(r.state.closedReason)),CK])):e?f(AN,F([BT(Nk),hN(10)]),F([f(NN,F([BT(Nk),TT(IT),hN(20)]),F([g(QK,e,t,io,r,a,$(n,io),i),g(QK,e,t,aC,r,a,$(n,aC),i),g(QK,e,t,iC,r,a,$(n,iC),i)])),EK(r.terms.paymentMethods)])):f(AN,F([BT(Nk),TT(IT),hN(20)]),F([g(QK,e,t,io,r,a,$(n,io),i),g(QK,e,t,aC,r,a,$(n,aC),i),g(QK,e,t,iC,r,a,$(n,iC),i)]))}),ZK=a(function(e,t,r,n){var a=e>1300;return L(function(){var e=n.trade;switch(e.$){case"LoadedTrade":var i=e.a;return f(AN,F([BT(Nk),TT(Nk),hN(40)]),F([p(EF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Bk,F([BT(Nk),f(Hk,40,0),hN(40)]),p(XK,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Bk,F([cN,ON,aN(30)]),Qp("Loading trade info..."));default:return f(Bk,F([cN,ON,aN(30)]),Qp("Invalid trade"))}}(),F([MO(n),jO(n)]))}),eH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),tH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(qD(Dk(Qv(ny))),mr);case"CreateModel":var n=r.a;return L(f(Df,Oy,DD(n)),mr);case"QuickCreateModel":var a=r.a;return l(eH,Df(Vy),nu(Df(Vy)),AO(a));case"TradeModel":var i=r.a;return l(eH,Df(Hy),nu(Df(Hy)),d(ZK,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Df,vT,l(XU,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Df,dT,l(R$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Bk,F([BT(Nk),TT(Nk),Yk(10)]),n),a)}),rH=function(e){return{$:"DismissNotice",a:e}},nH=r(function(e,t){var n=function(){return"Error"===t.noticeType.$?l(CA,1,1,1):l(CA,0,0,0)}(),a=function(){switch(t.noticeType.$){case"Update":return l(Tk,100,200,255);case"Caution":return l(Tk,255,188,0);case"Error":return l(Tk,255,70,70);default:return l(Tk,200,200,200)}}(),i=f(Bk,F([TN,V$,X$(5),bK(5)]),P$(rH(e)));return f(Bk,F([Lk(a),Yk(10),KN(8),BT(Nk),d$(1),f$(d(JR,0,0,0,.15)),nD]),f(AN,F([hN(4),BT(Nk)]),f(ji,r(function(e,t){return f(vN,F([BT(Nk),IA(n)]),e?t:f(za,i,t))}),t.mainParagraphs)))}),aH=function(e){return $(e,mr)?Rk:f(AN,F([xU(20),X$(20),hN(10),TN,lx,BT(xk(300)),aN(15)]),f(ji,nH,e))},iH=r(function(e,t){var r=f(tH,e,t),n=r.a,a=r.b;return L(f(AN,F([kR(Pk),H$(RN(t)),BT(Nk),TT(Nk),KN(30)]),F([f(Bk,F([TT(xk(50))]),Rk),n])),O(a,F([aH(t.userNotices)])))}),oH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),uH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),sH={$:"AllowHover"},cH={$:"Layout"},fH={backgroundColor:Ca,borderColor:Ca,shadow:ba({blur:3,color:d(bA,155/255,203/255,1,1),offset:L(0,0),size:3})},lH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ba(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ba(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ba(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?fH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?sH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?cH:t.a}()}}(l(Xa,t,{focus:Ca,hover:Ca,mode:Ca},e))},dH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(xT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),xT);case"Text":var a=t.a;return UI(a);default:return UI("")}}),hH=n(function(e,t,r){var n=lH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?oH(n):uH(n)}();return f(dH,a,d(vA,xT,Ak,t,RT(F([r]))))}),pH=iw(5),gH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),vH={$:"SansSerif"},yH=function(e){return{$:"Typeface",a:e}},mH=W,bH=r(function(e,t){return O(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(zi,"-",mH(ll(t)));case"ImportFont":var t=e.a;e.b;return f(zi,"-",mH(ll(t)));default:var t=e.a.name;return f(zi,"-",mH(ll(t)))}}())}),CH=function(){var e=F([yH("Open Sans"),yH("Helvetica"),yH("Verdana"),vH]);return F([f(TA,_k,l(EA,"bg-color-"+wA(d(bA,1,1,1,0)),"background-color",d(bA,1,1,1,0))),f(TA,SA,l(EA,"font-color-"+wA(d(bA,0,0,0,1)),"color",d(bA,0,0,0,1))),f(TA,rN,nN(20)),f(TA,pH,f(gH,l(Wa,bH,"font-",e),e))])}(),SH=n(function(e,t,r){var n=e.options;return l(hH,n,f(za,yA(f(zi," ",F([DT.root,DT.any,DT.single]))),O(CH,t)),r)}),EH=SH({options:mr}),TH=function(e){return f(TA,pH,f(gH,l(Wa,bH,"ff-",e),e))},wH=vH,IH=yH,AH=function(e){return{body:F([function(){var t=f(iH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([BT(Nk),TT(Nk),TH(F([IH("Soleil"),wH]))]),f(nu,H$,n));return f(EH,a,r)}()]),title:"DAIHard"}},BH=jt,kH=BH({init:CB,onUrlChange:Ek,onUrlRequest:Sk,subscriptions:Ck,update:lB,view:AH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:kH(f(xo,function(e){return f(xo,function(t){return f(xo,function(r){return Po({height:r,networkId:t,width:e})},f(Fd,"height",eS))},f(Fd,"networkId",eS))},f(Fd,"width",eS)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?(window.ethereum&&(window.ethereum.autoRefreshOnNetworkChange=!1),web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),a(app),i(app,web3)})):(window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),a(app),console.log("Metamask not detected."))}function a(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function i(e,t){o(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&u(e,t)})}function o(e,t){l.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){u(e,t)})}function u(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),c.txSentry(e.ports.txOut,e.ports.txIn,t),c.walletSentry(e.ports.walletSentryPort,t),l.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){f.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=f.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=f.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 s=r(41),c=(r.n(s),r(40)),f=r(39),l=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,f),k(n,e[0],e[1]),k(f,t[0],t[1]),$(n,n,f),$(a,e[3],t[3]),$(a,a,F),$(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),$(e[0],o,u),$(e[1],c,s),$(e[2],s,u),$(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,t[0],a),$(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),R(a,e[1]),$(i,a,M),N(a,a,e[2]),k(i,e[2],i),R(o,i),R(u,o),$(s,u,o),$(r,s,a),$(r,r,i),v(r,r),$(r,r,a),$(r,r,i),$(r,r,i),$(e[0],r,i),R(n,e[0]),$(n,n,i),y(n,a)&&$(e[0],e[0],j),R(n,e[0]),$(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),$(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)R(n,n),1!==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 S(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 E(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),S(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)R(n,n),2!==r&&4!==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(55),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(43),Q=r(44),X=r(45);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 S(this,e,t,r);case"utf8":case"utf-8":return E(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^E),E^=t,S^=t<<4,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=858993459&(S>>>2^E),E^=t,S^=t<<2,t=65535&(E>>>-16^S),S^=t,E^=t<<-16,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=16711935&(E>>>8^S),S^=t,E^=t<<8,t=1431655765&(S>>>1^E),E^=t,S^=t<<1,t=S<<8|E>>>20&240,S=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var T=0;T>>26,E=E<<2|E>>>26):(S=S<<1|S>>>27,E=E<<1|E>>>27),S&=-15,E&=-15;var w=r[S>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|o[S>>>12&15]|u[S>>>8&15]|s[S>>>4&15],I=c[E>>>28]|f[E>>>24&15]|l[E>>>20&15]|d[E>>>16&15]|h[E>>>12&15]|p[E>>>8&15]|g[E>>>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[S>>>24&63]|l[S>>>16&63]|h[S>>>8&63]|g[63&S]|s[E>>>24&63]|f[E>>>16&63]|d[E>>>8&63]|p[63&E])}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 S(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 E(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 S=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,S,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 R(e){this.m=e}function $(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 R(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 W(){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 Re(e){var t=a();return this.divRemTo(e,t,null),t}function $e(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 Ye(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 R(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,E,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,S,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(),S=2,f()}function f(){if(S<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++S,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 S=2;S<=i;++S)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)&~S)+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,[]),S=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=S&&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,S=r.verify?r.verify(C,u,n):C;if(!0!==S)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||f.util.isArray(S)?"string"==typeof S&&(o.error=S):(S.message&&(o.message=S.message),S.error&&(o.error=S.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),S=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(S)}var E=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));E=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,[E]),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),R=c.hmac.create();R.start(u,e),R.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,$.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,S,E,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],S=e[2][1],E=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],R=e[7][0],$=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|S&(y^b))>>>0,L=$+l+h+f[x][1]+t[x][1],n=R+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,R=k,$=N,k=A,N=B,A=w,B=I,L=T+a,w=E+n+(L/4294967296>>>0)>>>0,I=L>>>0,E=C,T=S,C=m,S=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]+S,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]+E+(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]+$,e[7][0]=e[7][0]+R+(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=E,null!==e.session.clientCertificate&&(e.expect=S),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=E,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,S=3,E=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,R=f.handleHeartbeat,$=[];$[f.ConnectionEnd.client]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]],$[f.ConnectionEnd.server]=[[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[I,B,k,I,R],[A,B,I,I,R],[I,B,k,I,R],[I,B,k,N,R],[I,B,k,I,R]];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=$[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,t,r,n={};n.startWatching=function(e,n){t=e,r=n,setInterval(a,100)};var a=function(){r.version.getNetwork(function(r,n){r?console.log("error with web3.version.getNetwork: ",r):n!=e&&(t.send(parseInt(n)),e=n)})};return n}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return T(e,t?"True":"False");if("number"==typeof t)return w(e,t+"");if(t instanceof String)return A(e,"'"+E(t,!0)+"'");if("string"==typeof t)return I(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return k(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(S(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return T(e,"Set")+B(e,".fromList")+" "+S(e,Ga(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+S(e,ja(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+S(e,Va(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=S(e,t.a),t=t.b);t.b;t=t.b)n+=","+S(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=S(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return T(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return I(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return k(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(B(e,f)+" = "+S(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return k(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 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){return e?""+t+"":t}function N(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+"` "+R(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 "+R(c)+"\n\nIt received the following value:\n\n "+C(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 R(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=x(e,t,0,n);a&&(r=n.pop());a=x(r.a,r.b,0,n));return a}function x(e,t,r,n){if(r>100)return n.push(L(e,t)),!0;if(e===t)return!0;if("object"!=typeof e||null===e||null===t)return"function"==typeof e&&N(5),!1;"Set_elm_builtin"===e.$&&(e=Ga(e),t=Ga(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=ja(e),t=ja(t));for(var a in e)if(!x(e[a],t[a],r+1,n))return!1;return!0}function _(e,t,r){if("object"!=typeof e)return e===t?0:e=t.length)return ge("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=le(e.b,t[a]);return ki(n)?n:Ai(f($i,a,n.a));case 8:if("object"!=typeof t||null===t||he(t))return ge("an OBJECT",t);var i=mr;for(var o in t)if(t.hasOwnProperty(o)){var n=le(e.b,t[o]);if(!ki(n))return Ai(f(Ri,o,n.a));i=M(L(o,n.a),i)}return Bi(Ja(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=_e(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=be(i(t.a)),s=0;s0&&bt(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 bt(r,0,n,t):((h?St(l,d):l===d)||bt(r,2,n,d),void Ct(p,g,r,n+1));case 0:return void(e.a!==t.a&&bt(r,3,n,t.a));case 1:return void Et(e,t,r,n,wt);case 2:return void Et(e,t,r,n,It);case 3:if(e.h!==t.h)return void bt(r,0,n,t);var v=Tt(e.d,t.d);v&&bt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&bt(r,5,n,y))}}}function St(e,t){for(var r=0;ru?bt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&bt(r,8,n,{w:a,x:o,y:k})}function At(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 Ct(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}At(e,t,r+Jn,n,a,i)}function Bt(e,t,r,n,a){var i=e[r];if(!i){var o=bt(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 Ct(n,i.z,u,a),void bt(t,9,a,{w:u,A:i})}Bt(e,t,r+Jn,n,a)}function kt(e,t,r,n){Nt(e,t,r,0,0,t.b,n)}function Nt(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)kt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&Nt(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&&Nt(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 Nt(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 Rt(e,t,r,n){return 0===r.length?e:(kt(e,t,r,n),$t(e,r))}function $t(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Oh,o,function(e){return ba(Mh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Vh,e,L(r,zh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Vh,e,L(r,Gh({received:n.loaded,size:n.lengthComputable?ba(n.total):Ca}))))})}function Ht(e,t){function r(){n=1===n?0:(aa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&aa(r),n=2)}}function jt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(qt()))};return na({setup:function(e){return a.a=e,sa.addEventListener("popstate",a),sa.navigator.userAgent.indexOf("Trident")<0||sa.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=qt(),o=Eg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?fg(o):cg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Eg(Dn.location.href).a||N(1)}function Gt(e,t){return Ie(function(r){aa(function(){var n=document.getElementById(e);r(n?Te(t(n)):we(lg(e)))})})}function zt(e){return Ie(function(t){aa(function(){t(Te(e()))})})}function Yt(){return{scene:Wt(),viewport:{x:sa.pageXOffset,y:sa.pageYOffset,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight}}}function Wt(){var e=ua.body,t=ua.documentElement;return{width:Math.max(e.scrollWidth,e.offsetWidth,t.scrollWidth,t.offsetWidth,t.clientWidth),height:Math.max(e.scrollHeight,e.offsetHeight,t.scrollHeight,t.offsetHeight,t.clientHeight)}}function Jt(e){return Gt(e,function(e){var t=e.getBoundingClientRect(),r=sa.pageXOffset,n=sa.pageYOffset;return{scene:Wt(),viewport:{x:r,y:n,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Qt(e){return f(hg,dg,Ie(function(t){try{sa.location=e}catch(e){Dn.location.reload(!1)}}))}function Xt(e){try{return ba(decodeURIComponent(e))}catch(e){return Ca}}function Zt(){return f(_a,nu(As),f(_a,us,Is))}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 er,tr,rr=[],nr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),fr=(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 _(e,t)>=0}),r(function(e,t){var r=_(e,t);return r<0?Oa:r?Ka:Ua})),vr={$:"#0"},yr=r(O),mr={$:"[]"},br=r(M),Cr=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 F(n)}),Sr=(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 F(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 F(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 F(o)}),r(function(e,t){return F(V(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return F(V(t).sort(function(t,r){var n=f(e,t,r);return n===Ua?0:n===Oa?-1:1}))}),Tr=r(function(e,t){return e+t}),wr=r(function(e,t){return e-t}),Ir=r(function(e,t){return e*t}),Ar=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Br=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?N(11):r>0&&e<0||r<0&&e>0?r+e:r})),kr=Math.PI,Nr=(Math.E,Math.cos),Rr=Math.sin,$r=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),xr=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),Pr=(isNaN,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})),Dr=r(function(e,t){return e+t}),Ur=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),jr=r(function(e,t){return 0===t.indexOf(e)}),qr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),Gr=r(function(e,t){var r=e.length;if(r<1)return mr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return F(a)}),zr=oe(function(e){return"number"!=typeof e?ge("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return Ie(function(r){r(Te(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),wn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),In=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),An=n(function(e,t,r){return e.setUint8(t,r),t+1}),Bn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),kn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),Nn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),Rn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),$n=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}),_n=r(function(e,t){try{return ba(f(e,t,0).b)}catch(e){return Ca}}),Ln=(r(function(e,t){return L(t+1,e.getInt8(t))}),n(function(e,t,r){return L(r+2,t.getInt16(r,e))}),n(function(e,t,r){return L(r+4,t.getInt32(r,e))}),r(function(e,t){return L(t+1,e.getUint8(t))})),Pn=(n(function(e,t,r){return L(r+2,t.getUint16(r,e))}),n(function(e,t,r){return L(r+4,t.getUint32(r,e))}),n(function(e,t,r){return L(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return L(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return L(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Dn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ba(l):Ca}a.push(d(vd,n[0],n.index,i,F(f))),s=t.lastIndex}return t.lastIndex=u,F(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?ba(o):Ca}return r(d(vd,t,arguments[arguments.length-2],i,F(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,F(a)}),n(function(e,t,r){return Ie(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(qh)}),i.addEventListener("timeout",function(){a(Yh)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Mh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Hh(r.url))}return Ot(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ta=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ra=(r(function(e,t){return{$:0,d:t.d,b:t.b,a:function(r){return e(t.a(r))}}}),r(function(e,t){return{$:0,a:e,b:t}})),na=(r(function(e,t){return new Blob([t],{type:e})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:N(0),o=Dt(i);return Ht(r,function(e){var r=a(e),n=mt(o,r);i=Rt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return Le(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=Dn.title,o=Dn.body,u=Dt(o);return Ht(r,function(e){er=n;var r=a(e),s=On("body")(mr)(r.body),c=mt(u,s);o=Rt(o,u,c,t),u=s,er=0,i!==r.title&&(Dn.title=i=r.title)})})})),aa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ia=(r(function(e,t){return f(hg,dg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(hg,dg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(hg,dg,Ie(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),ua="undefined"!=typeof document?document:oa,sa="undefined"!=typeof window?window:oa,ca=(n(function(e,t,r){return ke(Ie(function(n){function a(e){Be(r(e))}return e.addEventListener(t,a,tr&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=le(e,t);return ki(r)?ba(r.a):Ca}),r(function(e,t){return Gt(t,function(t){return t[e](),vr})}),r(function(e,t){return zt(function(){return sa.scroll(e,t),vr})})),fa=(n(function(e,t,r){return Gt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,vr})}),r(function(e,t){return Ie(function(r){var n=setInterval(function(){Be(t)},e);return function(){clearInterval(n)}})})),la=function(e){return{$:"Native",a:e}},da={$:"XDai"},ha={$:"EthDai"},pa={$:"KovanDai"},ga={$:"Rootstock"},va={$:"RootstockTest"},ya=function(e){return{$:"Token",a:e}},ma=r(function(e,t){return e(t)}),ba=function(e){return{$:"Just",a:e}},Ca={$:"Nothing"},Sa=function(e){e:for(;;)switch(e.$){case"Mainnet":return ba(ya(ha));case"Kovan":return ba(ya(pa));case"RskMain":return ba(la(ga));case"RskTest":return ba(la(va));case"Private":if(100===e.a)return ba(la(da));break e;default:break e}return Ca},Ea={$:"ETCMain"},Ta={$:"ETCTest"},wa={$:"Expanse"},Ia={$:"Kovan"},Aa={$:"Mainnet"},Ba=function(e){return{$:"Private",a:e}},ka={$:"Rinkeby"},Na={$:"Ropsten"},Ra={$:"RskMain"},$a={$:"RskTest"},xa=function(e){switch(e){case 1:return Aa;case 2:return wa;case 3:return Na;case 4:return ka;case 30:return Ra;case 31:return $a;case 42:return Ia;case 41:return Ea;case 62:return Ta;default:return Ba(e)}},_a=n(function(e,t,r){return t(e(r))}),La=f(_a,xa,Sa),Pa=n(function(e,t,r){return{factoryType:e,httpProvider:t,wsProvider:r}}),Da=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return l(Pa,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws")}e.a;return l(Pa,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws")}switch(e.a.$){case"Eth":e.a;return l(Pa,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws");case"Kovan":e.a;return l(Pa,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws");case"XDai":e.a;return l(Pa,e,"https://dai.poa.network","");case"Rootstock":e.a;return l(Pa,e,"https://public-node.rsk.co","");default:e.a;return l(Pa,e,"https://public-node.testnet.rsk.co","")}},Ua={$:"EQ"},Oa={$:"LT"},Ma=cr,Fa=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(Ma,o,r,n)}var a=t.a;return l(Ma,e,r,a)});return l(Ma,o,l(Ma,e,t,i),a)}),Va=function(e){return l(Fa,za,mr,e)},Ka={$:"GT"},Ha=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(Ha,e,t,o)),c=i;e=u,t=s,r=c}}),ja=function(e){return l(Ha,n(function(e,t,r){return f(za,L(e,t),r)}),mr,e)},qa=function(e){return l(Ha,n(function(e,t,r){return f(za,e,r)}),mr,e)},Ga=function(e){var t=e.a;return qa(t)},za=br,Ya=Tr,Wa=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}}),Ja=function(e){return l(Wa,za,mr,e)},Qa=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(Wa,e,t,Ja(p)):d(Qa,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}),Xa=n(function(e,t,r){return d(Qa,e,t,0,r)}),Za=r(function(e,t){return t.b?l(Xa,za,t,e):e}),ei=r(function(e,t){return U(t,{userNotices:f(Za,t.userNotices,F([e]))})}),ti=r(function(e,t){return l(Wa,ei,t,e)}),ri=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),ni=$r,ai=r(function(e,t){return Lr(t)/Lr(e)}),ii=K,oi=ni(f(ai,2,32)),ui=rr,si=d(ri,0,oi,ui,ui),ci=function(e){return{$:"Leaf",a:e}},fi=function(e){return{$:"SubTree",a:e}},li=ar,di=r(function(e,t){for(;;){var r=f(li,32,e),n=r.a,a=r.b,i=f(za,fi(n),t);if(!a.b)return Ja(i);var o=a,u=i;e=o,t=u}}),hi=r(function(e,t){return t(e)}),pi=hr,gi=function(e){return e.a},vi=r(function(e,t){for(;;){var r=ni(t/32);if(1===r)return f(li,32,e).a;var n=f(di,e,mr),a=r;e=n,t=a}}),yi=xr,mi=r(function(e,t){return _(e,t)>0?e:t}),bi=Ir,Ci=wr,Si=m,Ei=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=yi(f(ai,32,r-1)),a=e?Ja(t.nodeList):t.nodeList,i=f(vi,a,t.nodeListSize);return d(ri,Si(t.tail)+r,f(mi,5,n*oi),i,t.tail)}return d(ri,Si(t.tail),oi,ui,t.tail)}),Ti=nr,wi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(Ei,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=ci(l(Ti,32,t,e)),o=e,u=t-32,s=r,c=f(za,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),Ii=r(function(e,t){if(e<=0)return si;var r=e%32,n=l(Ti,r,e-r,t);return h(wi,t,e-r-32,e,mr,n)}),Ai=function(e){return{$:"Err",a:e}},Bi=function(e){return{$:"Ok",a:e}},ki=function(e){return"Ok"===e.$},Ni=r(function(e,t){return{$:"Failure",a:e,b:t}}),Ri=r(function(e,t){return{$:"Field",a:e,b:t}}),$i=r(function(e,t){return{$:"Index",a:e,b:t}}),xi=function(e){return{$:"OneOf",a:e}},_i=yr,Li=j,Pi=function(e){var t=Li(e);return 97<=t&&t<=122},Di=function(e){var t=Li(e);return t<=90&&65<=t},Ui=function(e){return Pi(e)||Di(e)},Oi=function(e){var t=Li(e);return t<=57&&48<=t},Mi=function(e){return Pi(e)||Di(e)||Oi(e)},Fi=function(e){return l(Wa,r(function(e,t){return t+1}),0,e)},Vi=Cr,Ki=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(za,t,r);e=n,t=a,r=i}}),Hi=r(function(e,t){return l(Ki,e,t,mr)}),ji=r(function(e,t){return l(Vi,e,f(Hi,0,Fi(t)-1),t)}),qi=Kr,Gi=Z,zi=r(function(e,t){return f(Fr,e,V(t))}),Yi=z,Wi=r(function(e,t){return F(f(Mr,e,t))}),Ji=function(e){return f(zi,"\n ",f(Wi,"\n",e))},Qi=on,Xi=r(function(e,t){return"\n\n("+Gi(e+1)+") "+Ji(Zi(t))}),Zi=function(e){return f(eo,e,mr)},eo=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=Yi(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ui(n)&&f(qi,Mi,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(za,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Gi(s)+"]",o=n,u=f(za,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(zi,"",Ja(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Gi(Fi(l))+" ways:";return f(zi,"\n\n",f(za,h,f(ji,Xi,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(zi,"",Ja(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(zi,"",Ja(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Ji(f(Qi,4,g))+"\n\n")+p}}),to=Wr,ro=ze("txIn",to),no=function(e){return e},ao=qe("txOut",no),io={$:"Open"},oo=Me,uo=oo(mr),so=a(function(e,t,r,n){return L({agentAddress:t,agentRole:r,userInfo:n,viewPhase:io,web3Context:e},uo)}),co=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),fo={$:"None"},lo=fo,ho=function(e){return d(co,e,uo,lo,mr)},po=function(e){return{$:"GotoRoute",a:e}},go=function(e){return{$:"AbiDecoder",a:e}},vo=r(function(e,t){return{$:"Tape",a:e,b:t}}),yo=Y,mo=Vr,bo=r(function(e,t){return e<1?t:l(mo,e,yo(t),t)}),Co=bo(64),So=n(function(e,t,r){return L(f(vo,e,Co(t)),r)}),Eo=r(function(e,t){return e<1?"":l(mo,0,e,t)}),To=Eo(64),wo=r(function(e,t){if("Ok"===t.$){var r=t.a;return Bi(e(r))}var n=t.a;return Ai(n)}),Io=function(e){return-e},Ao=r(function(e,t){return e<1?"":l(mo,-e,yo(t),t)}),Bo=function(){var e=function(e){if(!f(qi,pi(D("0")),f(Eo,63,e)))return Ai("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Ao,1,e)){case"0":return Bi(!1);case"1":return Bi(!0);default:return Ai("Boolean decode error. "+e+" is not 1 or 0.")}};return go(function(t){var r=t.a,n=t.b;return f(wo,f(So,r,n),e(To(n)))})}(),ko=jr,No=function(e){return f(ko,"0x",e)||f(ko,"0X",e)?f(bo,2,e):e},Ro=function(e){return e.b},$o=r(function(e,t){var r=e.a;return f(wo,Ro,r(function(e){return f(vo,e,e)}(No(t))))}),xo=Zr,_o=ie,Lo=Jr,Po=ae,Do=function(e){return f(xo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Po(n)}var a=r.a;return _o(a)},Lo)},Uo=f(_a,$o,Do),Oo=function(e){return{$:"Magnitude",a:e}},Mo=function(e){return{$:"Pos",a:e}},Fo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Vo=function(e){return{$:"MagnitudeNotNormalised",a:e}},Ko=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 ba(n)}return Ca}},Ho=function(e){var t=Ko(e);return"Nothing"!==t.$&&t.a<0},jo=function(e){return{$:"Neg",a:e}},qo={$:"Zer"},Go=function(e){return!e.b},zo=r(function(e,t){var r=t.a;if(Go(r))return qo;switch(e.$){case"Zero":return qo;case"Positive":return Mo(t);default:return jo(t)}}),Yo=r(function(e,t){return f(Fo,e,Vo(t))}),Wo=function(e){return f(Xa,r(function(t,r){return e(t)&&Go(r)?mr:f(za,t,r)}),mr)}(pi(0)),Jo=Ar,Qo=-1+f(Jo,10,7),Xo=Qo+1,Zo=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),eu=function(e){return e<0?f(Zo,Ya(-1),eu(e+Xo)):L(e/Xo|0,e%Xo)},tu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=eu(r+e),i=a.a,o=a.b;return f(za,o,f(tu,i,n))}{if(!(_(e,Xo)>0))return F([e]);var u=F([e]);e=0,t=u}}}),ru=function(e){var t=e.a;return Oo(Wo(f(tu,0,t)))},nu=r(function(e,t){return l(Xa,r(function(t,r){return f(za,e(t),r)}),mr,t)}),au=nu(Io),iu={$:"Negative"},ou={$:"Positive"},uu={$:"Zero"},su=function(e){switch(e.$){case"Positive":return iu;case"Negative":return ou;default:return uu}},cu=function(e){for(;;){var t=e.a,r=e.b,n=ru(r),a=n.a;if(!Ho(a))return f(zo,t,Oo(a));e=f(Yo,su(t),au(a))}},fu=gr,lu=function(e){switch(f(fu,e,0).$){case"LT":return iu;case"GT":return ou;default:return uu}},du=function(e){return e<0?-e:e},hu=function(e){return cu(f(Fo,lu(e),Vo(F([du(e)]))))},pu=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(Jo,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},gu=function(e){switch(e.$){case"Zer":return qo;case"Neg":var t=e.a;return Mo(t);default:return e}},vu=function(e){return{$:"MagnitudePair",a:e}},yu=r(function(e,t){var r=L(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(za,L(a,u),f(yu,i,s))}var c=r.a,a=c.a,i=c.b;return f(za,L(a,0),f(yu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(za,L(0,u),f(yu,mr,s))}return mr}),mu=r(function(e,t){var r=e.a,n=t.a;return vu(f(yu,r,n))}),bu=function(e){switch(e.$){case"Zer":return f(Yo,uu,mr);case"Neg":var t=e.a.a;return f(Yo,ou,au(t));default:var t=e.a.a;return f(Yo,ou,t)}},Cu=r(function(e,t){var r=bu(t),n=r.b,a=bu(e),i=a.b,o=f(mu,i,n),u=o.a,s=f(nu,function(e){return e.a+e.b},u);return cu(f(Fo,ou,Vo(s)))}),Su=a(function(e,t,r,n){e:for(;;){var a=L(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 Ka}return a.b.b?Oa:f(fu,e,t)}}),Eu=function(e){switch(e.$){case"LT":return Ka;case"EQ":return Ua;default:return Oa}},Tu=r(function(e,t){var r=L(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(Su,0,0,n,a)}return Ka;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Eu(d(Su,0,0,n,a))}return Oa;default:switch(r.b.$){case"Pos":r.a;return Oa;case"Zer":r.a,r.b;return Ua;default:r.a;return Ka}}}),wu=r(function(e,t){return $(f(Tu,e,t),Ka)}),Iu=H,Au=r(function(e,t){return!f(wu,e,t)}),Bu=function(e){switch(e.$){case"Zer":return Oo(mr);case"Pos":default:var t=e.a;return t}},ku=r(function(e,t){var r=e.a;return ru(Vo(f(nu,bi(t),r)))}),Nu=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(ku,Oo(n),a),u=f(Nu,Oo(i),Oo(n)),s=u.a,c=f(Cu,f(zo,ou,o),f(zo,ou,Oo(f(za,0,s))));return Bu(c)}var a=r.a;return f(ku,Oo(n),a)}return Oo(mr)}),Ru=function(e){switch(e.$){case"Zer":return uu;case"Pos":return ou;default:return iu}},$u=r(function(e,t){return $(e,uu)||$(t,uu)?uu:$(e,t)?ou:iu}),xu=r(function(e,t){return f(zo,f($u,Ru(e),Ru(t)),f(Nu,Bu(e),Bu(t)))}),_u=function(e){switch(e.$){case"Zer":return qo;case"Pos":var t=e.a;return jo(t);default:var t=e.a;return Mo(t)}},Lu=r(function(e,t){return f(Cu,e,_u(t))}),Pu=hu(0),Du=a(function(e,t,r,n){if(e){var a=hu(e),i=f(xu,f(xu,a,n),t),o=f(Au,i,r)?L(f(xu,a,t),f(Lu,r,i)):L(Pu,r),u=o.a,s=o.b,c=d(Du,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Cu,u,l),h)}return L(Pu,r)}),Uu=ni(f(ai,2,Qo)),Ou=n(function(e,t,r){return d(Du,f(Jo,2,Uu),e,t,r)}),Mu=hu(1),Fu=r(function(e,t){return e}),Vu=n(function(e,t,r){return l(Wa,Fu(e),t,f(Hi,1,r))}),Ku=function(e){return l(Vu,xu(hu(Xo)),Mu,e)},Hu=n(function(e,t,r){if(e){var n=l(Ou,Ku(e),t,r),a=n.a,i=n.b,o=l(Hu,e-1,i,r),u=o.a,s=o.b;return L(f(Cu,a,u),s)}return l(Ou,Ku(e),t,r)}),ju=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},qu=r(function(e,t){if($(t,Pu))return Ca;var r=Fi(ju(e))-Fi(ju(t))+1,n=l(Hu,f(mi,0,r),gu(e),gu(t)),a=n.a,i=n.b;return ba(L(f(zo,f($u,Ru(e),Ru(t)),Bu(a)),f(zo,Ru(e),Bu(i))))}),Gu=f(xu,hu(2),hu(2147483648)),zu=Pr,Yu=function(e){return f(zu,e,"")},Wu=Sn,Ju=n(function(e,t,r){return e<=0?r:l(Ju,e>>1,O(t,t),1&e?O(r,t):r)}),Qu=r(function(e,t){return l(Ju,e,t,"")}),Xu=n(function(e,t,r){return O(f(Qu,e-yo(r),Yu(t)),r)}),Zu=re,es=Br,ts=function(e){e:for(;;)switch(e){case 0:return D("0");case 1:return D("1");case 2:return D("2");case 3:return D("3");case 4:return D("4");case 5:return D("5");case 6:return D("6");case 7:return D("7");case 8:return D("8");case 9:return D("9");case 10:return D("a");case 11:return D("b");case 12:return D("c");case 13:return D("d");case 14:return D("e");case 15:return D("f");default:var t=e;e=t;continue e}},rs=r(function(e,t){for(;;){if(t<16)return f(za,ts(t),e);var r=f(za,ts(f(es,16,t)),e),n=t/16|0;e=r,t=n}}),ns=function(e){return Zu(e<0?f(za,D("-"),f(rs,mr,-e)):f(rs,mr,e))},as=function(e){var t=f(qu,e,Gu);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=ns(pu(a));return $(n,hu(0))?i:O(as(n),l(Xu,8,D("0"),i))},is=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Oo(mr))?"0":as(Mo(t));default:var t=e.a;return"-"+is(f(xu,hu(-1),e))}},os=function(e){return l(Xu,64,D("0"),e)},us=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=os(ns(a)),c=function(e){return O(e,n)}(os(ns(u)));return P(a+32+(yo(n)/2|0),O(i,s),O(o,c))}return P(a,O(i,n),o)});return function(e){return O(e.b,e.c)}(l(Wa,t,P(32*Fi(e),"",""),e))},ss=Ur,cs=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))))}),fs=n(function(e,t,n){return l(ss,r(function(t,r){return l(cs,e,Li(t),r)}),t,n)}),ls=function(e){return Ja(l(fs,za,mr,e))},ds=function(e){return f(zi,"",f(nu,f(_a,ns,f(Xu,2,D("0"))),ls(e)))},hs=function(e){return 64-f(es,64,e)},ps=function(e){return O(e,f(Qu,hs(yo(e)),"0"))},gs=function(e){return L(ba(yo(e)/2|0),ps(e))},vs=function(e){return L(Ca,os(e))},ys=function(e){switch(e){case"0000":return D("0");case"0001":return D("1");case"0010":return D("2");case"0011":return D("3");case"0100":return D("4");case"0101":return D("5");case"0110":return D("6");case"0111":return D("7");case"1000":return D("8");case"1001":return D("9");case"1010":return D("a");case"1011":return D("b");case"1100":return D("c");case"1101":return D("d");case"1110":return D("e");case"1111":return D("f");default:return D("!")}},ms=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"}},bs=Or,Cs=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=L(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return L(f(zu,D("1"),r),!0);case"1":return L(f(zu,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(zu,D("0"),r),!1);case"1":return L(f(zu,D("1"),r),!0);default:break e}return L(r,!0)});return l(bs,t,L("",!1),e).a},Ss=function(e){return l(bs,za,mr,e)},Es=n(function(e,t,r){for(;;){if(""===t)return Ja(r);var n=e,a=f(bo,e,t),i=f(za,l(mo,0,e,t),r);e=n,t=a,r=i}}),Ts=r(function(e,t){return e&&""!==t?l(Es,e,t,mr):F([t])}),ws=function(e){var t=function(){var t=Ss(is(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(_a,Cs,f(Xu,256,D("1"))))}var r=t;return L(r,f(Xu,256,D("0")))}(),r=t.a,n=t.b;return Zu(f(nu,ys,f(Ts,4,n(f(zi,"",f(nu,ms,r))))))},Is=function(e){return{$:"Hex",a:e}},As=function(e){switch(e.$){case"AddressE":var t=e.a.a;return vs(t);case"UintE":var r=e.a;return vs(is(r));case"IntE":var n=e.a;return vs(ws(n));case"BoolE":return vs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return gs(a);case"BytesE":var a=e.a.a;return vs(No(a));case"StringE":var i=e.a;return gs(ds(i));case"ListE":var o=e.a;return function(e){var t=e.a;return gs(t)}(Zt()(o));default:var i=e.a;return vs(No(i))}};try{var Bs=Zt();Zt=function(){return Bs}}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 ks=Dr,Ns=function(e){return 1===yo(e)?f(ks,"0",e):e},Rs=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(za,n,r);e=i,t=o,r=u}}}),$s=r(function(e,t){return Ja(l(Rs,e,t,mr))}),xs=n(function(e,t,r){if(t<=0)return mr;var n=L(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 F([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 F([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(za,i,f(za,u,f(za,h,f(za,m,f($s,t-4,b))))):f(za,i,f(za,u,f(za,h,f(za,m,l(xs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),_s=r(function(e,t){return l(xs,0,e,t)}),Ls=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Ps=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 Qe(e.a)}},Ds={$:"LE"},Us=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Tn,t,r,n);case"I16":var a=e.a,n=e.b;return d(wn,t,r,n,$(a,Ds));case"I32":var a=e.a,n=e.b;return d(In,t,r,n,$(a,Ds));case"U8":var n=e.a;return l(An,t,r,n);case"U16":var a=e.a,n=e.b;return d(Bn,t,r,n,$(a,Ds));case"U32":var a=e.a,n=e.b;return d(kn,t,r,n,$(a,Ds));case"F32":var a=e.a,n=e.b;return d(Nn,t,r,n,$(a,Ds));case"F64":var a=e.a,n=e.b;return d(Rn,t,r,n,$(a,Ds));case"Seq":var i=e.b;return l(Os,i,t,r);case"Utf8":var o=e.b;return l(xn,t,r,o);default:var i=e.a;return l($n,t,r,i)}}),Os=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Us,n,t,r);e=i,t=o,r=u}}),Ms=Xe,Fs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Vs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Ps(r),i=n;e=a,t=i}}),Ks=function(e){return f(Fs,f(Vs,0,e),e)},Hs=function(e){return{$:"U8",a:e}},js=Hs,qs=r(function(e,t){return _(e,t)<0?e:t}),Gs=pr,zs=function(e){return{$:"Bytes",a:e}},Ys=zs,Ws=function(e){return Ms(Ks(f(nu,Ys,Ja(e))))},Js=Qe,Qs=r(function(e,t){var r=e.a;return f(_n,r,t)}),Xs=function(e){return{$:"Decoder",a:e}},Zs=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 L(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),ec=r(function(e,t){return Xs(f(Zs,e,t))}),tc=Xs(Ln),rc=r(function(e,t){if("Just"===t.$){return t.a}return e}),nc=function(e){return{$:"Done",a:e}},ac=function(e){return{$:"Loop",a:e}},ic=r(function(e,t){var n=t.a;return Xs(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),oc=function(e){return Xs(r(function(t,r){return L(r,e)}))},uc=r(function(e,t){var r=t.a,n=t.b;return r<=0?oc(nc(Ja(n))):f(ic,function(e){return ac(L(r-1,f(za,e,n)))},e)}),sc=function(e){return f(rc,mr,f(Qs,f(ec,L(Js(e),mr),uc(tc)),e))},cc=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return L(f(e,n,i),f(e,a,o))}),fc=r(function(e,t){return l(cc,Wu,e,t)}),lc=f(Hi,0,4),dc=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}}),hc=Je,pc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),gc=function(e){return f(pc,f(_a,hc,Wu(4294967295)),e)},vc=r(function(e,t){return 5*t+e}),yc=4294967295>>>32-oi,mc=ir,bc=n(function(e,t,r){for(;;){var n=yc&t>>>e,a=f(mc,n,r);if("SubTree"!==a.$){var i=a.a;return f(mc,yc&t,i)}var o=a.a,u=e-oi,s=t,c=o;e=u,t=s,r=c}}),Cc=function(e){return e>>>5<<5},Sc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?Ca:ba(_(e,Cc(r))>-1?f(mc,yc&e,i):l(bc,n,e,a))}),Ec=r(function(e,t){var r=f(Sc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Tc=n(function(e,t,r){var n=f(vc,e,t);return f(Ec,n,r)}),wc=or,Ic=a(function(e,t,r,n){var a=yc&t>>>e,i=f(mc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Ic,e-oi,t,r,o);return l(wc,a,fi(u),n)}var s=i.a,c=l(wc,yc&t,r,s);return l(wc,a,ci(c),n)}),Ac=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||_(e,n)>-1?r:_(e,Cc(n))>-1?d(ri,n,a,i,l(wc,yc&e,t,o)):d(ri,n,a,d(Ic,a,e,t,i),o)}),Bc=n(function(e,t,r){return l(Ac,e,t,r)}),kc=a(function(e,t,r,n){var a=f(vc,e,t);return l(Bc,a,r,n)}),Nc=En,Rc=r(function(e,t){return l(cc,Nc,e,t)}),$c=function(e){var t=l(Xa,r(function(t,n){var a={d0:l(Tc,0,t,e.state),d1:l(Tc,1,t,e.state),d2:l(Tc,2,t,e.state),d3:l(Tc,3,t,e.state),d4:l(Tc,4,t,e.state)},i=r(function(e,r){return d(kc,e,t,f(Rc,f(dc,e,a),f(fc,gc(f(dc,f(es,5,e+1),a)),f(dc,f(es,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,lc);return U(e,{state:t})},xc=L(0,0),_c=function(e){return{current:xc,lfsrstate:1,state:e,x:1,y:0}},Lc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Pc=L(1,0),Dc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Uc=r(function(e,t){if(e){var n=f(Dc,1,t);return l(cc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Oc=r(function(e,t){var r=f(es,32,e/32|0),n=f(Dc,r,t),a=f(es,32,e);return f(Uc,a,n)}),Mc=n(function(e,t,r){var n=f(Sc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Ac,e,t(a),r)}),Fc=n(function(e,t,r){return l(Mc,e,Rc(t),r)}),Vc=a(function(e,t,r,n){var a=f(vc,e,t);return l(Fc,a,r,n)}),Kc=function(e){return l(Wa,r(function(e,t){var r=(1<>r}),Jc=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(qs,n,r),i=f(nu,function(e){return f(Wc,e,g)},f(Hi,0,a)),o=Yc(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f(_s,i.outputLen,l(v,g,mr,i.outputLen))},ef=function(e){return{$:"KS",a:e}},tf=function(e){var t=e.a;return ef({config:t,inputLength:0,partial:mr,state:f(Ii,25,Fu(xc))})},rf=function(e){return Xs(Pn(e))},nf=Ms(Ks(mr)),af=r(function(e,t){var n=t.a;return Xs(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),of=r(function(e,t){return f(af,function(e){return rf(t)},rf(e))}),uf=r(function(e,t){return f(rc,nf,f(Qs,f(of,e,Js(t)-e),t))}),sf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Js(e)?f(za,e,n.partial):n.partial;if(!(_(l(Wa,r(function(e,t){return t+Js(e)}),0,i),a)>-1))return ef(U(n,{inputLength:Js(e)+n.inputLength,partial:i}));var o=Ws(i),u=f(rc,nf,f(Qs,rf(a),o)),s=sc(u),c=f(Xc,s,n.state),d=Yc(c),h=f(uf,a,o),p=nf,g=ef(U(n,{inputLength:Js(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),cf=r(function(e,t){return Zc(f(sf,Ms(Ks(f(nu,js,t))),tf(e)))}),ff=cf(Ls),lf=function(e){return Is(f(zi,"",f(nu,f(_a,ns,Ns),f(_s,4,ff(f(nu,Li,Ss(e)))))))},df=function(e){return f(ko,"0x",e)||f(ko,"0X",e)?e:"0x"+e},hf=function(e){var t=e.a;return df(t)},pf=r(function(e,t){var r=us(f(nu,As,t)),n=function(e){return O(e,r)}(No(hf(lf(e))));return Is(n)}),gf=function(e){return{data:ba(f(pf,"poke()",mr)),decoder:Uo(Bo),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},vf=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),yf=r(function(e,t){return f(vf,e,t)}),mf=r(function(e,t){return{$:"AgentHistory",a:e,b:t}}),bf=function(e){return{$:"Trade",a:e}},Cf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Sf=r(function(e,t){switch(e.$){case"ViewUserRoleChanged":var r=e.a;return d(co,t,uo,lo,F([po(f(mf,t.agentAddress,r))]));case"ViewPhaseChanged":var n=e.a;return d(co,U(t,{viewPhase:n}),uo,lo,mr);case"Poke":var a=e.a,i=Cf(gf(a)),o={onBroadcast:Ca,onMined:Ca,onSign:Ca},u=f(yf,o,i);return d(co,t,uo,u,mr);case"TradeClicked":var s=e.a;return d(co,t,uo,lo,F([po(bf(s))]));default:return ho(t)}}),Ef=function(e){return{$:"GTag",a:e}},Tf=function(e){return{$:"UserNotice",a:e}},wf={$:"Web3Connect"},If=r(function(e,t){return{mainParagraphs:t,noticeType:e}}),Af=n(function(e,t,r){return e(t(r))}),Bf=en,kf=tn,Nf=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Rf=Vn,$f={$:"Empty"},xf=function(e){return{$:"Styled",a:e}},_f=function(e){return{$:"Text",a:e}},Lf=function(e){return{$:"Unstyled",a:e}},Pf=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return xf({html:r(function(t,r){return f(Rf,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Lf(f(Af,Rf(e),a));case"Text":var i=t.a;return _f(i);default:return $f}}),Df=Pf,Uf=r(function(e,t){return f(If,t.noticeType,f(nu,nu(Df(e)),t.mainParagraphs))}),Of=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return Tf(f(Uf,e,r));case"Web3Connect":return wf;case"GotoRoute":var n=t.a;return po(n);default:var a=t.a;return Ef(a)}}),Mf=r(function(e,t){return f(nu,Of(e),t)}),Ff={$:"Seller"},Vf=function(e){return{$:"Posix",a:e}},Kf=Vf,Hf={autoabortInterval:Kf(0),autorecallInterval:Kf(0),autoreleaseInterval:Kf(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:Ff},jf=function(e){return{$:"TokenValue",a:e}},qf=function(e){return e.a},Gf=r(function(e,t){if("Just"===t.$){var r=t.a;return ba(e(r))}return Ca}),zf=r(function(e,t){return f(rc,Pu,f(Gf,gi,f(qu,e,t)))}),Yf=r(function(e,t){return jf(f(zf,qf(e),hu(t)))}),Wf=function(e){return f(Yf,e,12)},Jf=function(e){return f(Yf,e,3)},Qf=jf(hu(0)),Xf=r(function(e,t){var r=Qf;return{abortPunishment:Wf(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Jf(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Zf=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";case"Rootstock":e.a;return"SBTC";case"RootstockTest":e.a;return"SBTC";default:e.a;return"xDai"}},el=function(e){if(e.b){var t=e.a;e.b;return ba(t)}return Ca},tl=Gr,rl=function(e){var t=el(f(tl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=yo(e)-1-r;return L(O(f(Eo,r,e),f(bo,r+1,e)),n)},nl=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 mr}}),al=function(e){var t=e.a,r=f(nl,pi(0),t);return Oo(r.b?t:mr)},il=ee,ol=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}}}),ul=n(function(e,t,r){var n=f(ol,t,r),a=Fi(r)>0;return e>0&&t>0&&a?f(za,f(_s,e,r),l(ul,e,t,n)):mr}),sl=r(function(e,t){return l(ul,e,e,t)}),cl=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return Ca;var a=n.a;return f(Gf,za(a),r)});return f(Xa,t,ba(mr))}(no),fl=function(e){return f(Gf,f(Af,al,Oo),cl(f(nu,f(_a,Ja,f(_a,Zu,il)),f(sl,7,Ja(e)))))},ll=X,dl=function(e){var t=Ss(ll(e));if(!t.b)return Ca;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Gf,zo(iu),fl(r))}return Ca;case"+":if(t.b.b){var r=t.b;return f(Gf,zo(ou),fl(r))}return Ca;default:var r=t;return f(Gf,zo(ou),fl(r))}},hl=function(e){var t=function(e){return!f(es,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(rc,0,el(r)))}},pl=function(e){return f(xu,e,e)},gl=hu(2),vl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Mu;case"Neg":return qo;default:if($(r,Mu))return f(xu,e,t);if(hl(r)){var n=e,a=pl(t),i=f(zf,r,gl);e=n,t=a,r=i;continue e}var n=f(xu,t,e),a=pl(t),i=f(zf,f(Lu,r,Mu),gl);e=n,t=a,r=i;continue e}}),yl=r(function(e,t){return l(vl,Mu,e,t)}),ml=function(e){if(""===e)return Ca;var t=rl(e),r=t.a,n=t.b,a=dl(r),i=18-n;if(i<0)return Ca;if("Nothing"===a.$)return Ca;var o=a.a,u=f(xu,o,f(yl,hu(10),hu(i)));return ba(u)},bl=function(e){return f(Gf,jf,ml(e))},Cl=qr,Sl=function(e){for(;;){if(f(Cl,".",e))return l(mo,0,-1,e);{if(!f(Cl,"0",e))return""===e?"0":e;e=l(mo,0,-1,e)}}},El=f(Af,f(Xu,7,D("0")),Gi),Tl=function(e){return f(zi,"",e)},wl=function(e){var t=e.a,r=Ja(t);if(r.b){var n=r.a,a=r.b;return Tl(f(za,Gi(n),f(nu,El,a)))}return"0"},Il=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return wl(t);default:var t=e.a;return"-"+wl(t)}},Al=r(function(e,t){return e<1?t:l(mo,0,-e,t)}),Bl=function(e){var t=l(Xu,18,D("0"),Il(e)),r=f(Al,18,t)+"."+f(Ao,18,t);return function(e){return""===e?"0":e}(Sl(r))},kl=r(function(e,t){var r=Bl(t),n=el(f(tl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Eo,a+1+e,r):f(Eo,a,r)}),Nl=r(function(e,t){if("Nothing"===e.$)return Bl(qf(t));var r=e.a;return f(kl,r,qf(t))}),Rl=dr,$l=te,xl=function(e){var t=$l(f(Nl,Ca,e));if("Just"===t.$){return t.a}f(Rl,"Error converting tokenValue to float: string -> float failed",e);return 0},_l=r(function(e,t){if(""===t)return Ai("You must specify a trade amount.");var r=bl(t);if("Nothing"===r.$)return Ai("I don't understand this number.");var n=r.a;return xl(n)<1?Ai("Trade amount must be a least 1 "+Zf(e)+"."):Bi(n)}),Ll=function(e){if(""===e)return Ai("You must specify a fiat price.");var t=dl(e);if("Nothing"===t.$){var r=$l(e);return Ai("Just"===r.$?"Fractional fiat amounts (i.e. $1.20) are not supported. Use a whole number.":"I don't understand this number.")}var n=t.a;return Bi(n)},Pl=r(function(e,t){if("Just"===t.$){var r=t.a;return Bi(r)}return Ai(e)}),Dl=function(e){return""===e},Ul=function(e){return Dl(e)?Ca:ba(e)},Ol=function(e){return f(Pl,"You must specify a fiat type.",Ul(e))},Ml=function(e){return""===e?Ai("Must specify a payment method."):Bi(e)},Fl=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Vl=g(Fl,Ca,Ca,Ca,Ca,Ca,Ca,Ca),Kl=function(e){var t=e.a,r=e.b,n=e.c,a=P(t,r,n);if("Ok"===a.a.$){if("Ok"===a.b.$){if("Ok"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a;return Bi(P(i,o,u))}var s=a.c.a;return Ai(s)}var c=a.b.a;return Ai(c)}var f=a.a.a;return Ai(f)},Hl=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),jl={$:"Custom"},ql=r(function(e,t){return{info:t,type_:e}}),Gl=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return Ai(o)}var u=t.a;if("Err"===r.$){var o=r.a;return Ai(o)}var s=r.a;if("Err"===n.$){var o=n.a;return Ai(o)}var c=n.a;if("Err"===a.$){var o=a.a;return Ai(o)}var f=a.a;if("Err"===i.$){var o=i.a;return Ai(o)}var l=i.a;return Bi(h(e,u,s,c,f,l))}),zl=r(function(e,t){if("Ok"===t.$){var r=t.a;return Bi(r)}var n=t.a;return Ai(e(n))}),Yl=function(e){return e.a},Wl=r(function(e,t){return p(Gl,i(function(e,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:t.userRole,paymentMethods:F([f(ql,jl,a)]),price:{amount:r,fiatType:n},tradeAmount:e}}),f(zl,function(e){return U(Vl,{daiAmount:ba(e)})},f(_l,e,t.daiAmount)),f(zl,function(e){return U(Vl,{fiatAmount:ba(e)})},Ll(t.fiatAmount)),f(zl,function(e){return U(Vl,{fiatType:ba(e)})},Ol(t.fiatType)),f(zl,function(e){return U(Vl,{paymentMethod:ba(e)})},Ml(t.paymentMethod)),Kl(d(Hl,function(e){return Yl(e)>0?Bi(e):Ai(U(Vl,{autorecallInterval:ba("Must specify a non-zero time for this window")}))},function(e){return Yl(e)>0?Bi(e):Ai(U(Vl,{autoabortInterval:ba("Must specify a non-zero time for this window")}))},function(e){return Yl(e)>0?Bi(e):Ai(U(Vl,{autoreleaseInterval:ba("Must specify a non-zero time for this window")}))},P(t.autorecallInterval,t.autoabortInterval,t.autoreleaseInterval))))}),Jl=n(function(e,t,r){if("Nothing"===t.$)return Ca;var n=t.a;if("Nothing"===r.$)return Ca;var a=r.a;return ba(f(e,n,a))}),Ql=function(e){if("Ok"===e.$){var t=e.a;return ba(t)}return Ca},Xl=function(e){var t=f(Wl,e.web3Context.factoryType,e.inputs),r=function(){return $(e.errors,Vl)?Vl:"Ok"===t.$?Vl:t.a}();return U(e,{createParameters:l(Jl,Xf,e.userInfo,Ql(t)),errors:r})},Zl=r(function(e,t){return Xl(U(t,{inputs:e}))}),ed=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),td=r(function(e,t){return d(ed,f(Zl,Hf,{allowance:Ca,createParameters:Ca,depositAmount:Ca,errors:Vl,inputs:Hf,showFiatTypeDropdown:!1,txChainStatus:Ca,userInfo:t,web3Context:e}),uo,lo,mr)}),rd=function(e){return{$:"Address",a:e}},nd=f(_a,No,f(_a,ll,rd)),ad=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return nd("0x41a8a3C08932d285f2AF190c7338ABcC5cFfFBb4")}e.a;return nd("0x4cd4742b61A840630e3509eC0eDb988edB55673f")}switch(e.a.$){case"Eth":e.a;return nd("");case"Kovan":e.a;return nd("");case"Rootstock":e.a;return nd("");case"RootstockTest":e.a;return nd("");default:e.a;return nd("0x4078E3f7a5d475Eb615C643ce5729Cc0cC9Fb11D")}},id=function(e){return nd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},od=function(e){return{$:"AddressE",a:e}},ud=od,sd=function(e){return{$:"UintE",a:e}},cd=sd,fd=n(function(e,t,r){return{data:ba(f(pf,"approve(address,uint256)",F([ud(t),cd(r)]))),decoder:Uo(Bo),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),ld=function(e){return f(Yf,e,200)},dd=r(function(e,t){return jf(f(Cu,qf(e),qf(t)))}),hd=function(e){var t=f(Yf,e.tradeAmount,200);return f(dd,e.pokeReward,f(dd,ld(e.tradeAmount),f(dd,t,function(){return"Buyer"===e.initiatorRole.$?Jf(e.tradeAmount):e.tradeAmount}())))},pd=kf(hi),gd=n(function(e,t,r){return{id:e,initiatorIsCustodian:r,tradeAddress:t}}),vd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),yd=Zn,md=Xn,bd=function(e){return f(md,{caseInsensitive:!1,multiline:!1},e)},Cd=Qn,Sd=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ed=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}}),Td=r(function(e,t){return!f(Ed,f(Af,Iu,e),t)}),wd=Td(no),Id=G,Ad=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Bd=n(function(e,t,r){if("Err"===t.$){var n=t.a;return Ai(n)}var a=t.a;if("Err"===r.$){var n=r.a;return Ai(n)}var i=r.a;return Bi(f(e,a,i))}),kd=f(Xa,Bd(za),Bi(mr)),Nd=function(e){if(e.b){var t=(e.a,e.b);return ba(t)}return Ca},Rd=n(function(e,t,r){e:for(;;){if(!t.b)return Bi(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(Jo,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Jo,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Jo,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Jo,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Jo,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Jo,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Jo,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Jo,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Jo,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Jo,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Jo,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Jo,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Jo,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Jo,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Jo,16,e);e=i,t=o,r=u;continue e;default:var s=n;return Ai(Yu(s)+" is not a valid hexadecimal character.")}}}),$d=function(e){if(Dl(e))return Ai("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(ko,"-",e)){var t=f(rc,mr,Nd(Ss(e)));return f(wo,Io,l(Rd,Fi(t)-1,t,0))}return l(Rd,yo(e)-1,Ss(e),0)}();return f(zl,function(t){return f(zi," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},xd=function(e){var t=Ss(e);return function(e){return L(t,e)}(f(Ad,mr,kd(f(nu,$d,f(Wi,"",f(zi,"",f(nu,f(_a,ns,Ns),f(_s,20,ff(f(nu,f(_a,Id,Li),t))))))))))},_d=function(e){var t=r(function(e,t){return!(t>=8&&Pi(e)||t<8&&Di(e))}),n=xd(No(e)),a=n.a,i=n.b,o=l(Vi,t,a,i);return!!Sd(e)&&wd(o)},Ld=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-f]{40}$"))),Pd=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9A-F]{40}$"))),Dd=function(e){return'"'+e+'"'},Ud=function(e){var t=No(e),r=f(Eo,24,t),n=f(Ao,40,e);return 64===yo(t)&&f(qi,pi(D("0")),r)?Pd(n)||Ld(n)?Bi(rd(n)):_d(n)?Bi(rd(n)):Ai("Given address "+Dd(e)+" failed the EIP-55 checksum test."):40!==yo(t)?Ai("Given address "+Dd(e)+" is not the correct length."):Sd(t)?Pd(t)||Ld(t)?Bi(rd(t)):_d(t)?Bi(rd(t)):Ai("Given address "+Dd(e)+" failed the EIP-55 checksum test."):Ai("Given address "+Dd(e)+" contains invalid hex characters.")},Od=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),Ud(To(r)))}),Md=r(function(e,t){var r=t.a;return go(function(t){var n=t.a,a=t.b;return r(f(vo,n,f(bo,64*e,a)))})}),Fd=Qr,Vd=r(function(e,t){return f(Fd,"data",Uo(f(Md,e,t)))}),Kd=Xr,Hd=r(function(e,t){return f(Fd,"topics",f(Kd,e,Uo(t)))}),jd=function(e){return f(Gf,f(_a,Ja,f(Wa,r(function(e,t){return f(Cu,hu(e),f(xu,t,Gu))}),Pu)),cl(f(nu,f(_a,Ja,f(_a,Zu,f(_a,$d,Ql))),f(sl,8,Ja(e)))))},qd=function(e){var t=Ss(ll(e));e:for(;;){if(!t.b)return Ca;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(Gf,xu(hu(-1)),jd(a))}var i=t.b;i.b;return Ca}var a=t.b;return f(Gf,xu(hu(-1)),jd(a))}return Ca;case"+":if(t.b.b){var a=t.b;return jd(a)}return Ca;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return jd(a)}t.b;return Ca}break e;default:break e}}var a=t;return jd(a)},Gd=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),f(Pl,"Error Decoding Uint into BigInt",qd(df(To(r)))))}),zd=f(pd,f(Hd,1,Bo),f(pd,f(Vd,1,Od),f(pd,f(Vd,0,Gd),Po(gd)))),Yd=me,Wd=f(_a,hf,Yd),Jd=an,Qd=r(function(e,t){return me(l(Wa,Ee(e),Ce(),t))}),Xd=function(e){return me(l(Wa,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},Zd=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(Jd,e,Xd(F([L("data",Yd(t.data)),L("topics",f(Qd,Wd,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),eh=function(e){var t=e.a;return df(t)},th=r(function(e,t){return l(Xa,r(function(t,r){return e(t)?f(za,t,r):r}),mr,t)}),rh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return Ai(r)}),nh=r(function(e,t){return f(wo,function(e){return e.id},f(rh,function(e){return f(zl,Zi,f(Zd,zd,e).returnData)},f(Pl,"No log found from that factoryAddress in that txReceipt",el(f(th,function(t){return $(f(_a,eh,ll)(t.address),f(_a,eh,ll)(ad(e)))},t.logs)))))}),ah=n(function(e,t,r){return{data:ba(f(pf,"allowance(address,address)",F([ud(t),ud(r)]))),decoder:Uo(Gd),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),ih=function(e){switch(e.$){case"BlockNum":var t=e.a;return Yd(df(ns(t)));case"EarliestBlock":return Yd("earliest");case"LatestBlock":return Yd("latest");default:return Yd("pending")}},oh=f(_a,eh,Yd),uh=f(_a,is,f(_a,df,Yd)),sh=f(_a,ns,f(_a,df,Yd)),ch=sn,fh=function(e){return Xd(f(nu,function(e){var t=e.a,r=e.b;return L(t,f(rc,ch,r))},f(th,function(e){e.a;return!$(e.b,Ca)},e)))},lh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return fh(F([L("to",f(Gf,oh,t)),L("from",f(Gf,oh,r)),L("gas",f(Gf,sh,n)),L("gasPrice",f(Gf,uh,a)),L("value",f(Gf,uh,i)),L("data",f(Gf,Wd,o))]))},dh=function(e){return{$:"BadBody",a:e}},hh=function(e){return{$:"BadStatus",a:e}},ph=function(e){return{$:"BadUrl",a:e}},gh={$:"NetworkError"},vh={$:"Timeout"},yh=nn,mh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return Ai(ph(r));case"Timeout_":return Ai(vh);case"NetworkError_":return Ai(gh);case"BadStatus_":var n=t.a,a=t.b;return Ai(hh(n.statusCode));default:var n=t.a,a=t.b,i=f(yh,f(Fd,"result",e),a);if("Ok"===i.$){var o=i.a;return Bi(o)}var u=i.a;return Ai(dh(Zi(u)))}}),bh=me,Ch=n(function(e,t,r){return Xd(F([L("id",bh(e)),L("jsonrpc",Yd("2.0")),L("method",Yd(t)),L("params",f(Qd,no,r))]))}),Sh={$:"RBEmpty_elm_builtin"},Eh=Sh,Th=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return Ca;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(fu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return ba(n);default:var u=e,s=i;e=u,t=s;continue e}}}),wh={$:"Black"},Ih=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Ah={$:"Red"},Bh=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(Ih,Ah,t,r,h(Ih,wh,c,f,l,d),h(Ih,wh,i,o,u,s))}return h(Ih,e,i,o,h(Ih,Ah,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(Ih,Ah,c,f,h(Ih,wh,g,v,y,m),h(Ih,wh,t,r,d,a))}return h(Ih,e,t,r,n,a)}),kh=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Ih,Ah,e,t,Sh,Sh);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(fu,e,a).$){case"LT":return h(Bh,n,a,i,l(kh,e,t,o),u);case"EQ":return h(Ih,n,a,t,o,u);default:return h(Bh,n,a,i,o,l(kh,e,t,u))}}),Nh=n(function(e,t,r){var n=l(kh,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(Ih,wh,a,i,o,u)}return n}),Rh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},$h=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(Ih,Ah,p,g,h(Ih,wh,r,n,h(Ih,Ah,i,o,u,s),v),h(Ih,wh,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(Ih,wh,r,n,h(Ih,Ah,i,o,u,s),h(Ih,Ah,f,l,d,m))}return e},xh=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(Ih,Ah,i,o,h(Ih,wh,s,c,f,l),h(Ih,wh,r,n,d,h(Ih,Ah,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,S=e.e,g=(S.a,S.b),v=S.c,y=S.d,m=S.e;return t.$,h(Ih,wh,r,n,h(Ih,Ah,i,o,C,d),h(Ih,Ah,g,v,y,m))}return e},_h=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(Ih,r,u,s,c,h(Ih,Ah,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 xh(t)}break e}o.a,o.d;return xh(t)}break e}return t}),Lh=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(Ih,t,r,n,Lh(a),u)}var s=$h(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Bh,c,f,l,Lh(d),p)}return Sh}return h(Ih,t,r,n,Lh(a),u)}return Sh},Ph=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Sh;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(_(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(Ih,r,n,a,f(Ph,e,i),o)}var s=$h(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Bh,c,l,d,f(Ph,e,p),v)}return Sh}return h(Ih,r,n,a,f(Ph,e,i),o)}return f(Dh,e,g(_h,e,t,r,n,a,i,o))}),Dh=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=Rh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Bh,r,s,c,i,Lh(o))}return Sh}return h(Bh,r,n,a,i,f(Ph,e,o))}return Sh}),Uh=r(function(e,t){var r=f(Ph,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(Ih,wh,n,a,i,o)}return r}),Oh=n(function(e,t,r){var n=t(f(Th,e,r));if("Just"===n.$){var a=n.a;return l(Nh,e,a,r)}return f(Uh,e,r)}),Mh=function(e){return"Just"===e.$},Fh=vn,Vh=yn,Kh=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Hh=function(e){return{$:"BadUrl_",a:e}},jh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),qh={$:"NetworkError_"},Gh=function(e){return{$:"Receiving",a:e}},zh=function(e){return{$:"Sending",a:e}},Yh={$:"Timeout_"},Wh=function(e){return f(ra,"application/json",f(Qi,0,e))},Jh=n(function(e,t,r){return Wh(l(Ch,e,t,r))}),Qh=f(ta,"",no),Xh=we,Zh=Te,ep=function(e){if("Ok"===e.$){var t=e.a;return Zh(t)}var r=e.a;return Xh(r)},tp=function(e){return l(ea,vr,ep,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:Ca,url:e.url})},rp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return tp({body:l(Jh,1,r,n),headers:mr,method:"POST",resolver:Qh(mh(a)),timeout:Ca,url:t})},np=n(function(e,t,r){return rp({decoder:t.decoder,method:"eth_call",params:F([lh(t),ih(r)]),url:e})}),ap={$:"LatestBlock"},ip=r(function(e,t){return l(np,e,t,ap)}),op=function(e){return{$:"Perform",a:e}},up=cn,sp=Zh(vr),cp=r(function(e,t){return f(up,function(t){return Zh(e(t))},t)}),fp=n(function(e,t,r){return f(up,function(t){return f(up,function(r){return Zh(f(e,t,r))},r)},t)}),lp=function(e){return l(Xa,fp(za),Zh(mr),e)},dp=r(function(e,t){var r=t.a;return ke(f(up,Fh(e),r))}),hp=n(function(e,t,r){return f(cp,function(e){return vr},lp(f(nu,dp(e),t)))}),pp=n(function(e,t,r){return Zh(vr)}),gp=r(function(e,t){var r=t.a;return op(f(cp,e,r))});gn.Task=De(sp,hp,pp,gp);var vp=Oe("Task"),yp=fn,mp=r(function(e,t){return vp(op(f(yp,f(Af,f(Af,Zh,e),Ai),f(up,f(Af,f(Af,Zh,e),Bi),t))))}),bp=i(function(e,t,r,n,a){return f(mp,a,f(ip,e.httpProvider,l(ah,id(t),r,n)))}),Cp=nd("0x2b518987f8c21937B4d0b700b1224736a28fCA23"),Sp=function(e){return{$:"BoolE",a:e}},Ep=Sp,Tp=function(e){return{$:"StringE",a:e}},wp=Tp,Ip=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:ba(f(pf,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([ud(t),ud(r),Ep(n),cd(a),cd(i),cd(o),cd(u),cd(s),cd(c),cd(l),cd(d),wp(h),wp(p)]))),decoder:Uo(Od),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}}}}}}}}}}}}}},Ap=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:ba(f(pf,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([ud(t),ud(r),Ep(n),cd(a),cd(i),cd(o),cd(u),cd(s),cd(c),cd(l),cd(d),wp(h),wp(p)]))),decoder:Uo(Od),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}}}}}}}}}}}}}},Bp=r(function(e,t){return{paymentMethods:t,price:e}}),kp=function(e){return Yd(Il(e))},Np=function(e){return f(Qd,no,F([Yd(e.fiatType),kp(e.amount)]))},Rp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},$p=function(e){return Xd(F([L("type",Yd(Rp(e.type_))),L("info",Yd(e.info))]))},xp=function(e){var t=Np(e.price),r=f(Qd,$p,e.paymentMethods);return f(Qi,0,Xd(F([L("paymentmethods",r),L("price",t)])))},_p=r(function(e,t){return U(t,{value:ba(e)})}),Lp=function(e){return hu(Yl(e))},Pp=function(e){return f(zf,Lp(e),hu(1e3))},Dp=r(function(e,t){var r=function(){return"Token"===e.$?Ip:Ap}();return function(){return"Native"===e.$?_p(qf(hd(t))):no}()(r(ad(e))(t.initiatorAddress)(Cp)($(t.initiatorRole,Ff))(qf(t.tradeAmount))(qf(Jf(t.tradeAmount)))(qf(Wf(t.tradeAmount)))(qf(t.pokeReward))(Pp(t.autorecallInterval))(Pp(t.autoabortInterval))(Pp(t.autoreleaseInterval))(qf(ld(t.tradeAmount)))(xp(f(Bp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Up=function(e){return{$:"CreateMined",a:e}},Op={$:"CreateNeedsSig"},Mp=function(e){return{$:"CreateSigned",a:e}},Fp=r(function(e,t){var r=Cf(f(Dp,e,t)),n={onBroadcast:Ca,onMined:ba(L(Up,Ca)),onSign:ba(Mp)};return L(ba(Op),f(yf,n,r))}),Vp=function(e){return{$:"AllowanceFetched",a:e}},Kp=r(function(e,t){return{$:"ApproveMining",a:e,b:t}}),Hp={$:"ApproveNeedsSig"},jp=r(function(e,t){return{$:"ApproveSigned",a:e,b:t}}),qp=function(e){return{$:"Confirm",a:e}},Gp=function(e){return{$:"CreateMining",a:e}},zp={$:"NoOp"},Yp=function(e){return{appCmds:mr,chainCmd:lo,cmd:uo,model:e}},Wp=function(e){return il(Il(e))},Jp={$:"ShouldBeImpossible"},Qp=function(e){return _f(e)},Xp=r(function(e,t){f(Rl,e,t);return{mainParagraphs:F([F([Qp(e)])]),noticeType:Jp}}),Zp={$:"Error"},eg=r(function(e,t){f(Rl,e+" fetch error",t);return{mainParagraphs:F([F([Qp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Zp}}),tg=r(function(e,t){return{mainParagraphs:F([F([Qp('Error mining "'+e+'" transaction: '+t)])]),noticeType:Zp}}),rg={$:"Caution"},ng=r(function(e,t){return{mainParagraphs:F([F([Qp('Error signing "'+e+'" transaction: '+t)])]),noticeType:rg}}),ag=r(function(e,t){if("Just"===t.$){return e(t.a)}return Ca}),ig=r(function(e,t){return 1-e(1-t)}),og=function(e){return f(Jo,e,5)},ug=ig(og),sg={easing:ug,offset:12,speed:200},cg=function(e){return{$:"External",a:e}},fg=function(e){return{$:"Internal",a:e}},lg=function(e){return{$:"NotFound",a:e}},dg=function(e){for(;;){e=e.a}},hg=r(function(e,t){return vp(op(f(cp,e,t)))}),pg={$:"Http"},gg={$:"Https"},vg=Hr,yg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),mg=i(function(e,t,r,n,a){if(Dl(a)||f(vg,"@",a))return Ca;var i=f(tl,":",a);if(i.b){if(i.b.b)return Ca;var o=i.a,u=il(f(bo,o+1,a));if("Nothing"===u.$)return Ca;var s=u;return ba(p(yg,e,f(Eo,o,a),s,t,r,n))}return ba(p(yg,e,a,Ca,t,r,n))}),bg=a(function(e,t,r,n){if(Dl(n))return Ca;var a=f(tl,"/",n);if(a.b){var i=a.a;return h(mg,e,f(bo,i,n),t,r,f(Eo,i,n))}return h(mg,e,"/",t,r,n)}),Cg=n(function(e,t,r){if(Dl(r))return Ca;var n=f(tl,"?",r);if(n.b){var a=n.a;return d(bg,e,ba(f(bo,a+1,r)),t,f(Eo,a,r))}return d(bg,e,Ca,t,r)}),Sg=r(function(e,t){if(Dl(t))return Ca;var r=f(tl,"#",t);if(r.b){var n=r.a;return l(Cg,e,ba(f(bo,n+1,t)),f(Eo,n,t))}return l(Cg,e,Ca,t)}),Eg=function(e){return f(ko,"http://",e)?f(Sg,pg,f(bo,7,e)):f(ko,"https://",e)?f(Sg,gg,f(bo,8,e)):Ca},Tg=Jt,wg=zt(Yt),Ig=ca,Ag=r(function(e,t){return L(e,t)}),Bg=_r,kg=a(function(e,t,r,n){var a=_(r,n)>0?Ci:Ya,i=du(r-n),o=f(mi,1,Bg(i)/e|0),u=o,s=f(nu,function(e){return t(e/u)},f(Hi,0,o));return e<=0||$(r,n)?mr:f(nu,function(e){return f(a,r,e*i)},s)}),Ng=r(function(e,t){var n=r(function(t,r){return lp(f(nu,Ig(0),d(kg,e.speed,e.easing,t,r-e.offset)))});return f(up,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(fp,Ag,wg,Tg(t)))}),Rg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(bp,t.web3Context,a,n.address,ad(t.web3Context.factoryType),Vp);return d(ed,t,i,lo,mr)}return Yp(t);case"ChangeRole":var o=e.a,u=t.inputs;return Yp(U(t,{inputs:U(u,{userRole:o})}));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Yp(f(Zl,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Yp(f(Zl,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Yp(f(Zl,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Yp(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return Yp(f(Zl,U(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var g=e.a,u=t.inputs;return Yp(f(Zl,U(u,{autorecallInterval:g}),t));case"AutoabortIntervalChanged":var g=e.a,u=t.inputs;return Yp(f(Zl,U(u,{autoabortInterval:g}),t));case"AutoreleaseIntervalChanged":var g=e.a,u=t.inputs;return Yp(f(Zl,U(u,{autoreleaseInterval:g}),t));case"ShowCurrencyDropdown":var v=e.a,u=t.inputs;return Yp((v?Zl(U(u,{fiatType:""})):no)(U(t,{showFiatTypeDropdown:v})));case"CreateClicked":var n=e.a,y=f(Wl,t.web3Context.factoryType,t.inputs);if("Ok"===y.$){var m=y.a,b=f(Xf,n,m);return Yp(U(t,{depositAmount:ba(qf(hd(b))),txChainStatus:ba(qp(b))}))}var C=y.a;return d(ed,U(t,{errors:C}),f(mp,Fu(zp),function(){return f(Ng,U(sg,{offset:60}),"inputError")}()),lo,mr);case"AbortCreate":return Yp(U(t,{txChainStatus:Ca}));case"ConfirmCreate":var b=e.a,S=e.b,E=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return f(Fp,t.web3Context.factoryType,b);var r=e.a,n=function(){var e=Cf(l(fd,id(r),ad(t.web3Context.factoryType),S)),n={onBroadcast:Ca,onMined:Ca,onSign:ba(jp(b))};return f(yf,n,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Tu,i,S),Oa)?L(ba(Hp),n):f(Fp,t.web3Context.factoryType,b)}return L(ba(Hp),n)}(),T=E.a,w=E.b;return d(ed,U(t,{txChainStatus:T}),uo,w,mr);case"ApproveSigned":var b=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Yp(U(t,{txChainStatus:ba(f(Kp,b,A))}))}var B=I.a;return d(ed,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"appove",B))]));case"AllowanceFetched":var k=e.a;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ba(N)}),x=L(R.txChainStatus,R.depositAmount);if("Just"===x.a.$&&"ApproveMining"===x.a.a.$&&"Just"===x.b.$){var _=x.a.a,b=_.a,P=x.b.a;if($(f(Tu,N,P),Oa))return Yp(R);var D=f(Fp,R.web3Context.factoryType,b),T=D.a,w=D.b;return d(ed,U(R,{txChainStatus:T}),uo,w,mr)}return Yp(R)}var O=k.a;return d(ed,t,uo,lo,F([Tf(f(eg,"allowance",O))]));case"CreateSigned":var I=e.a;if("Ok"===I.$){var A=I.a;return Yp(U(t,{txChainStatus:ba(Gp(A))}))}var B=I.a;return d(ed,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(ed,t,uo,lo,F([Tf(f(tg,"create",B))]))}var M=e.a.a,V=f(ag,Wp,Ql(f(nh,t.web3Context.factoryType,M)));if("Just"===V.$){var K=V.a;return d(ed,t,uo,lo,F([po(bf(K))]))}return d(ed,t,uo,lo,F([Tf(f(Xp,"Error getting the ID of the created contract",M))]));case"Web3Connect":return d(ed,t,uo,lo,F([wf]));default:return Yp(t)}}),$g=function(e){return fh(F([L("to",f(Gf,oh,e.to)),L("from",f(Gf,oh,e.from)),L("gas",f(Gf,sh,e.gas)),L("gasPrice",f(Gf,uh,e.gasPrice)),L("value",f(Gf,uh,e.value)),L("data",f(Gf,Wd,e.data)),L("nonce",f(Gf,sh,e.nonce))]))},xg=function(e){return{$:"TxSentry",a:e}},_g=r(function(e,t){return Xd(F([L("ref",bh(e)),L("txParams",t)]))}),Lg=function(e){return{$:"Signing",a:e}},Pg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Lg(e)}}),Dg=mn,Ug=n(function(e,t,r){var n=e.a,a=$g(r),i=l(Nh,n.ref,f(Pg,r,t),n.txs);return L(xg(U(n,{ref:n.ref+1,txs:i})),f(Dg,n.tagger,n.outPort(f(_g,n.ref,a))))}),Og=Ug,Mg=r(function(e,t){if("None"===t.$)return L(e,uo);var r=t.a,n=t.b;return l(Og,e,r,n)}),Fg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Vg=r(function(e,t){if("None"===t.$)return fo;var r=t.a,n=t.b,a=l(Fg,f(Gf,Af(e),r.onSign),f(Gf,Af(e),r.onBroadcast),f(Gf,function(t){var r=t.a,n=t.b;return L(f(_a,r,e),f(Gf,function(t){return{confirmations:t.confirmations,toMsg:f(_a,t.toMsg,e)}},n))},r.onMined));return f(vf,a,n)}),Kg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Aa}e.a;return Ia}switch(e.a.$){case"Eth":e.a;return Aa;case"Kovan":e.a;return Ia;case"Rootstock":e.a;return Ra;case"RootstockTest":e.a;return $a;default:e.a;return Ba(100)}},Hg=r(function(e,t){return f(fu,Yl(e),Yl(t))}),jg=r(function(e,t){return $(t.state.phase,io)&&$(f(Hg,t.derived.phaseEndTime,e),Ka)}),qg=function(e){if(""===e)return Bi(Ca);var t=bl(e);if("Nothing"===t.$)return Ai("I can't interpret this number");var r=t.a;return Bi(ba(r))},Gg=function(e){if(""===e)return Bi(Ca);var t=dl(e);if("Nothing"===t.$)return Ai("I don't understand this number.");var r=t.a;return Bi(ba(r))},zg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),Yg=d(zg,Ca,Ca,Ca,Ca),Wg=i(function(e,t,r,n,a){if("Err"===t.$){var i=t.a;return Ai(i)}var o=t.a;if("Err"===r.$){var i=r.a;return Ai(i)}var u=r.a;if("Err"===n.$){var i=n.a;return Ai(i)}var s=n.a;if("Err"===a.$){var i=a.a;return Ai(i)}var c=a.a;return Bi(d(e,o,u,s,c))}),Jg=function(e){return h(Wg,a(function(t,r,n,a){return{dai:{max:r,min:t},fiat:f(Gf,function(e){return{max:a,min:n,type_:e}},Ul(e.fiatType)),paymentMethodTerms:e.paymentMethodTerms}}),f(zl,function(e){return U(Yg,{minDai:ba(e)})},qg(e.minDai)),f(zl,function(e){return U(Yg,{maxDai:ba(e)})},qg(e.maxDai)),f(zl,function(e){return U(Yg,{minFiat:ba(e)})},Gg(e.minFiat)),f(zl,function(e){return U(Yg,{maxFiat:ba(e)})},Gg(e.maxFiat)))},Qg=r(function(e,t){var r=function(t){return f(Td,function(e){return f(vg,ll(e),ll(t))},e)};return f(Ed,function(e){return r(e.info)},t)}),Xg=r(function(e,t){return U(t,{paymentMethod:e})}),Zg=r(function(e,t){return U(t,{paymentMethodTerms:e})}),ev=r(function(e,t){return f(Tu,qf(e),qf(t))}),tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Za,e.inputs.paymentMethodTerms,F([t]));return rv(U(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))}))},rv=function(e){var t=tv(e),n=Jg(t.inputs);if("Err"===n.$){return U(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Qg,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiat;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.fiatType,r.type_)&&function(){var t=r.min;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Tu,e.terms.price.amount,n),Oa)}()&&function(){var t=r.max;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Tu,e.terms.price.amount,n),Ka)}()},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(ev,e.parameters.tradeAmount,r),Oa)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(ev,e.parameters.tradeAmount,r),Ka)}()},s=r(function(e,r){return f(jg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},nv={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},av=r(function(e,t){return f(fu,e.creationInfo.blocknum,t.creationInfo.blocknum)}),iv=n(function(e,t,r){return L(rv({browsingRole:t,errors:Yg,filterFunc:jg,inputs:nv,showCurrencyDropdown:!1,sortFunc:av,userInfo:r,web3Context:e}),uo)}),ov=r(function(e,t){return f(Tu,e.amount,t.amount)}),uv=r(function(e,t){var r=f(th,Gs(e),t.inputs.paymentMethodTerms);return rv(U(t,{inputs:f(Zg,r,t.inputs)}))}),sv=function(e){return U(e,{filterFunc:jg,inputs:nv,sortFunc:av})},cv={$:"Ascending"},fv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),lv=function(e){return l(fv,e,uo,mr)},dv=r(function(e,t){return U(t,{fiatType:e})}),hv=r(function(e,t){return U(t,{maxDai:e})}),pv=r(function(e,t){return U(t,{maxFiat:e})}),gv=r(function(e,t){return U(t,{minDai:e})}),vv=r(function(e,t){return U(t,{minFiat:e})}),yv=n(function(e,t,r){return f(e,r,t)}),mv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(fv,U(t,{inputs:f(gv,n,t.inputs)}),uo,mr);case"MaxDaiChanged":var n=e.a;return l(fv,U(t,{inputs:f(hv,n,t.inputs)}),uo,mr);case"MinFiatChanged":var n=e.a;return l(fv,U(t,{inputs:f(vv,n,t.inputs)}),uo,mr);case"MaxFiatChanged":var n=e.a;return l(fv,U(t,{inputs:f(pv,n,t.inputs)}),uo,mr);case"FiatTypeInputChanged":var n=e.a;return l(fv,U(t,{inputs:f(dv,n,t.inputs)}),uo,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(fv,U(t,{inputs:(a?dv(""):no)(t.inputs),showCurrencyDropdown:a}),uo,mr);case"FiatTypeLostFocus":return l(fv,U(t,{showCurrencyDropdown:!1}),uo,mr);case"PaymentMethodInputChanged":var n=e.a;return l(fv,U(t,{inputs:f(Xg,n,t.inputs)}),uo,mr);case"AddSearchTerm":return l(fv,tv(t),uo,mr);case"RemoveTerm":var i=e.a;return l(fv,f(uv,i,t),uo,mr);case"ApplyInputs":return l(fv,rv(t),uo,mr);case"ResetSearch":return l(fv,sv(t),uo,mr);case"TradeClicked":var o=e.a;return l(fv,t,uo,F([po(bf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,cv)?yv:no)(r(function(e,t){switch(u.$){case"Expiring":return f(Hg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(ev,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(ov,e.terms.price,t.terms.price);case"Margin":return f(rc,Ua,l(Jl,r(function(e,t){return f(fu,e,t)}),e.derived.margin,t.derived.margin));case"PaymentMethods":return f(av,e,t);case"AutoabortWindow":return f(Hg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(Hg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(fv,U(t,{sortFunc:c}),uo,mr);default:return lv(t)}}),bv=n(function(e,t,r){var n=e.factoryType;if("Token"===n.$){var a=n.a;return h(bp,e,a,t.address,ad(e.factoryType),r)}return uo}),Cv=function(e){return{$:"AllowanceFetched",a:e}},Sv=function(e){return{$:"Menu",a:e}},Ev={$:"NoneStarted"},Tv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),wv=r(function(e,t){var r={state:Sv(Ev),textInput:"",tokenAllowance:Ca,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(bv,r.web3Context,e,Cv)}return uo}();return d(Tv,r,n,lo,mr)}),Iv=function(e){return{$:"ApproveSigned",a:e}},Av=r(function(e,t){var r=Cf(l(fd,id(e),ad(ya(e)),qf(t))),n={onBroadcast:Ca,onMined:Ca,onSign:ba(Iv)};return f(yf,n,r)}),Bv=function(e){return{$:"OpenMined",a:e}},kv=function(e){return{$:"OpenSigned",a:e}},Nv=r(function(e,t){var r=Cf(f(Dp,e,t)),n={onBroadcast:Ca,onMined:ba(L(Bv,Ca)),onSign:ba(kv)};return f(yf,n,r)}),Rv=function(e){return{$:"ApproveMining",a:e}},$v=function(e){return{$:"ApproveNeedsSig",a:e}},xv={$:"OpenMining"},_v={$:"OpenNeedsSig"},Lv={$:"ReadyToOpen"},Pv=r(function(e,t){return{$:"Spec",a:e,b:t}}),Dv=function(e){return{$:"StartPrompt",a:e}},Uv=r(function(e,t){return jf(f(xu,qf(e),hu(t)))}),Ov=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Yf,f(Uv,e.daiAmountIn,100*t),100+t)},Mv=n(function(e,t,r){var n=t.intervals,a=n.a,i=n.b,o=n.c;return f(Xf,e,{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,initiatorRole:t.initiatorRole,paymentMethods:F([f(ql,jl,r)]),price:t.fiatValue,tradeAmount:Ov(t)})}),Fv=function(e){return{appCmds:mr,chainCmd:lo,cmd:uo,model:e}},Vv=function(e){return jf(e)},Kv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(bp,t.web3Context,a,n.address,ad(t.web3Context.factoryType),Cv);return d(Tv,t,i,lo,mr)}return Fv(t);case"StartClicked":var o=e.a;if("Token"===t.web3Context.factoryType.$){var u=function(){var e=t.tokenAllowance;if("Just"===e.$){var r=e.a;return $(f(ev,r,o.daiAmountIn),Oa)?Sv(Dv(o)):f(Pv,o,Lv)}return Sv(Dv(o))}();return Fv(U(t,{state:u}))}return Fv(U(t,{state:f(Pv,o,Lv)}));case"ApproveClicked":var o=e.a,s=t.web3Context.factoryType;if("Token"===s.$){var a=s.a,c=f(Av,a,o.daiAmountIn);return d(Tv,U(t,{state:Sv($v(o))}),uo,c,mr)}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Approve Clicked msg received, but factoryType is not a token factory!",o))]));case"ApproveSigned":var p=e.a,g=L(p,t.state);if("Ok"===g.a.$){if("Menu"===g.b.$&&"ApproveNeedsSig"===g.b.a.$){var v=g.a.a,o=g.b.a.a;return Fv(U(t,{state:f(Pv,o,Rv(v))}))}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(Tv,t,uo,lo,F([Tf(f(ng,"ERC20 approve",y))]));case"AllowanceFetched":var m=e.a,b=L(m,t.state);if("Ok"===b.a.$){if("Spec"===b.b.$&&"ApproveMining"===b.b.b.$){var C=b.a.a,S=b.b,o=S.a;return Fv($(f(Tu,C,qf(o.daiAmountIn)),Oa)?U(t,{tokenAllowance:ba(Vv(C))}):U(t,{state:f(Pv,o,Lv),tokenAllowance:ba(Vv(C))}))}return Fv(t)}var E=b.a.a;return d(Tv,t,uo,lo,F([Tf(f(eg,"token allowance",E))]));case"OpenClicked":var n=e.a,T=e.b,w=l(Mv,n,T,t.textInput),c=f(Nv,t.web3Context.factoryType,w);return d(Tv,U(t,{state:f(Pv,T,_v)}),uo,c,mr);case"OpenSigned":var p=e.a,I=L(p,t.state);if("Ok"===I.a.$){if("Spec"===I.b.$){var v=I.a.a,A=I.b,w=A.a;return Fv(U(t,{state:f(Pv,w,xv)}))}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(Tv,t,uo,lo,F([Tf(f(ng,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ag,Wp,Ql(f(nh,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(Tv,t,uo,lo,F([po(bf(R))]))}return d(Tv,t,uo,lo,F([Tf(f(Xp,"Error getting the ID of the created contract",k))]))}var y=B.a;return d(Tv,t,uo,lo,F([Tf(f(tg,"Open trade",y))]));case"TextInputChanged":var x=e.a;return Fv(U(t,{textInput:x}));case"ChangeState":var u=e.a;return Fv(U(t,{state:u}));case"AbortCreate":return Fv(U(t,{state:Sv(Ev)}));case"NoOp":return Fv(t);default:return d(Tv,t,uo,lo,F([wf]))}}),Hv=function(e){return"Buyer"===e.$?"buyer":"seller"},jv=function(e){return e.a+"="+e.b},qv=function(e){return e.b?"?"+f(zi,"&",f(nu,jv,e)):""},Gv=r(function(e,t){return"/"+(f(zi,"/",e)+qv(t))}),zv=function(e){switch(e.$){case"Home":return f(Gv,F(["DAIHard"]),mr);case"QuickCreate":return f(Gv,F(["DAIHard","quickcreate"]),mr);case"Create":return f(Gv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a;return f(Gv,F(["DAIHard","trade",Gi(t)]),mr);case"Marketplace":var r=e.a;return f(Gv,F(["DAIHard","marketplace",Hv(r)]),mr);case"AgentHistory":var n=e.a,r=e.b;return f(Gv,F(["DAIHard","history",eh(n),function(){return"Buyer"===r.$?"buyer":"seller"}()]),mr);default:return f(Gv,mr,mr)}},Yv={$:"NotFound"},Wv={$:"Create"},Jv={$:"Home"},Qv=function(e){return{$:"Marketplace",a:e}},Xv={$:"QuickCreate"},Zv=function(e){return{$:"Parser",a:e}},ey=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),ty=r(function(e,t){return Zv(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 F([h(ey,f(za,u,r),s,a,i,o(l))])}return mr}return mr})}),ry=f(ty,"ADDRESS",f(_a,Ud,Ql)),ny={$:"Buyer"},ay=f(ty,"BUYERORSELLER",function(e){switch(e){case"buyer":return ba(ny);case"seller":return ba(Ff);default:return Ca}}),iy=f(ty,"NUMBER",il),oy=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(ey,r,n,a,i,e(o))}),uy=r(function(e,t){var r=t.a;return Zv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(nu,oy(u),r(h(ey,n,a,i,o,e)))})}),sy=function(e){return l(Xa,Za,mr,e)},cy=r(function(e,t){return sy(f(nu,e,t))}),fy=function(e){return Zv(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)?F([h(ey,f(za,u,r),s,a,i,o)]):mr}return mr})},ly=r(function(e,t){var r=e.a,n=t.a;return Zv(function(e){return f(cy,n,r(e))})}),dy=Zv(function(e){return F([e])}),hy=f(ly,fy("DAIHard"),function(e){return Zv(function(t){return f(cy,function(e){return(0,e.a)(t)},e)})}(F([f(uy,Jv,dy),f(uy,Xv,fy("quickcreate")),f(uy,Wv,fy("create")),f(uy,bf,f(ly,fy("trade"),iy)),f(uy,Qv,f(ly,fy("marketplace"),ay)),f(uy,mf,f(ly,fy("history"),f(ly,ry,ay))),f(uy,function(e){return f(mf,e,Ff)},f(ly,fy("history"),ry))]))),py=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 ba(t.value)}return ba(t.value)}return Ca}},gy=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(za,t,gy(r))}return mr}return mr},vy=function(e){var t=f(Wi,"/",e);if(t.b&&""===t.a){var r=t.b;return gy(r)}var r=t;return gy(r)},yy=Xt,my=r(function(e,t){if("Nothing"===t.$)return ba(F([e]));var r=t.a;return ba(f(za,e,r))}),by=r(function(e,t){var r=f(Wi,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=yy(n);if("Nothing"===o.$)return t;var u=o.a,s=yy(i);if("Nothing"===s.$)return t;var c=s.a;return l(Oh,u,my(c),t)}return t}),Cy=function(e){if("Nothing"===e.$)return Eh;var t=e.a;return l(Xa,by,Eh,f(Wi,"&",t))},Sy=r(function(e,t){var r=e.a;return py(r(h(ey,mr,vy(t.path),Cy(t.query),t.fragment,no)))}),Ey=function(e){return f(rc,Yv,f(Sy,hy,e))},Ty=ia,wy=r(function(e,t){return f(Ty,e,zv(t))}),Iy=qe("connectToWeb3",function(e){return ch}),Ay=function(e){return Xd(F([L("event",Yd(e.event)),L("category",Yd(e.category)),L("label",Yd(e.label)),L("value",bh(e.value))]))},By=r(function(e,t){return Xd(F([L("address",Yd(eh(e))),L("signSeedMsg",Yd(t))]))}),ky=qe("gTagOut",no),Ny=qe("genPrivkey",no),Ry=r(function(e,t){return U(t,{userInfo:e})}),$y=r(function(e,t){return L(f(Zl,t.inputs,U(t,{userInfo:e})),function(){var r=L(e,t.web3Context.factoryType);if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a;return h(bp,t.web3Context,a,n.address,ad(t.web3Context.factoryType),Vp)}return uo}())}),xy=r(function(e,t){return U(t,{userInfo:e})}),_y=r(function(e,t){return L(U(t,{userInfo:e}),function(){if("Just"===e.$){var r=e.a;return l(bv,t.web3Context,r,Cv)}return uo}())}),Ly=function(e){return{$:"AllowanceFetched",a:e}},Py=r(function(e,t){return L(U(t,{userInfo:e}),function(){var r=P(e,t.trade,t.web3Context.factoryType);if("Just"===r.a.$&&"LoadedTrade"===r.b.$&&"Token"===r.c.$){var n=r.a.a,a=r.b.a,i=r.c.a;return h(bp,t.web3Context,i,n.address,a.creationInfo.address,Ly)}return uo}())}),Dy=function(e){return{$:"AgentHistoryModel",a:e}},Uy=function(e){return{$:"CreateModel",a:e}},Oy=function(e){return{$:"CreateMsg",a:e}},My=function(e){return{$:"MarketplaceModel",a:e}},Fy=function(e){return{$:"QuickCreateModel",a:e}},Vy=function(e){return{$:"QuickCreateMsg",a:e}},Ky=function(e){return{$:"TradeModel",a:e}},Hy=function(e){return{$:"TradeMsg",a:e}},jy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,uo);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Uy(a),f(Dg,Oy,i));case"QuickCreateModel":var o=t.a,u=f(_y,e,o),s=u.a,c=u.b;return L(Fy(s),f(Dg,Vy,c));case"TradeModel":var l=t.a,d=f(Py,e,l),h=d.a,p=d.b;return L(Ky(h),f(Dg,Hy,p));case"MarketplaceModel":var g=t.a;return L(My(f(xy,e,g)),uo);default:var v=t.a;return L(Dy(f(Ry,e,v)),uo)}}),qy=r(function(e,t){return U(t,{web3Context:e})}),Gy=r(function(e,t){return U(t,{web3Context:e})}),zy=r(function(e,t){return U(t,{web3Context:e})}),Yy=r(function(e,t){return U(t,{web3Context:e})}),Wy=r(function(e,t){switch(t.$){case"BetaLandingPage":return P(t,uo,Ca);case"CreateModel":var r=t.a;return P(Uy(f(Gy,e,r)),uo,Ca);case"QuickCreateModel":var n=t.a;return P(Fy(f(Yy,e,n)),uo,Ca);case"TradeModel":t.a;return P(t,uo,ba(Qv(ny)));case"MarketplaceModel":var a=t.a;return P(My(f(zy,e,a)),uo,Ca);default:var i=t.a;return P(Dy(f(qy,e,i)),uo,Ca)}}),Jy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Qy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Xy=function(e){return Qy(p(Jy,e,Ca,Ca,Ca,Ca,Ca))},Zy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),em=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},tm=em(f(Zy,Ca,Ca)),rm=r(function(e,t){return{address_:e,blocknum:t}}),nm=function(e){return go(function(t){return Bi(L(t,e))})},am=r(function(e,t){return L(t.a,e(t.b))}),im=n(function(e,t,r){var n=t.a,a=r.a;return go(function(t){return f(rh,function(t){var r=t.a,n=t.b;return f(wo,am(e(n)),a(r))},n(t))})}),om=r(function(e,t){return l(im,r(function(e,t){return e(t)}),t,e)}),um=Uo(f(om,Gd,f(om,Od,nm(rm)))),sm=r(function(e,t){return{data:ba(f(pf,"createdTrades(uint256)",F([cd(t)]))),decoder:um,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),cm=n(function(e,t,r){return f(mp,r,f(ip,e.httpProvider,f(sm,ad(e.factoryType),t)))}),fm=function(e){return{$:"CreationInfoFetched",a:e}},lm=r(function(e,t){return l(cm,e,hu(t),fm)}),dm=function(e){return{$:"EventSentryMsg",a:e}},hm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),pm=Do(f(_a,No,$d)),gm=function(e){return rp({decoder:pm,method:"eth_blockNumber",params:mr,url:e})},vm=function(e){return{$:"BlockNumber",a:e}},ym=function(e){return{$:"EventSentry",a:e}},mm=function(e){return{$:"Set_elm_builtin",a:e}},bm=mm(Eh),Cm=r(function(e,t){return L(ym({blockNumber:Ca,errors:mr,nodePath:t,pending:bm,ref:1,requests:Eh,tagger:e,watching:bm}),f(mp,f(_a,vm,e),gm(t)))}),Sm=n(function(e,t,r){var n=f(lm,e,r),a=f(Cm,dm,e.httpProvider),i=a.a,o=a.b;return d(hm,{allowance:Ca,chatHistoryModel:Ca,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:io,secureCommInfo:tm,showChatHistory:!1,showStatsModal:!1,trade:Xy(r),txChainStatus:Ca,userInfo:t,web3Context:e},oo(F([n,o])),lo,mr)}),Em=function(e){return{data:ba(f(pf,"abort()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Tm=function(e){return{data:ba(f(pf,"burn()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},wm=function(e){return{data:ba(f(pf,"claim()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Im=r(function(e,t){return{data:ba(f(pf,"initiatorStatement(string)",F([wp(t)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),Am=function(e){return{data:ba(f(pf,"recall()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Bm=function(e){return{data:ba(f(pf,"release()",mr)),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},km=r(function(e,t){return{data:ba(f(pf,"responderStatement(string)",F([wp(t)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),Nm=r(function(e,t){return{amount:t,fiatType:e}}),Rm=f(xo,function(e){var t=dl(e);if("Just"===t.$){var r=t.a;return Po(r)}return _o("Can't convert that to a BigInt")},Lo),$m=l(kf,Nm,f(Kd,0,Lo),f(Kd,1,Rm)),xm={$:"Bank"},_m={$:"Cash"},Lm=function(e){switch(e){case"cash":return ba(_m);case"bank":return ba(xm);case"custom":return ba(jl);default:return Ca}},Pm=f(xo,function(e){var t=Lm(e);if("Just"===t.$){var r=t.a;return Po(r)}return _o("")},Lo),Dm=l(kf,ql,f(Fd,"type",Pm),f(Fd,"info",Lo)),Um=ue,Om=function(e){var t=l(kf,Bp,f(Fd,"price",$m),f(Fd,"paymentmethods",Um(Dm)));return f(yh,t,e)},Mm=r(function(e,t){return{commPubkey:t,responder:e}}),Fm=r(function(e,t){var n=r(function(t,r){return l(mo,t,t+2*r,e)}),a=f(_a,$d,wo(bi(2)));return f(rh,function(t){return f(wo,function(e){return f(n,t+64,e)},$d(l(mo,t,t+64,e)))},a(t))}),Vm=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?P(0,0,f(e,o(t),i)):P(o(t),a-1,i):128&t?192==(224&t)?P(31&t,1,i):224==(240&t)?P(15&t,2,i):P(7&t,3,i):P(0,0,f(e,t,i))}),Km=n(function(e,t,r){var n=l(Wa,Vm(e),P(0,0,t),r);if(n.b)return Ai("invalid UTF-8 sequence");var a=n.c;return Bi(a)}),Hm=q,jm=function(e){return Yu(Hm(e))},qm=function(e){return l(Km,r(function(e,t){return O(t,jm(e))}),"",e)},Gm=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),f(rh,qm,f(rh,f(_a,nu($d),kd),f(wo,th(f(_a,Dl,Iu)),f(wo,Ts(2),f(Fm,t,To(r)))))))}),zm=f(pd,f(Vd,1,Gm),f(pd,f(Vd,0,Od),Po(Mm))),Ym=r(function(e,t){return{commPubkey:t,terms:e}}),Wm=f(pd,f(Vd,1,Gm),f(pd,f(Vd,0,Gm),Po(Ym))),Jm=function(e){return{statement:e}},Qm=f(pd,f(Vd,0,Gm),Po(Jm)),Xm=function(e){return{statement:e}},Zm=f(pd,f(Vd,0,Gm),Po(Xm)),eb={$:"AbortedEvent"},tb={$:"BurnedEvent"},rb={$:"ClaimedEvent"},nb=function(e){return{$:"CommittedEvent",a:e}},ab=function(e){return{$:"InitiatedEvent",a:e}},ib=function(e){return{$:"InitiatorStatementLogEvent",a:e}},ob={$:"PokeEvent"},ub={$:"RecalledEvent"},sb={$:"ReleasedEvent"},cb=function(e){return{$:"ResponderStatementLogEvent",a:e}},fb=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),lb=function(e){return fb(e)?Bi(Is(No(e))):Ai("Something in here is not very hexy: "+Dd(e))},db=Do(lb),hb=f(Fd,"topics",f(Kd,0,db)),pb=function(e){return Is(f(zi,"",f(nu,f(_a,ns,Ns),ff(f(nu,Li,Ss(e))))))},gb=f(xo,function(e){return $(e,pb("Initiated(string,string)"))?f(Bf,ab,Wm):$(e,pb("Committed(address,string)"))?f(Bf,nb,zm):$(e,pb("Recalled()"))?Po(ub):$(e,pb("Claimed()"))?Po(rb):$(e,pb("Aborted()"))?Po(eb):$(e,pb("Released()"))?Po(sb):$(e,pb("Burned()"))?Po(tb):$(e,pb("InitiatorStatementLog(string)"))?f(Bf,ib,Qm):$(e,pb("ResponderStatementLog(string)"))?f(Bf,cb,Zm):$(e,pb("Poke()"))?Po(ob):_o("Unrecognized topic hash")},hb),vb={$:"Initiator"},yb={$:"Responder"},mb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ba(vb):f(ag,function(e){return $(t,e)?ba(yb):Ca},e.state.responder)}),bb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Cb=function(e){return $(e.buyerDeposit,Jf(e.tradeAmount))&&$(e.abortPunishment,Wf(e.tradeAmount))},Sb={$:"Invalid"},Eb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Tb=function(e){return{$:"LoadedTrade",a:e}},wb=r(function(e,t){return Kf(Yl(t)+Yl(e))}),Ib=function(e){var t=$l(Il(e.amount));if("Just"===t.$){return t.a}f(Rl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Ab=r(function(e,t){return(t-e)/e}),Bb=r(function(e,t){var r=Ib(t),n=xl(e);return"USD"===t.fiatType?ba(f(Ab,n,r)):Ca}),kb=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 Kf(0)}}();return{margin:f(Bb,e.tradeAmount,r.price),phaseEndTime:f(wb,t.phaseStartTime,n)}}),Nb=function(e){var t=P(L(e.creationInfo,e.parameters),L(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 Tb(g(Eb,e.id,n,a,o,u,s,l(kb,a,o,u)))}return Qy(e)},Rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{creationInfo:ba(e)}));case"LoadedTrade":f(Rl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Sb}}),$b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{parameters:ba(e)}));case"LoadedTrade":t.a,f(Rl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Sb}}),xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{phaseStartInfo:ba(e)}));case"LoadedTrade":t.a,f(Rl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Sb}}),_b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{state:ba(e)}));case"LoadedTrade":var n=t.a;return Tb(U(n,{state:e}));default:return Sb}}),Lb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Nb(U(r,{terms:ba(e)}));case"LoadedTrade":t.a,f(Rl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Sb}}),Pb=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiator:e,initiatorIsCustodian:t,pokeReward:s,tradeAmount:r}}),Db=Uo(f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Bo,f(om,Od,nm(Pb))))))))))),Ub=function(e){return{data:ba(f(pf,"getParameters()",mr)),decoder:Db,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Ob=function(e){return f(Gf,function(e){return Kf(1e3*e)},il(Il(e)))},Mb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return Ai(a)}var i=t.a;if("Err"===r.$){var a=r.a;return Ai(a)}var o=r.a;if("Err"===n.$){var a=n.a;return Ai(a)}var u=n.a;return Bi(l(e,i,o,u))}),Fb=function(e){var t=f(Pl,"error converting BigInt to Time.Posix",Ob(e.autoabortInterval)),r=f(Pl,"error converting BigInt to Time.Posix",Ob(e.autoreleaseInterval)),a=f(Pl,"error converting BigInt to Time.Posix",Ob(e.autorecallInterval));return d(Mb,n(function(t,r,n){return{abortPunishment:Vv(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Vv(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatorIsCustodian?Ff:ny,pokeReward:Vv(e.pokeReward),tradeAmount:Vv(e.tradeAmount)}}),a,t,r)},Vb=n(function(e,t,r){return f(mp,r,f(cp,Fb,f(ip,e.httpProvider,Ub(t))))}),Kb=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}}}}}}}}}}},Hb=Uo(f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,f(om,Gd,nm(Kb)))))))))))),jb=function(e){return{data:ba(f(pf,"getPhaseStartInfo()",mr)),decoder:Hb,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},qb=i(function(e,t,r,n,a){if("Nothing"===t.$)return Ca;var i=t.a;if("Nothing"===r.$)return Ca;var o=r.a;if("Nothing"===n.$)return Ca;var u=n.a;if("Nothing"===a.$)return Ca;var s=a.a;return ba(d(e,i,o,u,s))}),Gb=function(e){return h(qb,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}}),Ob(e.v6),Ob(e.v7),Ob(e.v8),Ob(e.v9))},zb=n(function(e,t,r){return f(mp,r,f(cp,Gb,f(ip,e.httpProvider,jb(t))))}),Yb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Wb=Uo(f(om,Gd,f(om,Od,f(om,Gd,f(om,Gd,f(om,Gd,nm(Yb))))))),Jb=function(e){return{data:ba(f(pf,"getState()",mr)),decoder:Wb,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Qb={$:"Aborted"},Xb={$:"Burned"},Zb={$:"NotClosed"},eC={$:"Recalled"},tC={$:"Released"},rC=function(e){switch(f(rc,99,il(Il(e)))){case 0:return ba(Zb);case 1:return ba(eC);case 2:return ba(Qb);case 3:return ba(tC);case 4:return ba(Xb);default:return Ca}},nC={$:"Closed"},aC={$:"Committed"},iC={$:"Judgment"},oC=function(e){switch(f(rc,99,il(Il(e)))){case 1:return ba(io);case 2:return ba(aC);case 3:return ba(iC);case 4:return ba(nC);default:return Ca}},uC=function(e){return $(e,nd("0x0000000000000000000000000000000000000000"))?Ca:ba(e)},sC=a(function(e,t,r,n){if("Nothing"===t.$)return Ca;var a=t.a;if("Nothing"===r.$)return Ca;var i=r.a;if("Nothing"===n.$)return Ca;var o=n.a;return ba(l(e,a,i,o))}),cC=function(e){var t=Ob(e.phaseStartTimestamp),r=oC(e.phase),a=rC(e.closedReason);return d(sC,n(function(t,r,n){return{balance:Vv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:uC(e.responder)}}),r,t,a)},fC=n(function(e,t,r){return f(mp,r,f(cp,cC,f(ip,e.httpProvider,Jb(t))))}),lC=i(function(e,t,r,n,a){return oo(F([l(Vb,e,t,r),l(fC,e,t,n),l(zb,e,t,a)]))}),dC=function(e){var t=Wp(e);if("Just"===t.$){return t.a}f(Rl,"Warning! BigInt to Int conversion failed!",Il(e));return 0},hC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),pC=n(function(e,t,r){for(;;){var n=f(li,32,e),a=n.a,i=n.b;if(_(Si(a),32)<0)return f(Ei,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(za,ci(a),t),s=r+1;e=o,t=u,r=s}}),gC=function(e){return e.b?l(pC,e,mr,0):si},vC=rn,yC=function(e){var t=h(vC,hC,f(Fd,"encapsulation",Lo),f(Fd,"iv",Lo),f(Fd,"tag",Lo),f(Fd,"encrypted",Lo)),r=Um(t),n=f(Jd,r,e);if("Err"===n.$){var a=n.a;return Ai(Zi(a))}var i=n.a;return function(e){var t=L(f(Sc,0,e),f(Sc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Bi(L(r,n))}return Ai("Decoded list has less than 2 items.")}(gC(i))},mC=function(e){var t=function(e){var t=yo(e);return t>1114111?Ai("string is too long"):Bi(f(zu,Hm(t),e))};return f(wo,zi(""),kd(f(nu,t,e)))},bC=function(e){var t=e.a,r=e.b;return mC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},CC=r(function(e,t){return Xd(F([L("message",Yd(e)),L("pubkeyHexStrings",f(Qd,Yd,F([t.initiatorPubkey,t.responderPubkey])))]))}),SC=function(e){return{$:"LoadedCommInfo",a:e}},EC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),TC=function(e){var t=L(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return SC(f(EC,r,n))}return em(e)},wC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return TC(U(r,{initiatorPubkey:ba(e)}))}var n=t.a;return SC(U(n,{initiatorPubkey:e}))}),IC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return TC(U(r,{responderPubkey:ba(e)}))}var n=t.a;return SC(U(n,{responderPubkey:e}))}),AC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return ny}r.a,r.b;return Ff}if("Buyer"===r.b.$){r.a,r.b;return Ff}r.a,r.b;return ny}),BC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=Li(r),i=f(ol,a,n),o=Zu(f(_s,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),kC=function(e){var t=gC(f(BC,Ss(e),mr));return l(Jl,Ag,h(qb,hC,f(Sc,0,t),f(Sc,1,t),f(Sc,2,t),f(Sc,3,t)),h(qb,hC,f(Sc,4,t),f(Sc,5,t),f(Sc,6,t),f(Sc,7,t)))},NC={$:"Aborted"},RC={$:"Burned"},$C={$:"Claimed"},xC=function(e){return{$:"Committed",a:e}},_C=function(e){return{$:"Encrypted",a:e}},LC={$:"FailedDecode"},PC={$:"Initiated"},DC={$:"Recalled"},UC={$:"Released"},OC=function(e){return{$:"StateChange",a:e}},MC=function(e){return{$:"Statement",a:e}},FC=lr,VC=fr,KC=r(function(e,t){var r=Si(e),n=32-Si(t.tail)-r,a=l(FC,32,t.tail,e);return n<0?{nodeList:f(za,ci(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(VC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(za,ci(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ui}}),HC=ur,jC=y,qC=a(function(e,t,r,n){var a=yc&t>>>e;if(_(a,Si(n))>-1){if(5===e)return f(HC,ci(r),n);var i=fi(d(qC,e-oi,t,r,ui));return f(HC,i,n)}var o=f(mc,a,n);if("SubTree"===o.$){var u=o.a,i=fi(d(qC,e-oi,t,r,u));return l(wc,a,i,n)}var i=fi(d(qC,e-oi,t,r,jC(o)));return l(wc,a,i,n)}),GC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=Si(i),u=Si(e),s=r+(u-o);if($(u,32)){if(_(s>>>oi,1<0){var c=n+oi,f=d(qC,c,r,e,jC(fi(a)));return d(ri,s,c,f,ui)}return d(ri,s,n,d(qC,n,r,e,a),ui)}return d(ri,s,n,a,e)}),zC=r(function(e,t){var r=(t.a,t.c,t.d),n=Si(e),a=32-Si(r)-n,i=l(FC,32,r,e),o=f(GC,i,t);if(a<0){var u=l(VC,a,n,e);return f(GC,u,o)}return o}),YC=sr,WC=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(YC,i,t,r)}return f(za,e,t)});return{nodeList:l(YC,i,mr,n),nodeListSize:t/32|0,tail:a}},JC=r(function(e,t){var n=(e.d,t.a),a=t.c,i=t.d;if(_(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(YC,o,t,r)}var n=e.a;return f(zC,n,t)});return f(zC,i,l(YC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(YC,o,t,r)}var n=e.a;return f(KC,n,t)});return f(Ei,!0,f(KC,i,l(YC,o,WC(e),a)))}),QC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(za,r,t)}),XC=f(Xa,QC,mr),ZC=n(function(e,t,r){var n=AC(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ba(OC(PC));case"CommittedEvent":var r=t.a;return ba(OC(xC(r.responder)));case"RecalledEvent":return ba(OC(DC));case"ClaimedEvent":return ba(OC($C));case"AbortedEvent":return ba(OC(NC));case"ReleasedEvent":return ba(OC(UC));case"BurnedEvent":return ba(OC(RC));case"InitiatorStatementLogEvent":var r=t.a;return ba(MC({blocknum:e,message:function(){var e=kC(r.statement);if("Just"===e.$){var t=e.a;return _C(t)}return LC}(),who:n(vb)}));case"ResponderStatementLogEvent":var r=t.a;return ba(MC({blocknum:e,message:function(){var e=kC(r.statement);if("Just"===e.$){var t=e.a;return _C(t)}return LC}(),who:n(yb)}));default:return Ca}}(),i=f(Gf,function(t){return{blocknum:e,eventInfo:t,time:Ca}},a);return L(U(r,{history:f(JC,r.history,gC(XC(F([i]))))}),function(){return"Just"===a.$&&"Statement"===a.a.$}())}),eS=zr,tS=function(e){var t=l(kf,Ag,f(Fd,"id",eS),f(Fd,"message",Lo));return f(zl,Zi,f(Jd,t,e))},rS=function(e){return{$:"Decrypted",a:e}},nS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),aS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(ZC,n,a,t),o=i.a,u=i.b;return d(nS,o,u,Ca,mr);case"MessageInputChanged":var s=e.a;return d(nS,U(t,{messageInput:s}),!1,Ca,mr);case"MessageSubmit":return d(nS,U(t,{messageInput:""}),!1,ba(t.messageInput),mr);default:var c=e.a,h=tS(c);if("Ok"===h.$){var p=h.a,g=p.a,v=p.b,y=f(Sc,g,t.history);if("Just"===y.$){var m=y.a,b=m.eventInfo;if("Statement"===b.$){var C=b.a,S=U(C,{message:rS(v)}),E=U(m,{eventInfo:MC(S)}),T=l(Ac,g,E,t.history);return d(nS,U(t,{history:T}),!1,Ca,mr)}return d(nS,t,!1,Ca,F([Tf(f(Xp,"got a decryption result, but for an event that is not a message!",m))]))}return d(nS,t,!1,Ca,F([Tf(f(Xp,"got a decryption result, but for an id out of bounds!",L(g,t.history)))]))}var w=h.a;return d(nS,t,!1,Ca,F([Tf(f(Xp,"Error decoding decryption result",w))]))}}),iS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),oS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),uS=function(e){return{onBroadcast:Ca,onMined:ba(L(iS(e),Ca)),onSign:ba(oS(e))}},sS=qe("encryptToPubkeys",no),cS=n(function(e,t,r){return{data:ba(f(pf,"commit(address,string)",F([ud(t),wp(r)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),fS=n(function(e,t,r){return{data:ba(f(pf,"commit(address,string)",F([ud(t),wp(r)]))),decoder:Po(vr),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),lS=function(e){return{$:"CommitMined",a:e}},dS={$:"CommitNeedsSig"},hS=function(e){return{$:"CommitSigned",a:e}},pS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?fS:cS}(),i=Cf(function(){return"Token"===e.factoryType.$?no:_p(qf(bb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ba(dS),f(yf,{onBroadcast:Ca,onMined:ba(L(lS,Ca)),onSign:ba(hS)},i))}),gS=r(function(e,t){return Xd(F([L("id",bh(e)),L("encapsulation",Yd(t.encapsulatedKey)),L("iv",Yd(t.iv)),L("tag",Yd(t.tag)),L("encrypted",Yd(t.message))]))}),vS=qe("decryptMessage",no),yS=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(za,L(r,e),n))});return l(Fa,n,L(t-1,mr),e).b},mS=r(function(e,t){return oo(f(nu,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 vS(f(gS,r,s))}return uo}return uo},yS(e.history)))}),bS=function(e){if("Just"===e.$){return e.a}return Ca},CS=function(e){var t=bS(l(Jl,mb,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ba(r)}return Ca}(),f(Gf,function(e){return e.address},e.userInfo))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(mS,n,a)}return uo},SS=r(function(e,t){return f(Gf,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return Ff}r.a,r.b;return ny}if("Seller"===r.b.$){r.a,r.b;return ny}r.a,r.b;return Ff},f(mb,e,t))}),ES=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b;if(!e.b)return L(r,n);var a=e.a,i=a.a,o=a.b,u=e.b,s=l(ZC,i,o,r),c=s.a,f=s.b,d=u,h=L(c,n||f);e=d,t=h}}),e,L(t,!1))}),TS=o(function(e,t,r,n,a,i){return{history:a,initiatorRole:n,messageInput:i,userInfo:t,userRole:r,web3Context:e}}),wS=i(function(e,t,r,n,a){return f(ES,a,p(TS,e,t,r,n,si,""))}),IS=a(function(e,t,r,n){var a=L(t,r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$){var i=a.a.a,o=a.b.a,u=f(SS,i,o.address);if("Just"===u.$){var s=u.a;return f(Zo,ba,h(wS,e,o,s,i.parameters.initiatorRole,n))}return L(Ca,!1)}return L(Ca,!1)}),AS={$:"Abort"},BS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),kS=function(e){return{$:"ActionNeedsSig",a:e}},NS=function(e){return{$:"ApproveMining",a:e}},RS={$:"ApproveNeedsSig"},$S=function(e){return{$:"ApproveSigned",a:e}},xS={$:"Burn"},_S=function(e){return{$:"ChatHistoryMsg",a:e}},LS={$:"Claim"},PS=function(e){return{$:"CommitMining",a:e}},DS=function(e){return{$:"ConfirmingAction",a:e}},US=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),OS=function(e){return{$:"EventLogFetched",a:e}},MS=function(e){return{$:"ParametersFetched",a:e}},FS=function(e){return{$:"PhaseInfoFetched",a:e}},VS={$:"Poke"},KS={$:"Recall"},HS={$:"Release"},jS=function(e){return{$:"StartContractAction",a:e}},qS=function(e){return{$:"StateFetched",a:e}},GS=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"}},zS=function(e){return d(hm,e,uo,lo,mr)},YS={mainParagraphs:F([F([Qp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Zp},WS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(eg,e,r)}if("Nothing"===t.a.$){t.a;return f(Xp,"Couldn't decode the fetched \""+e+'" result.',Ca)}return f(Xp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),JS={mainParagraphs:F([F([Qp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Zp},QS=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),XS=n(function(e,t,r){return l(Oh,e,Gf(function(e){return U(e,{logCount:Fi(t)+e.logCount})}),r)}),ZS=r(function(e,t){var r=t.a;return mm(f(Uh,e,r))}),eE=n(function(e,t,r){var n=e.a,a=f(Th,t,n.requests);if("Nothing"===a.$)return L(ym(n),uo);var i=a.a,o=L(i.watchOnce,el(r));if("Nothing"===o.b.$){o.b;return L(ym(U(n,{requests:l(XS,t,r,n.requests)})),uo)}if(o.a){var u=o.b.a;return L(ym(U(n,{requests:l(XS,t,r,n.requests),watching:f(ZS,t,n.watching)})),f(hg,i.tagger,Zh(u)))}return L(ym(U(n,{requests:l(XS,t,r,n.requests)})),oo(f(nu,function(e){return f(hg,i.tagger,Zh(e))},r)))}),tE=_e,rE=r(function(e,t){return f(mp,f(_a,vm,t),f(up,function(t){return gm(e)},tE(2e3)))}),nE=se,aE=fe,iE=n(function(e,t,r){var n=function(e){return aE(F([e,nE(r)]))};return f(xo,function(a){var i=f(Jd,e,a);if("Ok"===i.$){var o=i.a,u=f(Jd,n(t),o);if("Ok"===u.$){var s=u.a;return Po(s)}var c=u.a;return _o(Zi(c))}return Po(r)},to)}),oE=a(function(e,t,r,n){return f(pd,l(iE,f(Fd,e,to),t,r),n)}),uE=n(function(e,t,r){return f(pd,f(Fd,e,t),r)}),sE=Do(Ud),cE=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),fE=function(e){return{$:"BlockHash",a:e}},lE=function(e){return cE(e)?Bi(fE(No(e))):Ai("Given blockHash "+Dd(e)+" is not valid.")},dE=Do(lE),hE=function(e){return{$:"TxHash",a:e}},pE=function(e){return cE(e)?Bi(hE(No(e))):Ai("Given txHash "+Dd(e)+" is not valid.")},gE=Do(pE),vE=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}}),yE=Yr,mE=l(uE,"blockNumber",pm,l(uE,"blockHash",dE,l(uE,"transactionHash",gE,l(uE,"transactionIndex",pm,l(uE,"logIndex",pm,d(oE,"removed",yE,!1,l(uE,"topics",Um(db),l(uE,"data",Lo,l(uE,"address",sE,Po(vE)))))))))),bE=function(e){return f(Qd,function(e){if("Just"===e.$){var t=e.a;return Yd(hf(t))}return ch},e)},CE=function(e){return Xd(F([L("fromBlock",ih(e.fromBlock)),L("toBlock",ih(e.toBlock)),L("address",oh(e.address)),L("topics",bE(e.topics))]))},SE=r(function(e,t){return rp({decoder:Um(mE),method:"eth_getLogs",params:F([CE(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(up,function(r){return f(cp,_i(r),f(SE,e,U(t,{fromBlock:EE(n),toBlock:EE(a)})))},f(SE,e,t)):f(SE,e,t)}),wE=n(function(e,t,r){var n=r.a,a=r.b;return f(SE,e,U(t,{fromBlock:EE(n),toBlock:EE(a)}))}),IE=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(IE,e,t,i)),c=o;e=u,t=s,r=c}}),AE=r(function(e,t){return l(IE,Nh,t,e)}),BE=r(function(e,t){var r=e.a,n=t.a;return mm(f(AE,r,n))}),kE=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 oo(f(nu,function(t){return f(mp,f(_a,QS(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},XC(f(nu,function(e){return f(Th,e,r.requests)},Ga(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(ym(U(r,{blockNumber:ba(a)})),oo(F([f(rE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,wE)]))):L(t,f(rE,r.nodePath,r.tagger))}return L(ym(U(r,{blockNumber:ba(a),pending:bm,watching:f(BE,r.watching,r.pending)})),oo(F([f(rE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,TE),l(i,L(a,a),r.watching,wE)])))}var s=e.a.a;return L(ym(U(r,{errors:f(za,s,r.errors)})),f(rE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(eE,t,c,d)}var s=e.b.a;return L(ym(U(r,{errors:f(za,s,r.errors)})),uo)}),NE=r(function(e,t){var r=t.a;return mm(l(Nh,e,vr,r))}),RE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=U(a,{ref:a.ref+1,requests:l(Nh,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(ym(U(o,{watching:f(NE,a.ref,o.watching)})),f(mp,f(_a,QS(a.ref),a.tagger),e),a.ref)}(l(TE,a.nodePath,n,L(s,s)))}return P(ym(U(o,{pending:f(NE,a.ref,o.pending)})),uo,a.ref)}),$E=RE(!1),xE=function(e){return F([e])},_E=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(lm,t.web3Context,r.id):uo}return uo}()),n=function(){var e=P(t.userInfo,t.trade,t.web3Context.factoryType);if("Just"===e.a.$&&"LoadedTrade"===e.b.$&&"Token"===e.c.$){var r=e.a.a,n=e.b.a,a=e.c.a;return h(bp,t.web3Context,a,r.address,n.creationInfo.address,Ly)}return uo}(),a=function(){return"Nothing"===t.chatHistoryModel.$?d(IS,t.web3Context,t.trade,t.userInfo,t.eventsWaitingForChatHistory):L(t.chatHistoryModel,!1)}(),i=a.a,o=a.b,u=U(t,{chatHistoryModel:i}),s=o?CS(t):uo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(hm,u,oo(F([l(fC,t.web3Context,p.creationInfo.address,qS),s,r,n])),lo,mr)}return zS(u);case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var v=g.a,u=U(t,{allowance:ba(v)}),y=P(u.txChainStatus,u.trade,u.userInfo);if("Just"===y.a.$&&"ApproveMining"===y.a.a.$&&"LoadedTrade"===y.b.$&&"Just"===y.c.$){var m=y.b.a,b=y.c.a;if($(f(Tu,v,qf(bb(m.parameters))),Oa))return zS(u);var C=d(pS,t.web3Context,m,b.address,b.commPubkey),S=C.a,E=C.b;return d(hm,U(u,{txChainStatus:S}),uo,E,mr)}return zS(u)}var T=g.a;return d(hm,t,uo,lo,F([Tf(f(eg,"allowance",T))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var w=g.a,I={address:w.address_,blocknum:dC(w.blocknum)},A=l($E,OS,t.eventSentry,{address:I.address,fromBlock:EE(I.blocknum),toBlock:ap,topics:mr}),B=A.a,k=A.b,u=U(t,{eventSentry:B,trade:f(Rb,I,t.trade)}),N=oo(F([k,h(lC,u.web3Context,I.address,MS,qS,FS)]));return d(hm,u,N,lo,mr)}if("BadBody"===g.a.$){g.a.a;return d(hm,t,uo,lo,F([Tf(YS)]))}var T=g.a;return d(hm,t,uo,lo,F([Tf(f(eg,"trade state",T))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var R=g.a.a,x=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,R.phase);default:return!1}}(),u=U(t,{expandedPhase:x?R.phase:t.expandedPhase,trade:f(_b,R,t.trade)});return d(hm,u,CS(u),lo,mr)}return d(hm,t,uo,lo,F([Tf(f(WS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var _=g.a.a;if(Cb(_)){var u=U(t,{trade:f($b,_,t.trade)});return d(hm,u,CS(u),lo,mr)}return d(hm,t,uo,lo,F([Tf(JS)]))}var D=g.a.a;return d(hm,t,uo,lo,F([Tf(f(Xp,"Error decoding fetched trade parameters",D))]))}var M=g.a;return d(hm,t,uo,lo,F([Tf(f(eg,"trade parameters",M))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var V=g.a.a,u=U(t,{trade:f(xb,V,t.trade)});return d(hm,u,CS(u),lo,mr)}return d(hm,t,uo,lo,F([Tf(f(WS,"trade state",g))]));case"EventLogFetched":var K=e.a,H=f(Zd,gb,K),j=H.returnData;if("Err"===j.$){var q=j.a;return d(hm,t,uo,lo,F([Tf(f(Xp,"Error decoding contract event",q))]))}var G=j.a,z=function(){switch(G.$){case"InitiatedEvent":var e=G.a;return f(wC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=G.a;return f(IC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),Y=function(){if("InitiatedEvent"===G.$){var e=G.a,r=Om(e.terms);if("Ok"===r.$){var n=r.a;return L(f(Lb,n,t.trade),Ca)}var a=r.a;return L(t.trade,ba(f(Xp,"Couldn't decode payment methods!",a)))}return L(t.trade,Ca)}(),W=Y.a,J=Y.b,Q=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return f(Zo,ba,l(ZC,H.blockNumber,G,r))}return d(IS,t.web3Context,W,t.userInfo,t.eventsWaitingForChatHistory)}(),i=Q.a,o=Q.b,X=function(){return"Nothing"===i.$?f(Za,t.eventsWaitingForChatHistory,F([L(H.blockNumber,G)])):mr}(),u=U(t,{chatHistoryModel:i,eventsWaitingForChatHistory:X,secureCommInfo:z,trade:W}),N=o?CS(u):uo;return d(hm,u,N,lo,f(nu,Tf,XC(F([J]))));case"ExpandPhase":var Z=e.a;return zS(U(t,{expandedPhase:Z}));case"ToggleChat":var ee=!t.showChatHistory;return zS(U(t,{showChatHistory:ee}));case"ToggleStatsModal":var te=!t.showStatsModal;return zS(U(t,{showStatsModal:te}));case"ViewUserHistory":var re=e.a,ne=t.trade;if("LoadedTrade"===ne.$){var m=ne.a;return d(hm,t,uo,lo,F([po(f(mf,m.parameters.initiatorAddress,re))]))}return d(hm,t,uo,lo,F([Tf(f(Xp,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var m=e.a,b=e.b,ae=e.c;return zS(U(t,{txChainStatus:ba(l(US,m,b,ae))}));case"AbortAction":return zS(U(t,{txChainStatus:Ca}));case"ConfirmCommit":var m=e.a,b=e.b,ae=e.c,ie=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return d(pS,t.web3Context,m,b.address,b.commPubkey);var r=e.a,n=function(){var e=Cf(l(fd,id(r),m.creationInfo.address,ae)),t={onBroadcast:Ca,onMined:Ca,onSign:ba($S)};return f(yf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Tu,i,qf(bb(m.parameters))),Oa)?L(ba(RS),n):d(pS,t.web3Context,m,b.address,b.commPubkey)}return L(ba(RS),n)}(),S=ie.a,E=ie.b;return d(hm,U(t,{txChainStatus:S}),uo,E,mr);case"ContractActionClicked":var oe=e.a;if($(oe,VS)||$(oe,KS)){var ue=jS(oe),se=t;e=ue,t=se;continue e}return zS(U(t,{txChainStatus:ba(DS(oe))}));case"StartContractAction":var ce=e.a,fe=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,lo,F([Tf(f(Xp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(ce.$){case"Recall":var a=Cf(Am(n.creationInfo.address));return P(ba(kS(KS)),f(yf,uS(KS),a),mr);case"Claim":var a=Cf(wm(n.creationInfo.address));return P(ba(kS(LS)),f(yf,uS(LS),a),mr);case"Abort":var a=Cf(Em(n.creationInfo.address));return P(ba(kS(AS)),f(yf,uS(AS),a),mr);case"Release":var a=Cf(Bm(n.creationInfo.address));return P(ba(kS(HS)),f(yf,uS(HS),a),mr);case"Burn":var a=Cf(Tm(n.creationInfo.address));return P(ba(kS(xS)),f(yf,uS(xS),a),mr);default:var a=Cf(gf(n.creationInfo.address));return P(ba(kS(VS)),f(yf,uS(VS),a),mr)}}(),S=fe.a,E=fe.b,le=fe.c;return d(hm,U(t,{txChainStatus:S}),uo,E,le);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return zS(U(t,{txChainStatus:ba(NS(he))}))}var D=de.a;return d(hm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"approve",D))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return zS(U(t,{txChainStatus:ba(PS(he))}))}var D=de.a;return d(hm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,"commit",D))]));case"CommitMined":return zS(U(t,{txChainStatus:Ca}));case"ActionSigned":var oe=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return zS(U(t,{txChainStatus:ba(f(BS,oe,he))}))}var D=de.a;return d(hm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ng,GS(oe),D))]));case"ActionMined":var oe=e.a;return zS(U(t,{txChainStatus:Ca}));case"EventSentryMsg":var pe=e.a,ge=f(kE,pe,t.eventSentry),ve=ge.a,N=ge.b;return d(hm,U(t,{eventSentry:ve}),N,lo,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(aS,ye,be),Se=U(t,{chatHistoryModel:ba(Ce.model)}),s=Ce.shouldCallDecrypt?CS(t):uo,Ee=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(sS(f(CC,r,a)),Ca)}return L(uo,ba(f(Xp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(uo,Ca)}(),Te=Ee.a,we=Ee.b;return d(hm,Se,oo(F([s,Te])),lo,O(f(Mf,_S,Ce.appCmds),f(rc,mr,f(Gf,xE,f(Gf,Tf,we)))))}return d(hm,t,uo,lo,F([Tf(f(Xp,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(rh,bC,yC(Ie)),Be=P(t.userInfo,t.trade,Ae);if("Ok"===Be.c.$){if("Just"===Be.a.$&&"LoadedTrade"===Be.b.$){var b=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(mb,p,b.address);if("Nothing"===Ne.$)return d(hm,t,uo,lo,F([Tf(f(Xp,"Trying to encrypt, but the user is not involved in this trade.",Ca))]));var Re=Ne.a,$e=function(){return Cf("Initiator"===Re.$?f(Im,p.creationInfo.address,ke):f(km,p.creationInfo.address,ke))}();return d(hm,t,uo,f(yf,{onBroadcast:Ca,onMined:Ca,onSign:Ca},$e),mr)}var xe=Be.a,_e=Be.b;return d(hm,t,uo,lo,F([Tf(f(Xp,"Encryption successful, but the user or trade is no longer valid.",L(xe,_e)))]))}var Le=Be.c.a;return d(hm,t,uo,lo,F([Tf(f(Xp,"Error translating JS encryption result into Elm.",Le))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return zS(t)}var D=e.a.a;return d(hm,t,uo,lo,F([Tf(f(tg,"message",D))]));default:return d(hm,t,uo,lo,F([wf]))}}),LE=function(e){return{$:"EventSentryMsg",a:e}},PE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),DE=function(e){var t=f(Cm,LE,e.httpProvider),r=t.a,n=t.b;return L({dataFetchStatus:l(PE,Ca,0,0),eventSentry:r,trades:si,web3Context:e},n)},UE=function(e){return{data:ba(f(pf,"numTrades()",mr)),decoder:Uo(Gd),from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},OE=r(function(e,t){return f(mp,t,f(ip,e.httpProvider,UE(ad(e.factoryType))))}),ME=function(e){return{$:"InitialNumTradesFetched",a:e}},FE=function(e){return f(OE,e.web3Context,ME)},VE=function(e){var t=DE(e),r=t.a,n=t.b;return L(r,oo(F([n,FE(r)])))},KE=r(function(e,t){return{address:e,blocknum:t}}),HE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(RE,!0,e,t,r))}),jE=n(function(e,t,r){var n=function(e){return r(f(Zd,Wm,e).returnData)},a={address:t.address,fromBlock:EE(t.blocknum),toBlock:EE(t.blocknum),topics:F([ba(pb("Initiated(string,string)"))])};return l(HE,n,e,a)}),qE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(za,a,r)}return r}),GE=r(function(e,t){return l(Xa,qE(e),mr,t)}),zE=function(e){return f(GE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ba(t)}return Ca},Va(e.trades))},YE=function(e){return f(Wa,r(function(t,r){return e(t)?r+1:r}),0)},WE=function(e){return f(YE,pi(Sb),Va(e.trades))},JE=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:WE(e),loaded:Fi(zE(e))})})},QE=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),XE=r(function(e,t){var r=f(Sc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Ac,e,Sb,t.trades));return l(QE,JE(U(t,{trades:n})),uo,mr)}return l(QE,t,uo,F([Tf(f(Xp,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),ZE=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Rb,t,a),o=l(Ac,e,i,r.trades);return L(JE(U(r,{trades:o})),mr)}return L(r,F([f(Xp,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),eT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f($b,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),tT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(xb,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),rT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(_b,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),nT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Lb,t,a),o=l(Ac,e,i,r.trades);return l(QE,JE(U(r,{trades:o})),uo,mr)}return l(QE,r,uo,F([Tf(f(Xp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),aT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),iT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),oT=function(e){return{$:"NumTradesFetchedAgain",a:e}},uT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),sT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),cT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),fT=function(e){return l(QE,e,uo,mr)},lT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=dC(n),i=gC(f(nu,Xy,f(Hi,0,a-1))),o=oo(f(nu,function(e){return l(cm,t.web3Context,hu(e),aT(e))},f(Hi,0,a-1)));return l(QE,U(t,{dataFetchStatus:l(PE,ba(a),0,0),trades:i}),o,mr)}var u=r.a;return l(QE,t,uo,F([Tf(f(eg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(QE,t,f(OE,t.web3Context,oT),mr);case"NumTradesFetchedAgain":var r=e.a,s=L(r,t.dataFetchStatus.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=dC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=oo(f(nu,function(e){return l(cm,t.web3Context,hu(e),aT(e))},f(Hi,c,d-1))),g=gC(f(nu,Xy,f(Hi,c,d-1)));return l(QE,U(t,{dataFetchStatus:U(p,{total:ba(d)}),trades:f(JC,t.trades,g)}),o,mr)}return fT(t)}s.b;return l(QE,t,uo,F([Tf(f(Xp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(QE,t,uo,F([Tf(f(eg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(KE,y.address_,dC(y.blocknum)),b=l(jE,t.eventSentry,m,iT(v)),C=b.a,S=b.b,E=oo(F([h(lC,t.web3Context,m.address,uT(v),cT(v),sT(v)),S])),T=l(ZE,v,m,t),w=T.a,I=T.b;return l(QE,JE(U(w,{eventSentry:C})),E,f(nu,Tf,I))}var u=r.a;return l(QE,t,uo,F([Tf(f(eg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(QE,t,uo,F([Tf(f(eg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(eT,v,B,t)}var k=r.a.a;return l(QE,t,uo,F([Tf(f(Xp,"Can't decode fetched trade parameters",k))]));case"StateFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var N=r.a.a;return l(rT,v,N,t)}return l(QE,t,uo,F([Tf(f(WS,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(tT,v,R,t)}return l(QE,t,uo,F([Tf(f(WS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Om($.terms);if("Ok"===x.$){var P=x.a;return l(nT,v,P,t)}var D=x.a;return f(XE,v,t)}var D=r.a;return l(QE,t,uo,F([Tf(f(Xp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(kE,O,t.eventSentry),V=M.a,E=M.b;return l(QE,U(t,{eventSentry:V}),E,mr)}}),dT=function(e){return{$:"AgentHistoryMsg",a:e}},hT=function(e){return{$:"AppCmd",a:e}},pT={$:"BetaLandingPage"},gT={$:"ConnectToWeb3"},vT=function(e){return{$:"MarketplaceMsg",a:e}},yT=function(e){return{$:"TradeCacheMsg",a:e}},mT=r(function(e,t){return f(jn,e,Yd(t))}),bT=function(e){return f(mT,"href",it(e))},CT=qn("rel"),ST=mT("target"),ET=function(e){return{$:"Height",a:e}},TT=ET,wT={$:"Content"},IT=wT,AT=function(e){return{$:"Width",a:e}},BT=AT,kT=function(e){return{$:"Attr",a:e}},NT=function(e){return{$:"NodeName",a:e}},RT=function(e){return{$:"Unkeyed",a:e}},$T={$:"AsEl"},xT=$T,_T=r(function(e,t){return{$:"Field",a:e,b:t}}),LT=f(_T,0,0),PT={$:"NoNearbyChildren"},DT={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",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputText:"it",italic:"i",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"},UT=DT.any+" "+DT.column,OT=DT.any+" "+DT.grid,MT=DT.any+" "+DT.page,FT=DT.any+" "+DT.paragraph,VT=DT.any+" "+DT.row,KT=DT.any+" "+DT.single,HT=function(e){switch(e.$){case"AsRow":return VT;case"AsColumn":return UT;case"AsEl":return KT;case"AsGrid":return OT;case"AsParagraph":return FT;default:return MT}},jT=function(e){return{$:"Keyed",a:e}},qT={$:"NoStyleSheet"},GT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return O(r,e);case"ChildrenInFront":var n=t.a;return O(e,n);default:var r=t.a,n=t.b;return O(r,O(e,n))}}),zT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(nu,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(nu,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return O(f(nu,function(t){return L(e,t)},n),O(t,f(nu,function(t){return L(e,t)},a)))}}),YT={$:"AsParagraph"},WT=YT,JT=On("div"),QT=On("p"),XT=On("s"),ZT=On("u"),ew=mT("className"),tw=function(e){return Fn(rt(e))},rw=function(e){return On(rt(e))},nw=function(e){return{$:"Flag",a:e}},aw=function(e){return{$:"Second",a:e}},iw=function(e){return e>31?aw(1< .ctr > ."+DT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",oI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Bw(DT.any)+Bw(DT.row)+" > "+Bw(DT.any)+" { flex-basis: auto !important; } "+Bw(DT.any)+Bw(DT.row)+" > "+Bw(DT.any)+Bw(DT.container)+" { flex-basis: auto !important; }}\n\n/* General Input Reset */\ninput[type=range] {\n -webkit-appearance: none; /* Hides the slider so that custom slider can be made */\n /* width: 100%; Specific width is required for Firefox. */\n background: transparent; /* Otherwise white in Chrome */\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\n/* Hide all syling for track */\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\n/* Thumbs */\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"+iI,uI=function(e){return{$:"Intermediate",a:e}},sI=r(function(e,t){return uI({closing:t,others:mr,props:mr,selector:e})}),cI=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 U(t,{props:f(za,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return U(t,{others:f(za,uI({closing:"\n}",others:mr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return U(t,{others:f(za,f(cI,f(sI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(za,f(cI,f(sI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(za,f(cI,f(sI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(za,f(cI,f(sI,n.selector,""),v),t.others)})}});return uI(l(Xa,a,n,t))}),fI=O(oI,function(e){var t=function(e){return Tl(f(nu,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 O(n(t),Tl(f(nu,a,t.others)))};return Tl(f(nu,a,l(Xa,r(function(e,t){var r=e.a,n=e.b;return f(za,f(cI,f(sI,r,""),n),t)}),mr,e)))}(O(rI,aI))),lI=l(rw,"style",mr,F([Nw(fI)])),dI=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+'"'}},hI=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}},pI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ed,hI,t.variants)}return!1},gI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),vI=r(function(e,t){return e+" {"+f(zi,"",f(nu,function(e){return e.a+": "+e.b+";"},t))+"}"}),yI=n(function(e,t,r){var n=r.a,a=r.b;return F([f(vI,"."+e+"."+t+", ."+e+" ."+t,n),f(vI,"."+e+"."+t+"> ."+DT.text+", ."+e+" ."+t+" > ."+DT.text,a)])}),mI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(zi," ",O(l(yI,i,DT.sizeByCapital,a),l(yI,i,DT.fullSize,n)))}),bI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(zi," ",F([f(vI,"."+r+"."+DT.sizeByCapital+", ."+r+" ."+DT.sizeByCapital,F([L("line-height","1")])),f(vI,"."+r+"."+DT.sizeByCapital+"> ."+DT.text+", ."+r+" ."+DT.sizeByCapital+" > ."+DT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),CI=function(e){if(e.b){var t=e.a,r=e.b;return ba(l(Wa,mi,t,r))}return Ca},SI=function(e){if(e.b){var t=e.a,r=e.b;return ba(l(Wa,qs,t,r))}return Ca},EI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),TI=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(rc,e.descender,SI(t)),n=f(rc,e.baseline,SI(f(th,function(e){return!$(e,r)},t))),a=f(rc,e.capital,CI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(EI,i,a-n,o),full:l(EI,u,a-r,s)}},wI=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",ww(e.height)),L("vertical-align",ww(e.vertical)+"em"),L("font-size",ww(e.size)+"em")]))},II=function(e){return l(Wa,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 ba(L(wI(function(e){return e.full}(TI(a))),wI(function(e){return e.capital}(TI(a)))))}return t}return t}),Ca,e)},AI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ba("@import url('"+t+"');")}return Ca},r=function(e){var r=(e.a,e.b);return f(zi,"\n",f(GE,t,r))},n=f(nu,gi,e),a=function(e){var t=e.a,r=e.b,a=II(r);if("Nothing"===a.$)return f(zi,"",f(nu,bI(t),n));var i=a.a;return f(zi,"",f(nu,f(mI,t,i),n))};return O(f(zi,"\n",f(nu,r,e)),f(zi,"\n",f(nu,a,e)))},BI=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+'" '+Gi(r)}},kI=function(e){if("FontWith"===e.$){var t=e.a;return ba(f(zi,", ",f(nu,BI,t.variants)))}return Ca},NI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ba(L(t,r))}return Ca},RI=function(e){switch(e.$){case"Untransformed":return Ca;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ba("translate3d("+ww(r)+"px, "+ww(n)+"px, "+ww(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("+ww(o)+"px, "+ww(u)+"px, "+ww(s)+"px)",b="scale3d("+ww(f)+", "+ww(l)+", "+ww(d)+")",C="rotate3d("+ww(p)+", "+ww(g)+", "+ww(v)+", "+ww(y)+"rad)";return ba(m+" "+b+" "+C)}},$I=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Wa,gI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Wa,gI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Wa,gI(!1),"",n)+"\n}"}case"Focus":var a=l(Wa,gI(!1),"",n);return f(zi,"\n",F([r+"-fs:focus {"+a+"\n}","."+DT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+DT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+DT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Wa,gI(!1),"",n)+"\n}"}}),i=r(function(e,t){switch(e.$){case"Style":var r=e.a,o=e.b;return l(a,t,r,o);case"Shadows":var u=e.a,s=e.b;return l(a,t,"."+u,F([f(Ew,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(mi,0,f(qs,1,1-c));return l(a,t,"."+u,F([f(Ew,"opacity",ww(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Gi(h),F([f(Ew,"font-size",Gi(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(zi,", ",f(GE,kI,p)),v=F([f(Ew,"font-family",f(zi,", ",f(nu,dI,p))),f(Ew,"font-feature-settings",g),f(Ew,"font-variant",f(Ed,pI,p)?"small-caps":"normal")]);return f(zi," ",F([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,F([f(Ew,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Ew,s,Iw(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=Gi(E)+"px",w=Gi(S)+"px",I="."+DT.row,A="."+(DT.wrapped+I),B="."+DT.alignRight,k="."+DT.paragraph,N="."+DT.page,R="."+DT.alignLeft,$=ww(E/2)+"px",x=ww(S/2)+"px",_="."+DT.column,y="."+C,P="."+DT.any;return Tl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Ew,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Ew,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Ew,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Ew,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Ew,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Ew,"margin-left",w)])),l(a,t,O(y,k),F([f(Ew,"line-height","calc(1em + "+Gi(E)+"px)")])),l(a,t,"textarea"+y,F([f(Ew,"line-height","calc(1em + "+Gi(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Ew,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Ew,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Ew,"content","''"),f(Ew,"display","block"),f(Ew,"height","0"),f(Ew,"width","0"),f(Ew,"margin-top",Gi(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Ew,"content","''"),f(Ew,"display","block"),f(Ew,"height","0"),f(Ew,"width","0"),f(Ew,"margin-bottom",Gi(-1*(E/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Ew,"padding",Gi(D)+"px "+Gi(B)+"px "+Gi(U)+"px "+Gi(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,U=e.d,R=e.e,y="."+C;return l(a,t,y,F([f(Ew,"border-width",Gi(D)+"px "+Gi(B)+"px "+Gi(U)+"px "+Gi(R)+"px")]));case"GridTemplateStyle":var M=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Gi(n)+"px";case"Content":var a=L(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, "+Gi(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Gi(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Gi(o)+"px, "+Gi(i)+"px)";case"Fill":var u=r.a,s=L(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Gi(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Gi(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Gi(o)+"px, "+Gi(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Gi(o)+"px, "+Gi(i)+"px)";case"Min":var c=r.a,f=r.b,l=ba(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ba(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,Ca,Ca,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(zi," ",f(nu,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(zi,H,f(nu,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(zi,H,f(nu,K,M.columns))),z="grid-row-gap:"+K(M.spacing.b)+";",Y="grid-column-gap:"+K(M.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(zi," ",f(nu,K,M.columns))),y=".grid-rows-"+f(zi,"-",f(nu,yw,M.rows))+"-cols-"+f(zi,"-",f(nu,yw,M.columns))+"-space-x-"+yw(M.spacing.a)+"-space-y-"+yw(M.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return O(X,Q);case"GridPosition":var Z=e.a,ee=f(zi," ",F(["-ms-grid-row: "+Gi(Z.row)+";","-ms-grid-row-span: "+Gi(Z.height)+";","-ms-grid-column: "+Gi(Z.col)+";","-ms-grid-column-span: "+Gi(Z.width)+";"])),te=f(zi," ",F(["grid-row: "+Gi(Z.row)+" / "+Gi(Z.row+Z.height)+";","grid-column: "+Gi(Z.col)+" / "+Gi(Z.col+Z.width)+";"])),y=".grid-pos-"+Gi(Z.row)+"-"+Gi(Z.col)+"-"+Gi(Z.width)+"-"+Gi(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(zi," ",f(nu,function(e){return f(i,e,ba(y))},re));default:var ne=e.a,m=RI(ne),y=bw(ne),ae=L(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return l(a,t,"."+C,F([f(Ew,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,Ca)),topLevel:function(){var r=NI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(za,n,t.topLevel)}()}}),u=l(Wa,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(AI(s),c)}),xI=r(function(e,t){return l(rw,"style",mr,F([Nw(f($I,e,t))]))}),_I=a(function(e,t,r,n){return e?f(za,L("static-stylesheet",lI),f(za,L("dynamic-stylesheet",f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b)),n)):f(za,L("dynamic-stylesheet",f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b)),n)}),LI=a(function(e,t,r,n){return e?f(za,lI,f(za,f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b),n)):f(za,f(xI,t,l(Wa,Sw,L(bm,F([kw(t.focus)])),r).b),n)}),PI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(tw,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(_I,!1,e,t,r);default:var e=i.a,t=i.b;return d(_I,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return JT;case"p":return QT;default:return rw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(LI,!1,e,t,n);default:var e=i.a,t=i.b;return d(LI,!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(rw,e,n,F([f(u,r,F([ew(DT.any+" "+DT.single)]))]))}}();switch(o.$){case"AsRow":return f(dw,pw,e)&&!f(dw,hw,e)?s:f(dw,uw,e)?f(ZT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.contentCenterY,DT.alignContainerRight])))]),F([s])):f(dw,sw,e)?f(XT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.contentCenterY,DT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(dw,lw,e)&&!f(dw,fw,e)?s:f(dw,cw,e)?f(XT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.alignContainerCenterY])))]),F([s])):f(dw,ow,e)?f(ZT,F([ew(f(zi," ",F([DT.any,DT.single,DT.container,DT.alignContainerBottom])))]),F([s])):s;default:return s}}),DI=Nw,UI=function(e){return f(JT,F([ew(f(zi," ",F([DT.any,DT.text,DT.widthContent,DT.heightContent])))]),F([DI(e)]))},OI=function(e){return l(rw,"div",F([ew(f(zi," ",F([DT.any,DT.text,DT.widthFill,DT.heightFill])))]),F([Nw(e)]))},MI=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,WT),L(f(za,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,WT),L(f(za,L(n,f(s.html,qT,e)),i),Go(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(za,L(n,$(e,xT)?OI(c):UI(c)),i),o);default:return L(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,WT),L(f(za,i(e),n),a);case"Styled":var o=t.a;return $(e,WT),L(f(za,f(o.html,qT,e),n),Go(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(za,$(e,xT)?OI(u):UI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Xa,a,L(mr,mr),o),s=u.a,c=u.b,p=Go(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return xf({html:d(PI,n.has,n.node,n.attributes,jT(l(zT,"nearby-element-pls",s,n.children))),styles:g})}return Lf(h(PI,n.has,n.node,n.attributes,jT(l(zT,"nearby-element-pls",s,n.children)),qT))}var v=t.a,y=l(Xa,i,L(mr,mr),v),m=y.a,c=y.b,p=Go(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return xf({html:d(PI,n.has,n.node,n.attributes,RT(f(GT,m,n.children))),styles:g})}return Lf(h(PI,n.has,n.node,n.attributes,RT(f(GT,m,n.children)),qT))}),FI=r(function(e,t){return f(qn,nt(e),ot(t))}),VI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(_T,a|r,n)}var i=e.a;return f(_T,r,i|n)}),KI=iw(7),HI=iw(36),jI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(_T,r|a,n|i)}),qI=iw(6),GI=iw(38),zI=iw(30),YI=iw(29),WI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),JI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),QI=function(e){return{$:"Transform",a:e}},XI=function(e){return{$:"ChildrenBehind",a:e}},ZI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),eA=function(e){return{$:"ChildrenInFront",a:e}},tA=r(function(e,t){return f(JT,F([ew(function(){switch(e.$){case"Above":return f(zi," ",F([DT.nearby,DT.single,DT.above]));case"Below":return f(zi," ",F([DT.nearby,DT.single,DT.below]));case"OnRight":return f(zi," ",F([DT.nearby,DT.single,DT.onRight]));case"OnLeft":return f(zi," ",F([DT.nearby,DT.single,DT.onLeft]));case"InFront":return f(zi," ",F([DT.nearby,DT.single,DT.inFront]));default:return f(zi," ",F([DT.nearby,DT.single,DT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return Nw("");case"Text":var e=t.a;return UI(e);case"Unstyled":return(0,t.a)(xT);default:return f(t.a.html,qT,xT)}}()]))}),rA=n(function(e,t,r){var n=f(tA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?XI(F([n])):eA(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?XI(f(za,n,a)):f(ZI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(ZI,F([n]),i):eA(f(za,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(ZI,f(za,n,a),i):f(ZI,a,f(za,n,i))}}),nA=r(function(e,t){switch(t.$){case"Generic":return NT(e);case"NodeName":var r=t.a;return f(WI,r,e);default:var n=t.a,a=t.b;return f(WI,n,a)}}),aA=function(e){switch(e.$){case"Left":return DT.alignedHorizontally+" "+DT.alignLeft;case"Right":return DT.alignedHorizontally+" "+DT.alignRight;default:return DT.alignedHorizontally+" "+DT.alignCenterX}},iA=function(e){switch(e.$){case"Top":return DT.alignedVertically+" "+DT.alignTop;case"Bottom":return DT.alignedVertically+" "+DT.alignBottom;default:return DT.alignedVertically+" "+DT.alignCenterY}},oA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),uA=function(e){return{$:"Moved",a:e}},sA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return uA(P(r,0,0));case"MoveY":var n=t.a;return uA(P(0,n,0));case"MoveZ":var a=t.a;return uA(P(0,0,a));case"MoveXYZ":var i=t.a;return uA(i);case"Rotate":var i=t.a,o=t.b;return d(oA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(oA,P(0,0,0),i,P(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 uA(P(s,n,a));case"MoveY":var c=t.a;return uA(P(r,c,a));case"MoveZ":var f=t.a;return uA(P(r,n,f));case"MoveXYZ":var i=t.a;return uA(i);case"Rotate":var i=t.a,o=t.b;return d(oA,u,P(1,1,1),i,o);default:var l=t.a;return d(oA,u,l,P(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(oA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(oA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(oA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(oA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(oA,u,h,v,y);default:var m=t.a;return d(oA,u,m,p,o)}}}),cA=function(e){switch(e.$){case"Px":var t=e.a,r=Gi(t),n="height-px-"+r;return P(LT,n,F([l(JI,n,"height",r+"px")]));case"Content":return P(f(VI,HI,LT),DT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(VI,lw,LT),DT.heightFill,mr):P(f(VI,lw,LT),DT.heightFillPortion+" height-fill-"+Gi(a),F([l(JI,DT.any+"."+DT.row+" > "+Bw("height-fill-"+Gi(a)),"flex-grow",Gi(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Gi(i),s=l(JI,u,"min-height",Gi(i)+"px"),c=cA(o),d=c.a,h=c.b,p=c.c;return P(f(VI,fw,d),u+" "+h,f(za,s,p));default:var g=e.a,o=e.b,u="max-height-"+Gi(g),s=l(JI,u,"max-height",Gi(g)+"px"),v=cA(o),d=v.a,h=v.b,p=v.c;return P(f(VI,fw,d),u+" "+h,f(za,s,p))}},fA=function(e){switch(e.$){case"Px":var t=e.a;return P(LT,DT.widthExact+" width-px-"+Gi(t),F([l(JI,"width-px-"+Gi(t),"width",Gi(t)+"px")]));case"Content":return P(f(VI,GI,LT),DT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(VI,pw,LT),DT.widthFill,mr):P(f(VI,pw,LT),DT.widthFillPortion+" width-fill-"+Gi(r),F([l(JI,DT.any+"."+DT.row+" > "+Bw("width-fill-"+Gi(r)),"flex-grow",Gi(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Gi(n),o=l(JI,i,"min-width",Gi(n)+"px"),u=fA(a),s=u.a,c=u.b,d=u.c;return P(f(VI,hw,s),i+" "+c,f(za,o,d));default:var h=e.a,a=e.b,i="max-width-"+Gi(h),o=l(JI,i,"max-width",Gi(h)+"px"),p=fA(a),s=p.a,c=p.b,d=p.c;return P(f(VI,hw,s),i+" "+c,f(za,o,d))}},lA=iw(27),dA=r(function(e,t){if($(e,lA)){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}}),hA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=bw(n);if("Nothing"===s.$)return{attributes:f(za,ew(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(za,ew(e+" "+c),i),children:o,has:r,node:t,styles:f(za,QI(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,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Class":var E=d.a,T=d.b;if(f(dw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=T+" "+e,g=t,v=f(VI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(za,w,i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"StyleClass":var E=d.a,I=d.b;if(f(dw,E,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(f(dA,E,I)){var p=Cw(I)+" "+e,g=t,v=f(VI,E,r),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=Cw(I)+" "+e,g=t,v=f(VI,E,r),y=n,m=f(za,I,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"TransformComponent":var E=d.a,A=d.b,p=e,g=t,v=f(VI,E,r),y=f(sA,n,A),m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Width":var B=d.a;if(f(dw,qI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(B.$){case"Px":var k=B.a,p=DT.widthExact+" width-px-"+Gi(k)+" "+e,g=t,v=f(VI,qI,r),y=n,m=f(za,l(JI,"width-px-"+Gi(k),"width",Gi(k)+"px"),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=e+" "+DT.widthContent,g=t,v=f(VI,GI,f(VI,qI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+DT.widthFill,g=t,v=f(VI,pw,f(VI,qI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+DT.widthFillPortion+" width-fill-"+Gi(N),g=t,v=f(VI,pw,f(VI,qI,r)),y=n,m=f(za,l(JI,DT.any+"."+DT.row+" > "+Bw("width-fill-"+Gi(N)),"flex-grow",Gi(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var R=fA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(jI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Height":var L=d.a;if(f(dw,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}switch(L.$){case"Px":var k=L.a,P=Gi(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(VI,KI,r),y=n,m=f(za,l(JI,D,"height ",P),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Content":var p=DT.heightContent+" "+e,g=t,v=f(VI,HI,f(VI,KI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Fill":var N=L.a;if(1===N){var p=DT.heightFill+" "+e,g=t,v=f(VI,lw,f(VI,KI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e+" "+DT.heightFillPortion+" height-fill-"+Gi(N),g=t,v=f(VI,lw,f(VI,KI,r)),y=n,m=f(za,l(JI,DT.any+"."+DT.column+" > "+Bw("height-fill-"+Gi(N)),"flex-grow",Gi(1e5*N)),a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var U=cA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(jI,$,r),y=n,m=O(_,a),b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(nA,"main",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Navigation":var p=e,g=f(nA,"nav",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"ContentInfo":var p=e,g=f(nA,"footer",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Complementary":var p=e,g=f(nA,"aside",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(nA,"h1",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}if(F<7){var p=e,g=f(nA,"h"+Gi(F),t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=e,g=f(nA,"h6",t),v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return NT("p");case"NodeName":var e=t.a;return NT(e);default:var r=t.a,n=t.b;return f(WI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"role","button"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"aria-label",K),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"aria-live","polite"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(za,f(FI,"aria-live","assertive"),i),C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}case"Nearby":var H=d.a,j=d.b,_=function(){switch(j.$){case"Empty":return a;case"Text":j.a;return a;case"Unstyled":j.a;return a;default:var e=j.a;return O(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=_,b=i,C=l(rA,H,j,o),S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;case"AlignX":var q=d.a;if(f(dw,zI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=aA(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(VI,sw,e);case"Right":return f(VI,uw,e);default:return e}}(f(VI,zI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e;default:var G=d.a;if(f(dw,YI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}var p=iA(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(VI,cw,e);case"Bottom":return f(VI,ow,e);default:return e}}(f(VI,YI,r)),y=n,m=a,b=i,C=o,S=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=S;continue e}}}),pA={$:"Untransformed"},gA=pA,vA=a(function(e,t,r,n){return l(MI,e,n,v(hA,HT(e),t,LT,gA,mr,mr,PT,Ja(r)))}),yA=function(e){return kT(ew(e))},mA=r(function(e,t){var r=t.url,n=t.label;return d(vA,xT,NT("a"),f(za,kT(bT(r)),f(za,kT(CT("noopener noreferrer")),f(za,kT(ST("_blank")),f(za,BT(IT),f(za,TT(IT),f(za,yA(DT.contentCenterX+" "+DT.contentCenterY),e)))))),RT(F([n])))}),bA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),CA=n(function(e,t,r){return d(bA,e,t,r,1)}),SA=iw(14),EA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),TA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),wA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return mw(t)+"-"+mw(r)+"-"+mw(n)+"-"+mw(a)},IA=function(e){return f(TA,SA,l(EA,"fc-"+wA(e),"color",e))},AA={mainParagraphs:F([F([Qp("You need a web3 provider (such as "),f(mA,F([IA(l(CA,0,0,1))]),{label:Qp("Metamask"),url:"https://metamask.io/"}),Qp(") to Connect.")]),F([Qp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:rg},BA={mainParagraphs:F([F([Qp("I don't understand that URL...")]),F([Qp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Zp},kA={mainParagraphs:F([F([Qp("Your wallet is set to an incorrect network.")]),F([Qp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Zp},NA=Do(f(_a,df,f(_a,qd,Pl("Error decoding hex to BigInt")))),RA=function(){return Do(function(e){switch(e){case"0x0":return Bi(!1);case"0x1":return Bi(!0);default:return Ai("Error decoding "+e+"as bool.")}})}(),$A=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}}}}}}}}}}}},xA=function(e){return aE(F([f(Bf,ba,e),Po(Ca)]))},_A=f(pd,xA(f(Fd,"status",RA)),f(pd,xA(f(Fd,"root",Lo)),l(uE,"logsBloom",Lo,l(uE,"logs",Um(mE),f(pd,xA(f(Fd,"contractAddress",sE)),l(uE,"cumulativeGasUsed",NA,l(uE,"gasUsed",NA,l(uE,"blockNumber",pm,l(uE,"blockHash",dE,l(uE,"transactionIndex",pm,l(uE,"transactionHash",gE,Po($A)))))))))))),LA=function(e){var t=e.a;return df(t)},PA=f(_a,LA,Yd),DA=r(function(e,t){return rp({decoder:_A,method:"eth_getTransactionReceipt",params:F([PA(t)]),url:e})}),UA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),OA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),MA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),FA=r(function(e,t){return f(Gf,function(e){return e.toMsg},f(ag,function(e){return e.b},f(ag,function(e){return e.onMinedTagger},f(Th,t,e))))}),VA=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}}}}}}}}}}}},KA=function(e){return aE(F([nE(Ca),f(Bf,ba,e)]))},HA=l(uE,"input",Lo,l(uE,"gas",pm,l(uE,"gasPrice",NA,l(uE,"value",NA,l(uE,"to",KA(sE),l(uE,"from",sE,l(uE,"transactionIndex",pm,l(uE,"blockNumber",KA(pm),l(uE,"blockHash",function(e){return f(xo,function(t){return"0x"===t||"0x0"===t?Po(Ca):f(qi,function(e){return $(e,D("0"))},No(t))?Po(Ca):f(Bf,ba,e)},Lo)}(dE),l(uE,"nonce",pm,l(uE,"hash",gE,Po(VA)))))))))))),jA=r(function(e,t){return rp({decoder:HA,method:"eth_getTransactionByHash",params:F([PA(t)]),url:e})}),qA=r(function(e,t){return{attempts:e,sleep:t}}),GA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(yp,function(e){return a>0?f(up,function(e){return f(GA,f(qA,a,n),t)},tE(1e3*n)):Xh(e)},t)}),zA=r(function(e,t){return f(up,function(r){return f(GA,{attempts:30,sleep:1},f(jA,e,t))},tE(250))}),YA=r(function(e,t){return f(GA,{attempts:60,sleep:5},f(DA,e,t))}),WA=function(e){return{$:"Mined",a:e}},JA=function(e){return Gf(function(t){return U(t,{status:WA(e)})})},QA=function(e){return{$:"Sent",a:e}},XA=function(e){return Gf(function(t){return U(t,{status:QA(e)})})},ZA=function(e){return{$:"Signed",a:e}},eB=function(e){return Gf(function(t){return U(t,{status:ZA(e)})})},tB=function(e){return"Nothing"!==e.$},rB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(xg(r),uo);case"TxSigned":var n=e.a,a=e.b,i=f(Th,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(hg,t,Zh(a))}return uo}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return uo;if("Just"===t.b.$){var r=t.b.a;return f(hg,r,Zh(Ai(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(hg,a,Zh(Ai(e)))}t.a,t.b,t.c;return uo};if("Ok"===a.$){var c=a.a,d=tB(o.onBroadcastTagger)||tB(o.onMinedTagger)?f(Dg,r.tagger,f(mp,MA(n),f(zA,r.nodePath,c))):uo;return L(xg(U(r,{txs:l(Oh,n,eB(c),r.txs)})),oo(F([u,d])))}var h=a.a;return L(xg(r),oo(F([u,s(h)])))}return L(xg(r),uo);case"TxSent":var n=e.a,p=e.b,g=f(Th,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Dg,r.tagger,f(mp,OA(n),f(YA,r.nodePath,v.hash))):uo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(hg,t,Zh(Bi(v)))}return uo}();return L(xg(U(r,{txs:l(Oh,n,XA(v),r.txs)})),oo(F([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(hg,t,Zh(Ai("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(hg,n,Zh(Ai("Error with TxSent stuff")))}e.a,e.b;return uo}();return L(xg(r),s)}return L(xg(r),uo);case"TxMined":var n=e.a,m=e.b,b=f(Th,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(hg,a,Zh(Bi(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 oo(F([f(Dg,r.tagger,f(mp,f(UA,n,s),gm(r.nodePath))),f(hg,a,Zh(Bi(C))),f(hg,u.toMsg,Zh(s))]))}return uo}();return L(xg(U(r,{txs:l(Oh,n,JA(C),r.txs)})),S)}var h=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(hg,r,Zh(Ai("TxReceipt decoding failure")))}return uo}();return L(xg(r),E)}return L(xg(r),uo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=U(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if($(w,T.stopWatchingAtBlock)){var A=f(FA,r.txs,n);if("Just"===A.$){var B=A.a;return L(xg(r),f(hg,B,f(yp,function(e){return Zh(U(I,{doneWatching:!0,reOrg:!0}))},f(up,function(e){return Zh(U(I,{doneWatching:!0}))},f(DA,r.nodePath,T.txHash)))))}return L(xg(r),uo)}if($(w,T.lastCheckedBlock))return L(xg(r),f(Dg,r.tagger,f(mp,f(UA,n,T),f(up,function(e){return gm(r.nodePath)},tE(2e3)))));var k=f(FA,r.txs,n);if("Just"===k.$){var B=k.a;return L(xg(r),oo(F([f(Dg,r.tagger,f(mp,f(UA,n,I),f(up,function(e){return gm(r.nodePath)},tE(2e3)))),f(hg,B,Zh(I))])))}return L(xg(r),uo)}var n=e.a,h=e.c.a;return L(xg(r),uo);default:var h=e.a;return L(xg(r),uo)}}),nB=Qt,aB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Gi(r)}),iB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),oB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(iB,"#",e.fragment,l(iB,"?",e.query,O(f(aB,e.port_,O(t,e.host)),e.path)))},uB=r(function(e,t){if(e<0)return t;var r=Nd(f(ol,e,t)),n=f(_s,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(Za,n,a)}),sB=r(function(e,t){zv(t);switch(t.$){case"Home":return L(U(e,{submodel:pT}),uo);case"Create":var r=f(td,e.web3Context,e.userInfo),n=f(Mg,e.txSentry,f(Vg,Oy,r.chainCmd)),a=n.a,i=n.b;return f(fB,f(Mf,Oy,r.appCmds),L(U(e,{submodel:Uy(r.model),txSentry:a}),oo(F([f(Dg,Oy,r.cmd),i]))));case"QuickCreate":var r=f(wv,e.web3Context,e.userInfo),o=f(Mg,e.txSentry,f(Vg,Vy,r.chainCmd)),a=o.a,i=o.b;return f(fB,f(Mf,Vy,r.appCmds),L(U(e,{submodel:Fy(r.model),txSentry:a}),oo(F([f(Dg,Vy,r.cmd),i]))));case"Trade":var u=t.a,r=l(Sm,e.web3Context,e.userInfo,u),s=f(Mg,e.txSentry,f(Vg,Hy,r.chainCmd)),a=s.a,i=s.b;return f(fB,f(Mf,Hy,r.appCmds),L(U(e,{submodel:Ky(r.model),txSentry:a}),oo(F([f(Dg,Hy,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(iv,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:My(p)}),oo(F([f(Dg,vT,g)])));case"AgentHistory":var v=t.a,y=t.b,m=d(so,e.web3Context,v,y,e.userInfo),b=m.a,C=m.b;return L(U(e,{submodel:Dy(b)}),oo(F([f(Dg,dT,C)])));default:return L(f(ei,BA,e),uo)}}),cB=r(function(e,t){var r=t.a,n=t.b,a=f(lB,hT(e),r),i=a.a,o=a.b;return L(i,oo(F([n,o])))}),fB=r(function(e,t){var r=t.a,n=t.b;return l(Wa,cB,L(r,n),e)}),lB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(lB,gT,t);case"GotoRoute":var n=r.a;return L(t,f(wy,t.key,n));case"GTag":var a=r.a;return L(t,ky(Ay(a)));default:var i=r.a;return L(f(ei,i,t),uo)}case"DismissNotice":var o=e.a;return L(U(t,{userNotices:f(uB,o,t.userNotices)}),uo);case"LinkClicked":var u=e.a,s=function(){if("Internal"===u.$){var e=u.a;return f(Ty,t.key,oB(e))}var r=u.a;return nB(r)}();return L(t,s);case"UrlChanged":var c=e.a;return f(dB,c,t);case"GotoRoute":var d=e.a;return L(t,f(wy,t.key,d));case"Tick":var h=e.a;return L(U(t,{time:h}),uo);case"NetworkUpdate":var p=e.a,g=f(wo,xa,f(Jd,eS,p)),v=f(ag,Sa,Ql(g)),y=L(g,v);if("Ok"===y.a.$){if("Just"===y.b.$){var m=y.a.a,b=y.b.a;if($(m,Kg(t.web3Context.factoryType)))return L(t,uo);var C=Da(b),S=VE(C),E=S.a,T=S.b,w=f(Wy,C,t.submodel),I=w.a,A=w.b,B=w.c;return L(U(t,{submodel:I,tradeCache:E,web3Context:C}),oo(F([f(Dg,yT,T),function(){if("Just"===B.$){var e=B.a;return f(wy,t.key,e)}return A}()])))}y.b;return L(f(ei,kA,t),uo)}var k=y.a.a;return L(l(ma,ei,f(Xp,"Can't decode networkID from Javascript",k),t),uo);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(ei,AA,t),uo):L(t,Iy(vr));case"WalletStatus":var N=e.a,R=function(){var e=N.account;if("Nothing"===e.$)return uo;var t=e.a;return Ny(f(By,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 L(U(t,{userAddress:N.account}),R);case"UserPubkeySet":var x=e.a,_=f(Jd,Lo,x);if("Ok"===_.$){var P=_.a,D=t.userAddress;if("Just"===D.$){var O=D.a,M=ba({address:O,commPubkey:P}),V=f(jy,M,t.submodel),I=V.a,s=V.b;return L(U(t,{submodel:I,userInfo:M}),s)}return L(f(ei,f(Xp,"User pubkey set, but I can no longer find the user address!",Ca),t),uo)}var K=_.a;return L(l(ma,ei,f(Xp,"error decoding commPubkey from JS",K),t),uo);case"CreateMsg":var H=e.a,j=t.submodel;if("CreateModel"===j.$){var q=j.a,G=f(Rg,H,q),z=f(Mg,t.txSentry,f(Vg,Oy,G.chainCmd)),Y=z.a,W=z.b;return f(fB,f(Mf,Oy,G.appCmds),L(U(t,{submodel:Uy(G.model),txSentry:Y}),oo(F([f(Dg,Oy,G.cmd),W]))))}return L(t,uo);case"QuickCreateMsg":var J=e.a,Q=t.submodel;if("QuickCreateModel"===Q.$){var X=Q.a,G=f(Kv,J,X),Z=f(Mg,t.txSentry,f(Vg,Vy,G.chainCmd)),Y=Z.a,W=Z.b;return f(fB,f(Mf,Vy,G.appCmds),L(U(t,{submodel:Fy(G.model),txSentry:Y}),oo(F([f(Dg,Vy,G.cmd),W]))))}return L(t,uo);case"TradeMsg":var ee=e.a,te=t.submodel;if("TradeModel"===te.$){var re=te.a,G=f(_E,ee,re),ne=f(Mg,t.txSentry,f(Vg,Hy,G.chainCmd)),Y=ne.a,W=ne.b;return f(fB,f(Mf,Hy,G.appCmds),L(U(t,{submodel:Ky(G.model),txSentry:Y}),oo(F([f(Dg,Hy,G.cmd),W]))))}return L(t,uo);case"MarketplaceMsg":var ae=e.a,ie=t.submodel;if("MarketplaceModel"===ie.$){var oe=ie.a,G=f(mv,ae,oe);return f(fB,f(Mf,vT,G.appCmds),L(U(t,{submodel:My(G.model)}),f(Dg,vT,G.cmd)))}return L(t,uo);case"AgentHistoryMsg":var ue=e.a,se=t.submodel;if("AgentHistoryModel"===se.$){var ce=se.a,G=f(Sf,ue,ce),fe=f(Mg,t.txSentry,f(Vg,dT,G.chainCmd)),Y=fe.a,W=fe.b;return f(fB,f(Mf,dT,G.appCmds),L(U(t,{submodel:Dy(G.model),txSentry:Y}),oo(F([f(Dg,dT,G.cmd),W]))))}return L(t,uo);case"TxSentryMsg":var le=e.a,de=f(rB,le,t.txSentry),I=de.a,he=de.b;return L(U(t,{txSentry:I}),he);case"TradeCacheMsg":var pe=e.a,G=f(lT,pe,t.tradeCache);return L(U(t,{tradeCache:G.tradeCache}),f(Dg,yT,G.cmd));case"NoOp":return L(t,uo);default:var K=e.a;f(Rl,"test",K);return L(t,uo)}}),dB=r(function(e,t){return f(sB,t,Ey(e))}),hB={$:"AllGood"},pB={$:"NoWeb3"},gB=function(e){return{$:"TxSentryMsg",a:e}},vB={$:"WrongNetwork"},yB={mainParagraphs:F([F([Qp("No web3 provider detected. Is "),f(mA,F([IA(l(CA,0,0,1))]),{label:Qp("Metamask"),url:"https://metamask.io/"}),Qp(" or some other web3 provider installed and unlocked?")])]),noticeType:rg},mB={mainParagraphs:F([F([Qp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:rg},bB=n(function(e,t,r){var n=e.a,a=e.b;return xg({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Eh})}),CB=n(function(e,t,r){var n=e.width<1024?ba(mB):Ca,a=function(){if(e.networkId){var t=La(e.networkId);if("Nothing"===t.$)return L(la(da),vB);return L(t.a,hB)}return L(la(da),pB)}(),i=a.a,o=a.b,u=Da(i),s=VE(u),c=s.a,d=s.b,h=l(bB,L(ao,ro),gB,u.httpProvider),p=function(){switch(o.$){case"NoWeb3":return ba(yB);case"WrongNetwork":return ba(kA);default:return Ca}}(),g=XC(F([n,p])),v=f(dB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:pT,time:Kf(0),tradeCache:c,txSentry:h,userAddress:Ca,userInfo:Ca,userNotices:mr,web3Context:u}),y=v.a,m=v.b;return L(f(ti,g,y),oo(F([f(Dg,yT,d),m])))}),SB=ze("networkSentryPort",to),EB=Me,TB=EB(mr),wB=function(e){return TB},IB=function(e){return{$:"Refresh",a:e}},AB=r(function(e,t){return{$:"Every",a:e,b:t}}),BB=r(function(e,t){return{processes:t,taggers:e}}),kB=Zh(f(BB,Eh,Eh)),NB=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(_(c,r)<0){var p=r,g=n,v=L(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return _(c,r)>0?L(o,l(a,r,n,u)):L(h,d(t,c,f,n,u))}return L(o,l(a,r,n,u))}}),c=l(IE,s,L(ja(i),u),o),f=c.a,h=c.b;return l(Wa,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),RB=Re,$B=r(function(e,t){var r=e.a,n=e.b,a=f(Th,r,t);if("Nothing"===a.$)return l(Nh,r,F([n]),t);var i=a.a;return l(Nh,r,f(za,n,i),t)}),xB=ke,_B=r(function(e,t){return{$:"Zone",a:e,b:t}}),LB=fa,PB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=xB(f(LB,n,f(Vh,e,n)));return f(up,function(t){return l(PB,e,a,l(Nh,n,t,r))},i)}return Zh(r)}),DB=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 P(n,a,f(up,function(e){return i},RB(t)))}),u=l(Wa,$B,Eh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(za,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(a,l(Nh,e,r,i),o)}),d=p(NB,s,c,o,u,i,P(mr,Eh,Zh(vr))),h=d.a,g=d.b,v=d.c;return f(up,function(e){return Zh(f(BB,u,e))},f(up,function(t){return l(PB,e,h,g)},v))}),UB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Kf),OB=n(function(e,t,r){var n=f(Th,t,r.taggers);if("Nothing"===n.$)return Zh(r);var a=n.a,i=function(t){return lp(f(nu,function(r){return f(Fh,e,r(t))},a))};return f(up,function(e){return Zh(r)},f(up,i,UB))}),MB=r(function(e,t){var r=t.a,n=t.b;return f(AB,r,f(Af,e,n))});gn.Time=De(kB,DB,OB,0,MB);var FB=Oe("Time"),VB=r(function(e,t){return FB(f(AB,e,t))}),KB=function(e){return f(VB,2e3,IB)},HB=function(e){return TB},jB=function(e){return{$:"Refresh",a:e}},qB=function(e){return f(VB,2e3,jB)},GB=function(e){return{$:"DecryptionFinished",a:e}},zB=ze("decryptionFinished",to),YB=ze("encryptionFinished",to),WB=function(e){return{$:"EncryptionFinished",a:e}},JB=function(e){return{$:"Refresh",a:e}},QB=function(e){return EB(F([f(VB,3e3,JB),YB(WB),zB(function(e){return _S(GB(e))})]))},XB=mn,ZB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return TB;case"CreateModel":t.a;return f(XB,Oy,KB());case"QuickCreateModel":t.a;return f(XB,Vy,qB());case"TradeModel":t.a;return f(XB,Hy,QB());case"MarketplaceModel":t.a;return f(XB,vT,HB());default:t.a;return f(XB,dT,wB())}},ek=ze("userPubkeyResult",to),tk=ze("walletSentryPort",to),rk={$:"CheckForNewTrades"},nk=function(e){return f(VB,5e3,function(e){return rk})},ak=function(e){return{$:"NetworkUpdate",a:e}},ik=function(e){return{$:"Tick",a:e}},ok=function(e){return{$:"UserPubkeySet",a:e}},uk=function(e){return{$:"WalletStatus",a:e}},sk=function(e){return f(Xp,"Error decoding JS walletSentry: "+e,Ca)},ck=function(e){return{$:"ErrorDecoding",a:e}},fk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),lk=l(kf,r(function(e,t){return{ref:e,txHash:t}}),f(Fd,"ref",eS),f(Fd,"txHash",xA(gE))),dk=function(e){var t=f(Jd,lk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(fk,r.ref,Bi(a))}return f(fk,r.ref,Ai("Problem signing/broadcasting Tx. Ref #"+Gi(r.ref)))}t.a;return ck("Error decoding tx data")},hk=function(e){var t=e.a;return f(XB,t.tagger,t.inPort(dk))},pk=f(Bf,xa,eS),gk=Do(f(_a,il,f(_a,Pl("Failure decoding stringy int"),wo(xa)))),vk=aE(F([gk,pk])),yk=r(function(e,t){return{account:e,networkId:t}}),mk=l(kf,yk,f(Fd,"account",xA(sE)),f(Fd,"networkId",vk)),bk=n(function(e,t,r){var n=f(Jd,mk,r);if("Err"===n.$){var a=n.a;return e(Zi(a))}return t(n.a)}),Ck=function(e){var t=f(_a,sk,f(_a,Tf,hT));return EB(O(F([f(VB,1e3,ik),tk(f(bk,t,uk)),hk(e.txSentry),ek(ok),f(XB,yT,nk(e.tradeCache)),SB(ak)]),F([ZB(e)])))},Sk=function(e){return{$:"LinkClicked",a:e}},Ek=function(e){return{$:"UrlChanged",a:e}},Tk=n(function(e,t,r){return d(bA,e/255,t/255,r/255,1)}),wk=l(Tk,10,33,108),Ik={$:"Generic"},Ak=Ik,Bk=r(function(e,t){return d(vA,xT,Ak,f(za,BT(IT),f(za,TT(IT),e)),RT(F([t])))}),kk=function(e){return{$:"Fill",a:e}},Nk=kk(1),Rk=$f,$k=function(e){return{$:"Px",a:e}},xk=$k,_k=iw(8),Lk=function(e){return f(TA,_k,l(EA,"bg-"+wA(e),"background-color",e))},Pk=f(Bk,F([BT(Nk),TT(xk(150)),Lk(wk)]),Rk),Dk=function(e){return{$:"GotoRoute",a:e}},Uk={$:"Active"},Ok={$:"Important"},Mk={$:"Normal"},Fk=l(CA,1,1,1),Vk=iw(2),Kk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Hk=r(function(e,t){return $(e,t)?f(TA,Vk,h(Kk,"p-"+Gi(e),e,e,e,e)):f(TA,Vk,h(Kk,"p-"+Gi(e)+"-"+Gi(t),t,e,t,e))}),jk=iw(21),qk=r(function(e,t){return{$:"Class",a:e,b:t}}),Gk=f(qk,jk,DT.cursorPointer),zk=iw(17),Yk=function(e){return f(TA,zk,l(JI,"br-"+Gi(e),"border-radius",Gi(e)+"px"))},Wk=function(e){return{$:"Normal",a:e}},Jk=Kn,Qk=r(function(e,t){return f(Jk,e,Wk(t))}),Xk=function(e){return f(Qk,"click",Po(e))},Zk=f(Af,kT,Xk),eN=iw(13),tN=f(qk,eN,DT.textSemiBold),rN=iw(4),nN=function(e){return{$:"FontSize",a:e}},aN=function(e){return f(TA,rN,nN(e))},iN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Yk(4),Lk(l(CA,0,0,1))]);default:return F([Yk(4),Lk(l(CA,.9,0,0))])}}();return f(Bk,O(F([f(Hk,23,12),aN(22),tN,IA(Fk),Gk,Zk(t)]),n),Qp(e))}),oN=l(Tk,244,0,103),uN=function(e){return{$:"AlignX",a:e}},sN={$:"CenterX"},cN=uN(sN),fN=iw(3),lN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),dN=r(function(e,t){return"spacing-"+Gi(e)+"-"+Gi(t)}),hN=function(e){return f(TA,fN,l(lN,f(dN,e,e),e,e))},pN=function(e){return{$:"Describe",a:e}},gN={$:"Paragraph"},vN=r(function(e,t){return d(vA,WT,Ak,f(za,pN(gN),f(za,BT(Nk),f(za,hN(5),e))),RT(t))}),yN=f(qk,eN,DT.bold),mN=f(Bk,F([aN(29),IA(Fk),yN,cN,Gk,Zk(Dk(Jv))]),f(vN,mr,F([Qp("DAI"),f(Bk,F([IA(oN)]),Qp("Hard"))]))),bN=function(e){var t=e.web3Context.factoryType;if("Native"!==t.$){if("EthDai"===t.a.$){t.a;return"Mainnet Dai"}t.a;return"Testnet Dai"}switch(t.a.$){case"Eth":t.a;return"Mainnet ETH";case"Kovan":t.a;return"Testnet ETH";case"Rootstock":t.a;return"Rootstock SBTC";case"RootstockTest":t.a;return"RskTest SBTC";default:t.a;return"xDai"}},CN=yA(DT.italic),SN=function(e){return f(Bk,F([aN(18),IA(l(CA,.8,.8,1)),tN,CN,cN]),Qp(bN(e)))},EN={$:"Right"},TN=uN(EN),wN={$:"AsColumn"},IN=wN,AN=r(function(e,t){return d(vA,IN,Ak,f(za,yA(DT.contentTop+" "+DT.contentLeft),f(za,TT(IT),f(za,BT(IT),e))),RT(t))}),BN={$:"AsRow"},kN=BN,NN=r(function(e,t){return d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY),f(za,BT(IT),f(za,TT(IT),e))),RT(t))}),RN=function(e){return f(NN,F([BT(Nk),hN(30),f(Hk,30,17)]),F([l(iN,"Create a New Offer",Dk(Wv),function(){return"CreateModel"===e.submodel.$?Uk:Mk}()),l(iN,"Sell Offers",Dk(Qv(ny)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ny)?Uk:Mk}return Mk}()),l(iN,"Buy Offers",Dk(Qv(Ff)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Ff)?Uk:Mk}return Mk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(iN,"My Trades",Dk(f(mf,r.address,Ff)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Uk:Mk}return Mk}())}return l(iN,"Connect to Wallet",gT,Ok)}(),f(AN,F([TN,hN(0),f(Hk,8,0)]),F([mN,SN(e)]))]))},$N=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ba(e.agentAddress))}},xN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},_N=function(e){return r(function(e,t){var r=f(fu,xN(e.state.phase),xN(t.state.phase));return $(r,Ua)?r:f(Hg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},LN=Er,PN=r(function(e,t){return f(_a,th(e),LN(t))}),DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=iw(20),FN=f(qk,MN,DT.clip),VN=kk,KN=function(e){return f(TA,Vk,h(Kk,"p-"+Gi(e),e,e,e,e))},HN=function(e){var t=e.a,r=e.b;return f(Bk,F([BT(VN(t)),TT(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,BT(Nk)]),r))},jN=f(qk,eN,DT.textMedium),qN=function(e){return f(Bk,F([jN,aN(17)]),Qp(e))},GN=function(e){return{$:"Poke",a:e}},zN=iw(33),YN={$:"Hover"},WN=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),JN=zn,QN=r(function(e,t){return{$:"Nearby",a:e,b:t}}),XN={$:"NoAttribute"},ZN=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),eR=r(function(e,t){switch(t.$){case"NoAttribute":return XN;case"Describe":var r=t.a;return pN(r);case"AlignX":var n=t.a;return uN(n);case"AlignY":var a=t.a;return DN(a);case"Width":var n=t.a;return AT(n);case"Height":var n=t.a;return ET(n);case"Class":var n=t.a,a=t.b;return f(qk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(TA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QN,u,f(Pf,e,s));case"Attr":var c=t.a;return kT(f(JN,e,c));default:var l=t.a,d=t.b;return f(ZN,l,d)}}),tR=function(e){return f(eR,dg,e)},rR=r(function(e,t){var r=t.a,n=t.b,a=tR(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(za,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(sA,n,o));default:return L(r,n)}}),nR=function(e){var t=l(Wa,rR,L(mr,pA),e),r=t.a,n=t.b;return f(za,QI(n),r)},aR=function(e){return f(TA,zN,f(WN,YN,nR(e)))},iR=a(function(e,t,r,n){return d(bA,e/255,t/255,r/255,n)}),oR=me,uR=r(function(e,t){return f(jn,e,oR(t))}),sR=uR("disabled"),cR=function(e){return f(qn,"tabIndex",Gi(e))},fR=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},lR=function(e){return f(Ed,fR,e)?XN:yA("focusable")},dR=function(e){return{$:"MayPreventDefault",a:e}},hR=r(function(e,t){return f(Jk,e,dR(t))}),pR=r(function(e,t){var r=function(r){return $(r,e)?Po(t):_o("Not the enter key")},n=f(xo,r,f(Fd,"key",Lo));return kT(f(hR,"keyup",f(Bf,function(e){return L(e,!0)},n)))}),gR=function(e){return f(pR,"Enter",e)},vR={$:"Button"},yR=r(function(e,t){var r=t.onPress,n=t.label;return d(vA,xT,Ak,f(za,BT(IT),f(za,TT(IT),f(za,yA(DT.contentCenterX+" "+DT.contentCenterY+" "+DT.seButton+" "+DT.noTextSelection),f(za,Gk,f(za,lR(e),f(za,pN(vR),f(za,kT(cR(0)),function(){if("Nothing"===r.$)return f(za,kT(sR(!0)),e);var t=r.a;return f(za,Zk(t),f(za,gR(t),e))}()))))))),RT(F([n])))}),mR=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(5),Yk(4),BT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,IA(l(Tk,16,7,234)),jN,aN(14)]),Qp("Poke")),onPress:ba(GN(e))})},bR=function(e){return{$:"TimeLeft",a:e}},CR=function(e){return{$:"TimeUp",a:e}},SR=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 Kf(0)}}),ER=r(function(e,t){return Kf(Yl(e)-Yl(t))}),TR=r(function(e,t){var r=f(SR,t.state.phase,t),n=f(ER,e,t.state.phaseStartTime),a=f(ER,r,n);return Yl(a)>0?bR(L(a,r)):CR(r)}),wR=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},IR=l(CA,0,0,0),AR=l(Tk,233,237,242),BR={$:"Behind"},kR=function(e){return f(QN,BR,e)},NR=r(function(e,t){var r=Bg(200*e),n=200-r,a=f(Bk,F([BT(VN(n))]),Rk),i=F([TT(xk(3)),Yk(20)]),o=f(Bk,O(i,F([BT(VN(r)),Lk(t)])),Rk),u=f(Bk,O(i,F([BT(Nk),Lk(AR)])),Rk);return f(NN,F([BT(Nk),kR(u)]),F([o,a]))}),RR=l(Tk,51,183,2),$R=function(e){return Yl(e)<0},xR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),_R=function(e){var t=Pp(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(xR,dC(t),dC(r),dC(n),dC(a))}(f(rc,L(hu(0),hu(0)),f(qu,n,hu(60))))}(f(rc,L(hu(0),hu(0)),f(qu,r,hu(3600))))}(f(rc,L(hu(0),hu(0)),f(qu,t,hu(86400))))},LR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!$R(a)){var u=r(function(e,t){return O(l(Xu,2,D("0"),Gi(e)),t)}),s=Yl(a)>0?i:o,c=_R(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(NN,O(F([hN(5)]),e),F([f(Bk,O(F([IA(h)]),t),Qp(f(u,c.days,"d"))),f(Bk,O(F([IA(d)]),t),Qp(f(u,c.hours,"h"))),f(Bk,O(F([IA(s)]),t),Qp(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Kf(0);e=p,t=g,n=v,a=y}}),PR=l(CA,1,1,0),DR=r(function(e,t){return Yl(e)/Yl(t)}),UR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(DR,o,u),c=(f(Bk,F([cN]),d(LR,mr,mr,L(a,i),o)),s<.1?oN:s<.2?PR:RR);return f(AN,O(F([hN(5)]),e),F([d(LR,F([cN]),t,L(a,i),o),f(NR,1-s,c)]))}),OR=a(function(e,t,r,n){var a=f(TR,e,t);if("TimeLeft"===a.$){var i=a.a,o=r&&f(DR,i.a,i.b)<.05?oN:IR;return d(UR,F([BT(Nk)]),F([aN(16)]),L(o,AR),i)}return f(AN,F([hN(4),BT(Nk)]),O(F([f(Bk,F([cN,aN(14)]),Qp(wR(t.state.phase)))]),n?F([f(Bk,F([cN]),mR(t.creationInfo.address))]):mr))}),MR=function(e){return{$:"JustImage",a:e}},FR=MR,VR=function(e){return l(Wa,r(function(e,t){var r=e.a,n=e.b;return l(Nh,r,n,t)}),Eh,e)}(f(nu,function(e){var t=e.a;return L(t,L(e.b,FR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},F([L("AUD","$"),L("CLP","$"),L("EUR","€"),L("IDR","Rp"),L("KRW","₩"),L("NZD","$"),L("RUB","₽"),L("TRY","₺"),L("BRL","R$"),L("CNY","¥"),L("GBP","£"),L("ILS","₪"),L("MXN","$"),L("PHP","₱"),L("SEK","kr"),L("TWD","NT$"),L("CAD","$"),L("CZK","Kč"),L("HKD","$"),L("INR","₹"),L("MYR","RM"),L("PKR","₨"),L("SGD","$"),L("USD","$"),L("CHF","Fr"),L("DKK","kr"),L("HUF","Ft"),L("JPY","¥"),L("NOK","kr"),L("PLN","zł"),L("THB","฿"),L("ZAR","R"),L("VND","₫")]))),KR=function(e){return f(rc,"",f(Gf,gi,f(Th,e,VR)))},HR=function(e){return yo(e)<=3?e:HR(f(Al,3,e))+","+f(Ao,3,e)},jR=function(e){return HR(Il(e))},qR=function(e){return O(KR(e.fiatType),jR(e.amount))},GR=mT("alt"),zR=function(e){return f(mT,"src",ot(e))},YR=r(function(e,t){var r=t.src,n=t.description,a=f(th,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(vA,xT,Ak,f(za,yA(DT.imageContainer),e),RT(F([d(vA,xT,NT("img"),O(F([kT(zR(r)),kT(GR(n))]),a),RT(mr))])))}),WR=r(function(e,t){if("None"===t.$)return Rk;var r=t.a;return f(YR,e,r)}),JR=bA,QR=function(e){var t=function(){var t=f(Th,e.fiatType,VR);if("Nothing"===t.$)return f(Bk,F([IA(oN)]),Qp("!"));var r=t.a,n=(r.a,r.b);return f(WR,F([TT(xk(26))]),n)}();return f(NN,F([hN(4)]),F([t,f(Bk,F([IA(d(JR,0,0,0,.5)),jN,BT(xk(50))]),Qp(e.fiatType)),Qp(qR(e))]))},XR=function(e){return QR(e)},ZR=function(e){return f(Bk,F([BT(Nk),TT(Nk),FN]),f(vN,F([aN(12)]),F([Qp(e.info)])))},e$=function(e){return f(rc,Rk,f(Gf,ZR,el(e)))},t$=MR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),r$=function(e){return f(WR,f(za,TT(xk(26)),e),t$)},n$=function(e){var t=Bl(qf(e)),r=f(tl,".",t);if(!r.b)return t;if(r.b.b){Rl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Eo,3,t);case 1:return f(Eo,4,f(rc,t,f(Gf,ww,f(Gf,function(e){return e/100},f(Gf,ii,f(Gf,Bg,f(Gf,bi(100),$l(t))))))));default:var n=r.a;return f(rc,f(Eo,n,t),f(Gf,Gi,f(Gf,Bg,$l(t))))}},a$=function(e){var t=n$(e);return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(16)]),Qp(t))]))},i$=function(e){return a$(e)},o$=function(e){return{$:"TradeClicked",a:e}},u$=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),BT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,IA(l(Tk,16,7,234)),jN]),Qp("View Offer")),onPress:ba(o$(e))})},s$=i(function(e,t,r,n,a){return f(NN,F([BT(Nk),hN(1)]),F([function(){switch(n.$){case"Open":return HN(L(2,d(OR,e,a,!1,t)));case"Committed":return HN(L(2,d(OR,e,a,$(r,ny),t)));case"Judgment":return HN(L(2,d(OR,e,a,$(r,Ff),t)));default:return Rk}}(),HN(L(1,i$(a.parameters.tradeAmount))),HN(L(2,XR(a.terms.price))),HN(L(6,e$(a.terms.paymentMethods))),HN(L(2,u$(a.id)))]))}),c$=iw(28),f$=function(e){return f(TA,c$,l(EA,"bc-"+wA(e),"border-color",e))},l$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),d$=function(e){return f(TA,lA,h(l$,"b-"+Gi(e),e,e,e,e))},h$=n(function(e,t,r){var n=function(){switch(r.viewPhase.$){case"Open":return"Expires in";case"Committed":return"Payment Due";case"Judgment":return"Auto-Release";default:return""}}(),a=function(){return"Buyer"===r.agentRole.$?"Buying":"Selling"}();return f(AN,F([BT(Nk),TT(Nk),f(Hk,30,10),hN(5)]),F([f(NN,F([BT(Nk)]),F([$(r.viewPhase,nC)?Rk:HN(L(2,qN(n))),HN(L(1,qN(a))),HN(L(2,qN("For Fiat"))),HN(L(6,qN("Payment Methods"))),HN(L(2,Rk))])),f(AN,F([BT(Nk),d$(1),Yk(8),f$(AR),hN(1),Lk(AR),FN]),f(nu,d(s$,e,!$(r.userInfo,Ca),r.agentRole,r.viewPhase),t))]))}),p$=n(function(e,t,r){return $(f(SS,e,r),ba(t))}),g$=l(Tk,150,150,150),v$=function(e){return f(th,function(e){return Cb(e.parameters)},zE(e))},y$=n(function(e,t,r){var n=l(PN,$N(r),_N(),v$(t)),a=f(th,function(e){return l(p$,e,r.agentRole,r.agentAddress)&&$(e.state.phase,r.viewPhase)},n),i=function(e){return f(Bk,F([aN(24),tN,IA(g$),cN,KN(20)]),Qp(e))},o=L(t.dataFetchStatus.total,a);if("Nothing"===o.a.$){o.a;return i("Querying Factory contract...")}if(o.a.a){if(o.b.b){var u=o.a.a;return l(h$,e,a,r)}var u=o.a.a;return i(_(t.dataFetchStatus.loaded,u-t.dataFetchStatus.invalid)<0?"Searching for user trades...":"No matching trades found.")}return i("No trades found.")}),m$=r(function(e,t){return f(Bk,F([Yk(4),Lk(d(JR,0,0,1,.1)),IA(l(Tk,16,7,234)),aN(e),tN,f(Hk,15,13)]),Qp(eh(t)))}),b$=a(function(e,t,r,n){return"pad-"+Gi(e)+"-"+Gi(t)+"-"+Gi(r)+"-"+Gi(n)}),C$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(TA,Vk,h(Kk,"p-"+Gi(t),t,t,t,t)):f(TA,Vk,h(Kk,d(b$,t,r,n,a),t,r,n,a))},S$=function(e){return function(){var t=e.userInfo;return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(Bk,F([f(Hk,30,10),aN(24),tN]),Qp("Your Trades")):f(NN,F([hN(10),C$({bottom:30,left:30,right:30,top:10})]),F([f(Bk,F([aN(24),tN]),Qp("Trade History for User")),f(m$,18,e.agentAddress)]))},E$=function(e){return{$:"ViewPhaseChanged",a:e}},T$=l(CA,0,0,1),w$=function(e){var t=F([aN(20),yN,Gk]),r=function(e){return e?O(t,F([IA(T$)])):t};return f(NN,F([hN(30)]),F([f(Bk,O(F([Zk(E$(io))]),r($(e,io))),Qp("Open")),f(Bk,O(F([Zk(E$(aC))]),r($(e,aC))),Qp("Payment Due")),f(Bk,O(F([Zk(E$(iC))]),r($(e,iC))),Qp("Release Due")),f(Bk,O(F([Zk(E$(nC))]),r($(e,nC))),Qp("Closed"))]))},I$=function(e){return f(Bk,F([f(Hk,30,10)]),w$(e.viewPhase))},A$=function(e){return{$:"ViewUserRoleChanged",a:e}},B$=d(iR,1,31,52,.13),k$=function(e){var t=F([aN(24),tN,Gk]),r=function(){return"Buyer"===e.$?L(t,O(t,F([IA(B$)]))):L(O(t,F([IA(B$)])),t)}(),n=r.a,a=r.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(A$(Ff))]),a),Qp("As the Seller")),f(Bk,O(F([Zk(A$(ny))]),n),Qp("As the Buyer"))]))},N$=function(e){return f(Bk,F([f(Hk,30,10)]),k$(e.agentRole))},R$=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),BT(Nk),TT(Nk),f(Hk,0,20)]),F([S$(r),N$(r),I$(r),l(y$,e,t,r)]))}),$$=function(e){return{$:"ShowCurrencyDropdown",a:e}},x$={$:"AbortCreate"},_$=r(function(e,t){return{$:"ConfirmCreate",a:e,b:t}}),L$=function(e){return f(nu,function(e){return F([f(Bk,F([IA(oN)]),Qp("Caution! ")),Qp(e)])},XC(F([$(f(Hg,e.autoreleaseInterval,Kf(12e5)),Oa)?ba(function(){return"Buyer"===e.initiatorRole.$?"That Release Window time is quite small! It might take a while to find a committed Seller.":"That Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing."}()):Ca,$(f(Hg,e.autoabortInterval,Kf(36e5)),Oa)?ba(function(){return"Buyer"===e.initiatorRole.$?'That Payment Window time is quite small! If you fail to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.':'That Payment Window time is quite small! If the Buyer fails to to 1. make the payment and 2. click "confirm" before this time is up, the trade will automatically abort, incurring the abort punishments on both parties.'}()):Ca])))},P$=function(e){return f(Bk,F([C$({bottom:5,left:5,right:5,top:0}),Zk(e),Yk(30),Lk(d(JR,1,1,1,.4)),d$(1),f$(d(JR,0,0,0,.3)),Gk,aN(14)]),f(Bk,F([IA(d(JR,0,0,0,.7))]),Qp("x")))},D$=Hn,U$=D$,O$=kT,M$=r(function(e,t){return f(Bk,F([kR(f(Bk,F([Lk(e),O$(f(U$,"position","fixed")),O$(f(U$,"z-index","1000")),O$(f(U$,"top","0")),O$(f(U$,"left","0")),O$(f(U$,"width","100%")),O$(f(U$,"height","100%"))]),Rk)),BT(Nk),TT(Nk)]),t)}),F$={$:"Top"},V$=DN(F$),K$={$:"InFront"},H$=function(e){return f(QN,K$,e)},j$=r(function(e,t){return{$:"Max",a:e,b:t}}),q$=r(function(e,t){return f(j$,e,t)}),G$=n(function(e,t,r){return l(ma,M$,d(JR,0,0,.3,.6),f(Bk,O(F([cN,ON,BT(f(q$,500,IT)),Lk(Fk),Yk(8),H$(f(Bk,F([TN,V$]),P$(r)))]),e),t))}),z$=r(function(e,t){if("Nothing"===t.$)return Rk;var r=t.a;return f(Bk,O(F([Yk(5),f$(l(CA,.9,0,0)),d$(1),Lk(l(CA,1,.4,.4)),KN(5),cN,ON,BT(f(q$,200,IT)),aN(14)]),e),f(vN,mr,F([Qp(r)])))}),Y$={$:"Above"},W$=function(e){return f(QN,Y$,e)},J$=iw(26),Q$=function(e){return{$:"MoveY",a:e}},X$=function(e){return f(ZN,J$,Q$(-e))},Z$=r(function(e,t){return f(Bk,F([Yk(4),f(Hk,25,17),aN(18),tN,Lk(AR),W$(f(z$,F([X$(5)]),t))]),Qp(e))}),ex=d(iR,1,31,52,.64),tx=iw(32),rx={$:"Active"},nx=function(e){return f(TA,tx,f(WN,rx,nR(e)))},ax=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Bk,F([Yk(4),Gk,Zk(n),f(Hk,25,17),IA(t),aN(18),tN,Lk(a),nx(F([Lk(o)])),aR(F([Lk(i)]))]),Qp(r))}),ix=r(function(e,t){return d(ax,P(d(JR,1,0,0,1),d(JR,1,0,0,.8),d(JR,1,0,0,.6)),Fk,e,t)}),ox=iw(12),ux=f(qk,ox,DT.textCenter),sx=function(e){return M$(d(JR,0,0,.3,.6))(f(AN,F([hN(10),cN,ON,Lk(d(JR,0,0,0,.5)),Yk(8),KN(20)]),f(nu,function(e){return f(vN,F([cN,ON,aN(20),tN,IA(Fk),ux]),F([e]))},e)))},cx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+LA(t)}e.a;return"https://kovan.etherscan.io/tx/"+LA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+LA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+LA(t);case"XDai":e.a;return"https://blockscout.com/poa/dai/tx/"+LA(t);case"Rootstock":e.a;return"https://explorer.rsk.co/tx/"+LA(t);default:e.a;return""}}),fx={$:"Bottom"},lx=DN(fx),dx=yA(DT.underline),hx=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=Zf(t.web3Context.factoryType),a=function(){var e=t.depositAmount;if("Just"===e.$){var n=e.a;return L(Qp(n$(Vv(n))),f(ix,"Yes, I definitely want to open this trade.",f(_$,r,n)))}return L(Qp("??"),f(Z$,"(loading exact fees...)",Ca))}(),i=a.a,o=a.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,TT(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Qp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(nu,vN(F([cN,aN(18),jN,IA(ex)])),O(L$(r),O(F([F([Qp("You will deposit "),i,Qp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Qp("This ususally requires two Metamask signatures. Your "+n+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(Bk,F([lx,cN]),o)])),x$);case"ApproveNeedsSig":return sx(F([Qp("Waiting for user signature for the approve call."),Qp("(check Metamask!)"),Qp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var r=e.a,u=e.b;return sx(F([Qp("Mining the initial approve transaction..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Qp("Funds will not leave your wallet until you sign the next transaction.")]));case"CreateNeedsSig":return sx(F([Qp("Waiting for user signature for the create call."),Qp("(check Metamask!)")]));default:var u=e.a;return sx(F([Qp("Mining the final create call..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Qp("You will be redirected when it's mined.")]))}}),px=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;var r=t.a;return f(hx,r,e)},gx=function(e){return{$:"TradeAmountChanged",a:e}},vx=mT("id"),yx=O$(vx("inputError")),mx=l(Tk,109,127,138),bx=function(e){return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(24),jN,IA(mx)]),Qp(Zf(e)))]))},Cx={$:"Left"},Sx=uN(Cx),Ex=function(e){return{$:"HiddenLabel",a:e}},Tx=Ex,wx=mT("type"),Ix=function(e){return L(e,!0)},Ax=function(e){return{$:"MayStopPropagation",a:e}},Bx=r(function(e,t){return f(Jk,e,Ax(t))}),kx=r(function(e,t){return l(Xa,Fd,t,e)}),Nx=f(kx,F(["target","value"]),Lo),Rx=function(e){return f(Bx,"input",f(Bf,Ix,f(Bf,e,Nx)))},$x=iw(0),xx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),_x=function(e){var t=function(e){return 1-e}(f(qs,1,f(mi,0,e)));return f(TA,$x,f(xx,"transparency-"+mw(t),t))},Lx=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),Px=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(vA,IN,NT("label"),e,RT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(vA,xT,Ak,a,RT(F([i])));switch(n.$){case"Above":return d(vA,IN,NT("label"),e,RT(F([o,r])));case"Below":return d(vA,IN,NT("label"),e,RT(F([r,o])));case"OnRight":return d(vA,kN,NT("label"),e,RT(F([r,o])));default:return d(vA,kN,NT("label"),e,RT(F([o,r])))}}),Dx=FI,Ux=f(Af,kT,Dx("autocomplete")),Ox=l(CA,136/255,138/255,133/255),Mx=l(CA,186/255,189/255,182/255),Fx=f(Hk,12,12),Vx=l(CA,1,1,1),Kx=F([Fx,Yk(3),f$(Mx),Lk(Vx),d$(1),hN(3),BT(Nk)]),Hx=function(e){return{$:"Label",a:e}},jx=function(e){if("HiddenLabel"===e.$){var t=e.a;return pN(Hx(t))}return XN},qx=function(e){e:for(;;){if("StyleClass"!==e.$)break e;switch(e.b.$){case"PaddingStyle":e.b;return!0;case"BorderWidth":e.b;return!0;case"Transform":return!0;default:break e}}return!1},Gx=function(e){return"HiddenLabel"===e.$},zx=uR("spellcheck"),Yx=f(Af,kT,zx),Wx=J,Jx=iw(47),Qx=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Fi(Wx(e))),o=(i-1)*t+f(rc,0,f(Gf,a,r))+f(rc,0,f(Gf,a,n));return f(TA,Jx,l(JI,"textarea-height-"+Gi(i),"height",function(e){return"calc("+Gi(e)+"em + "+Gi(o)+"px) !important"}(i)))}),Xx=mT("value"),Zx=f(Af,kT,Xx),e_={$:"LivePolite"},t_=pN(e_),r_=function(e){return l(Xa,r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"NoAttribute":return L(r,n);case"Class":e.a;return L(f(za,e,r),n);case"Attr":e.a;return L(f(za,e,r),n);case"StyleClass":e.b;return L(f(za,e,r),n);case"Width":e.a;return f(vw,"width",n)?L(r,n):L(f(za,e,r),f(NE,"width",n));case"Height":e.a;return f(vw,"height",n)?L(r,n):L(f(za,e,r),f(NE,"height",n));case"Describe":e.a;return f(vw,"described",n)?L(r,n):L(f(za,e,r),f(NE,"described",n));case"Nearby":e.a,e.b;return L(f(za,e,r),n);case"AlignX":return f(vw,"align-x",n)?L(r,n):L(f(za,e,r),f(NE,"align-x",n));case"AlignY":return f(vw,"align-y",n)?L(r,n):L(f(za,e,r),f(NE,"align-y",n));default:return f(vw,"transform",n)?L(r,n):L(f(za,e,r),f(NE,"transform",n))}}),L(mr,bm),e).a},n_=r(function(e,t){return l(Xa,r(function(e,r){return t(e)?f(za,e,r):r}),mr,r_(e))}),a_=function(e){e:for(;;)switch(e.$){case"Content":return!0;case"Max":case"Min":var t=e.b,r=t;e=r;continue e;default:return!1}},i_=f(Af,Lf,Fu),o_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([kT(Rx(n.onChange))]),o=O(Kx,t),u=f(n_,o,function(e){e:for(;;)switch(e.$){case"Width":case"Height":if("Fill"===e.a.$)return!0;break e;case"AlignX":case"AlignY":return!0;case"StyleClass":switch(e.b.$){case"SpacingStyle":e.b;return!0;case"FontSize":return!0;case"FontFamily":e.b;return!0;default:break e}default:break e}return!1}),s=f(th,qx,o),c=f(n_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(n_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(n_,o,function(e){return"Nearby"===e.$})),p=f(th,f(Af,Iu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([Zx(n.text),kT(wx(a)),Yx(e.spellchecked),yA(DT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return XN;var r=t.a;return Ux(r)}()]),p),mr)}var i=l(Xa,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes),heightContent:ba(a_(r))}):t;case"StyleClass":switch(e.b.$){case"BorderWidth":var a=e.b,i=a.b,o=a.c,u=a.d,s=a.e,c=t.maybeBorder;return"Nothing"===c.$?U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes),maybeBorder:ba(d(Lx,i,o,u,s))}):t;case"PaddingStyle":var l=e.b,i=l.b,o=l.c,u=l.d,s=l.e,h=t.maybePadding;return"Nothing"===h.$?U(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:ba(d(Lx,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes),maybeSpacing:ba(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(za,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:Ca,maybeBorder:Ca,maybePadding:Ca,maybeSpacing:Ca},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(rc,5,c);return P("textarea",O(F([Yx(e.spellchecked),yA(DT.inputMultiline),f(rc,XN,f(Gf,Ux,e.autofill)),function(){if("Nothing"===u.$)return XN;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return C$({bottom:f(mi,0,n-(v/2|0)),left:a,right:r,top:f(mi,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?XN:s.a?d(Qx,n.text,v,u,g):XN}()]),h),F([i_(DI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(vA,xT,Ak,f(za,BT(Nk),sy(F([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return mr;var t=e.a,r=t.a,a=t.b;return F([H$(f(Bk,f(za,Fx,O(s,O(F([IA(Ox),yA(DT.noTextSelection+" "+DT.passPointerEvents),f$(d(JR,0,0,0,0)),Lk(d(JR,0,0,0,0)),TT(Nk),BT(Nk),_x(""===n.text?1:0)]),r))),a))])}()]))),RT(F([d(vA,xT,NT(v),sy(F([F([lR(t),jx(n.label)]),y,i])),RT(m))])));return l(Px,f(za,f(qk,jk,DT.cursorText),f(za,Gx(n.label)?XN:hN(5),f(za,t_,u))),n.label,b)}),u_=o_({autofill:Ca,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),s_=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(u_,F([BT(Nk),TT(xk(40)),d$(0)]),{label:Tx(r),onChange:i,placeholder:n,text:a});return f(NN,O(F([hN(5)]),e),XC(F([f(Gf,Bk(F([Sx])),o),ba(s),f(Gf,Bk(F([TN])),u)])))}),c_={$:"Below"},f_=function(e){return f(QN,c_,e)},l_=function(e){return f(ZN,J$,Q$(e))},d_=n(function(e,t,r){return p(s_,F([BT(xk(150)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),r))]),L(Ca,ba(bx(e))),"dai input",Ca,t,gx)}),h_=r(function(e,t){return f(TA,lA,h(l$,"b-"+Gi(e)+"-"+Gi(t),t,e,t,e))}),p_=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?d$(r):f(h_,n,r):f(TA,lA,h(l$,"b-"+Gi(r)+"-"+Gi(a)+"-"+Gi(t)+"-"+Gi(n),r,a,t,n))},g_=Bk(F([f$(AR),p_({bottom:2,left:0,right:0,top:0})])),v_=r(function(e,t){return f(AN,F([hN(10)]),F([f(Bk,F([aN(17),tN]),Qp(e)),t]))}),y_=function(e){return g_(f(v_,function(){return"Buyer"===e.inputs.userRole.$?"You're buying":"You're selling"}(),l(d_,e.web3Context.factoryType,e.inputs.daiAmount,e.errors.daiAmount)))},m_=function(e){var t=function(){var t=bl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Yf,r,100))+" "+Zf(e.web3Context.factoryType)+"."}return"There is a 1% fee."}();return f(NN,F([cN,f(Hk,20,10),Lk(l(Tk,10,33,108)),Yk(8),hN(5)]),F([f(Bk,F([aN(18),IA(l(Tk,0,226,255)),tN]),Qp(t)),f(Bk,F([aN(17),IA(Fk),jN]),Qp("We only collect this fee when trades resolve successfully."))]))},b_=function(e){return{$:"FiatAmountChanged",a:e}},C_=function(e){return{$:"FiatTypeChanged",a:e}},S_=r(function(e,t){return l(IE,n(function(t,r,n){return f(e,t,r)?l(Nh,t,r,n):n}),Eh,t)}),E_=function(e){return f(S_,r(function(t,r){return f(vg,e,t)}),VR)},T_=MR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),w_=function(e){return f(WR,F([TT(xk(26))]),f(rc,T_,f(Gf,Ro,f(Th,e,VR))))},I_=function(e){return O$(f(Bx,"click",Po(L(e,!0))))},A_=i_,B_=function(e){return{$:"AppendProperty",a:e}},k_=r(function(e,t){return B_(e+":"+t)}),N_=r(function(e,t){return f(k_,e,t.value)}),R_=N_("cursor"),$_={$:"Compatible"},x_={cursor:$_,value:"default"},__=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),L_=function(e){return{$:"PseudoClassSelector",a:e}},P_=function(e){return __(L_(e))}("hover"),D_=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),U_=D_,O_=U_,M_=O_("span"),F_=r(function(e,t){return f(jn,at(e),ot(t))}),V_=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),K_=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),H_=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),j_=r(function(e,t){return t<>>32-e}),q_=function(e){var t=e.hash?e.seed^f(H_,461845907,f(j_,15,f(H_,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(H_,2246822507,r^r>>>16),a=f(H_,3266489909,n^n>>>13);return(a^a>>>16)>>>0},G_=r(function(e,t){return f(H_,5,f(j_,13,e^f(H_,461845907,f(j_,15,f(H_,3432918353,t)))))+3864292196}),z_=r(function(e,t){var r=t.hash|(255&Li(e))<";default:return""}},tP=function(e){switch(e.$){case"ClassSelector":var t=e.a;return"."+t;case"IdSelector":var t=e.a;return"#"+t;case"PseudoClassSelector":var t=e.a;return":"+t;default:var t=e.a;return"["+t+"]"}},rP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(zi,"",f(za,t,f(nu,tP,r)));case"UniversalSelectorSequence":var r=e.a;return Go(r)?"*":f(zi,"",f(nu,tP,r));default:var t=e.a,r=e.b;return f(zi,"",f(za,t,f(nu,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(zi," ",F([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(za,rP(t),f(nu,nP,r)),i=f(zi,"",F([f(rc,"",f(Gf,ZL,n))]));return f(ks,f(zi," ",f(th,f(Af,Iu,Dl),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(zi,", ",f(nu,aP,f(za,r,n)));return f(zi,"",F([i," {\n",e,XL(a),"\n",e,"}"]))}),oP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(iP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(zi,",\n",f(nu,GL,r))+" {\n"+f(zi,"\n\n",f(nu,f(Af,JL,iP(" ")),n))+"\n}";case"SupportsRule":case"DocumentRule":case"PageRule":case"FontFace":return"TODO";case"Keyframes":return"@keyframes "+e.a.name+" {\n"+e.a.declaration+"\n}";case"Viewport":case"CounterStyle":default:return"TODO"}},uP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(zi,"\n\n",f(th,f(Af,Iu,Dl),F([HL(t),f(zi,"\n",f(nu,YL,r)),f(zi,"\n",f(nu,WL,n)),f(zi,"\n\n",f(nu,oP,a))])))},sP=function(e){return uP(KL(ML(e)))},cP=function(e){return f(zi,"\n\n",f(nu,sP,e))},fP=function(e){return{$:"Snippet",a:e}},lP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),dP=function(e){return{$:"StyleBlockDeclaration",a:e}},hP=r(function(e,t){var r=l(dL,t,mr,Ca);return fP(F([dP(l(lP,r,mr,e))]))}),pP=function(e){return Go(e)?"unstyled":f(zu,D("_"),ns(f(Y_,15739,cP(xE(W_(xE(f(hP,e,wL(mr)))))))))},gP=function(e){var t=pP(e),r=f(F_,"className",Yd(t));return l(V_,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(za,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(Nw(e))},bP=mP,CP=r(function(e,t){return f(Mn,e,rt(t))}),SP=function(e){return Un(rt(e))},EP=r(function(e,t){var r=e.b,n=e.c;return Go(r)?t:l(Nh,n,r,t)}),TP=function(e){return e.a},wP=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;switch(n.$){case"Unstyled":var o=n.a;return L(f(za,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Wa,EP,i,s),p=l(Wa,IP,L(mr,h),c),g=p.a,v=p.b,o=l(rw,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Wa,EP,i,s),m=l(Wa,IP,L(mr,h),c),g=m.a,v=m.b,o=d(SP,y,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Wa,EP,i,s),b=l(Wa,wP,L(mr,h),c),g=b.a,v=b.b,o=l(tw,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Wa,EP,i,s),C=l(Wa,wP,L(mr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(nu,TP,s),Ja(g));return L(f(za,L(r,o),a),v)}}),IP=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(za,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Wa,EP,n,o),c=l(Wa,IP,L(mr,s),u),h=c.a,p=c.b,a=l(rw,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Wa,EP,n,o),v=l(Wa,IP,L(mr,s),u),h=v.a,p=v.b,a=d(SP,g,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Wa,EP,n,o),y=l(Wa,wP,L(mr,s),u),h=y.a,p=y.b,a=l(tw,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Wa,EP,n,o),m=l(Wa,wP,L(mr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(nu,TP,o),Ja(h));return L(f(za,a,r),p)}}),AP=r(function(e,t){return h(Ih,wh,e,t,Sh,Sh)}),BP=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Dl(a)){var o=e,u=i;e=o,t=u}else{var o=ba(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,Ca,e);if("Nothing"===t.$)return Eh;var r=t.a,n=r.a,a=r.b;return f(AP,n,a)},NP=function(e){return{$:"ClassSelector",a:e}},RP=function(e){var t=e.a,r=e.b;return f(hP,r,wL(F([NP(t)])))},$P=function(e){return cP(xE(W_(f(nu,RP,ja(e)))))},xP=function(e){return l(rw,"style",mr,xE(Nw($P(e))))},_P=n(function(e,t,r){var n=f(nu,TP,t),a=kP(t),i=l(Wa,IP,L(mr,a),r),o=i.a,u=i.b,s=xP(u);return l(rw,e,n,f(za,s,Ja(o)))}),LP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if($(e,n))return!0;var i=e,o=a;e=i,t=o}}),PP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(LP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),DP=r(function(e,t){return L(f(PP,"_",t),xP(e))}),UP=n(function(e,t,r){var n=f(nu,TP,t),a=kP(t),i=l(Wa,wP,L(mr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(tw,e,n,f(za,s,Ja(o)))}),OP=a(function(e,t,r,n){var a=f(nu,TP,r),i=kP(r),o=l(Wa,wP,L(mr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(za,c,Ja(u)))}),MP=a(function(e,t,r,n){var a=f(nu,TP,r),i=kP(r),o=l(Wa,IP,L(mr,i),n),u=o.a,s=o.b,c=xP(s);return d(SP,e,t,a,f(za,c,Ja(u)))}),FP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(_P,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(MP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(UP,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(OP,a,t,r,n)}},VP=FP,KP=function(e){return A_(VP(d(vP,M_,F([P_(F([R_(x_)]))]),mr,F([bP(e)]))))},HP=Q,jP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),qP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),GP=function(e){return l(Xa,r(function(e,t){var r=t.a,n=t.b;return L(function(){if("Just"===r.$){r.a;return r}if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){var t=e.b,n=t.a,a=t.b,i=t.c,o=t.d,u=t.e;return ba(h(jP,n,a,i,o,u))}return Ca}(),function(){if("Just"===n.$){var t=n.a;return n}if("StyleClass"===e.$&&"SpacingStyle"===e.b.$){var r=e.b,a=r.a,t=r.b,i=r.c;return ba(l(qP,a,t,i))}return Ca}())}),L(Ca,Ca),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY+" "+DT.wrapped),f(za,BT(IT),f(za,TT(IT),e))),RT(t));var i=a.a,o=i.a,u=i.b,s=i.c,c=function(){if("Just"===n.$){var e=n.a,t=(e.a,e.b),r=e.c,a=e.d,i=e.e;return _(r,u/2|0)>-1&&_(a,s/2|0)>-1?ba(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):Ca}return Ca}();if("Just"===c.$){var h=c.a;return d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY+" "+DT.wrapped),f(za,BT(IT),f(za,TT(IT),O(e,F([h]))))),RT(t))}var p=-s/2,g=-u/2;return d(vA,xT,Ak,e,RT(F([d(vA,kN,Ak,f(za,yA(DT.contentLeft+" "+DT.contentCenterY+" "+DT.wrapped),f(za,kT(f(U$,"margin",ww(p)+"px "+ww(g)+"px")),f(za,kT(f(U$,"width","calc(100% + "+Gi(u)+"px)")),f(za,kT(f(U$,"height","calc(100% + "+Gi(s)+"px)")),f(za,f(TA,fN,l(lN,o,u,s)),mr))))),RT(t))])))}),YP=a(function(e,t,r,n){var a=f(u_,F([BT(xk(80)),TT(xk(40)),aN(24),jN,f$(AR),I_(r)]),{label:Tx("currency type"),onChange:f(_a,HP,n),placeholder:Ca,text:t}),i=f(Th,t,VR),o=function(){var r=L(e,i);if(r.a){if("Just"===r.b.$)return Rk;r.b;return f(zP,F([BT(xk(350)),f$(IR),d$(1),Lk(Fk),KN(10),cN]),f(nu,function(e){var t=e.a,r=e.b,a=r.b;return f(NN,F([BT(xk(80)),hN(9),f(Hk,0,5),I_(n(t)),aR(F([Lk(l(CA,.8,.8,1))]))]),F([f(WR,F([TT(xk(26))]),a),f(Bk,F([aN(16),tN]),KP(t))]))},ja(E_(t))))}return Rk}();return f(NN,F([hN(4),f_(o)]),F([w_(t),a]))}),WP=i(function(e,t,r,n,a){var i=Qp(KR(e)),o=f(Bk,F([f_(f(z$,F([yx,l_(5)]),a))]),d(YP,r,e,$$(!0),C_));return p(s_,F([BT(xk(250)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),n))]),L(ba(i),ba(o)),"fiat input",Ca,t,b_)}),JP=function(e){return g_(f(v_,"For fiat",h(WP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},QP=function(e){return{$:"ChangeRole",a:e}},XP=r(function(e,t){var r=F([aN(24),jN,Gk]),n=function(){return"Buyer"===t.$?L(r,O(r,F([IA(B$)]))):L(O(r,F([IA(B$)])),r)}(),a=n.a,i=n.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(QP(Ff))]),i),Qp("Sell "+Zf(e))),f(Bk,O(F([Zk(QP(ny))]),a),Qp("Buy "+Zf(e)))]))}),ZP=function(e){return f(v_,"Trade Type",f(XP,e.web3Context.factoryType,e.inputs.userRole))},eD=iw(19),tD=function(e){return Tl(F([e.inset?"box-inset":"box-",ww(e.offset.a)+"px",ww(e.offset.b)+"px",ww(e.blur)+"px",ww(e.size)+"px",wA(e.color)]))},rD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(TA,eD,l(JI,tD(t),"box-shadow",Aw(t)))},nD=rD({blur:20,color:d(iR,0,0,0,.04),offset:L(0,3),size:0}),aD=f(qk,fN,DT.spaceEvenly),iD=function(e){return f(AN,F([BT(Nk),hN(20),Lk(Fk),Yk(5),KN(20),nD]),F([f(NN,F([BT(Nk),aD]),F([ZP(e),y_(e),JP(e)])),m_(e)]))},oD=function(e){return{$:"CreateClicked",a:e}},uD={$:"Web3Connect"},sD=function(e){return f(Bk,F([cN]),function(){if("Just"===e.$){var t=e.a;return f(ix,"Open Trade",oD(t))}return f(ix,"Connect to Wallet",uD)}())},cD=function(e){return{$:"AutoabortIntervalChanged",a:e}},fD=function(e){return{$:"ChangePaymentMethodText",a:e}},lD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),dD=lD,hD=function(e){return f(dD,mr,function(){return Qp("Seller"===e.$?"Some examples:\n\nI can accept transfers to a Schwab bank account (routing 121202211)\nI can meet in person to accept cash in London, weekdays after 6, with a day of notice.\nHide the cash in Hume Park, Bulawayo, and tell me the location over chat.":"Some examples:\n\nI can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice.\nTransferWise\nInterac e-Transfer\n")}())},pD={$:"TextArea"},gD=r(function(e,t){return l(o_,{autofill:Ca,spellchecked:t.spellcheck,type_:pD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),vD=n(function(e,t,r){var n=f(Bk,F([aN(22),tN]),Qp("Payment Method")),a=f(gD,F([BT(Nk),TT(xk(150)),Lk(d(JR,1,1,1,.5))]),{label:Tx("payment method"),onChange:fD,placeholder:""===r?ba(hD(t)):Ca,spellcheck:!0,text:r});return f(AN,F([hN(10),BT(Nk),W$(f(z$,F([yx,l_(30),KN(10),aN(20),BT(xk(400))]),e))]),F([n,a]))}),yD=function(e){return"Buyer"===e.$?"After committing, you and the Seller have this long to complete the fiat payment, using one of your payment methods indicated below. If you fail to confirm payment within this window, 1/4 of your deposit is burned from both parties and the rest is refunded.":"After committing, you and the Buyer have this long complete the fiat payment, using one of your payment methods indicated below. If the Buyer aborts or fails to confirm within this window, 1/12 of the trade amount is burned from both parties and the rest is refunded."},mD=a(function(e,t,r,n){var a=l(Xu,e,D("0"),Gi(n));return f(Bk,F([aN(22),IA(t)]),Qp(O(a,r)))}),bD=function(e){return Yl(e)<0?Kf(0):e},CD=MR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),SD=MR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),ED=n(function(e,t,n){var a=r(function(e,r){return f(AN,F([hN(4)]),F([f(Bk,F([KN(4),Gk,Zk(n(f(wb,t,e)))]),f(WR,F([TT(xk(10))]),SD)),r,f(Bk,F([KN(4),Gk,Zk(n(function(e){return Yl(e)?e:Kf(3e5)}(bD(f(ER,t,e)))))]),f(WR,F([TT(xk(10))]),CD))]))}),i=_R(t);return f(NN,F([aD,hN(10)]),F([f(a,Kf(864e5),d(mD,3,e," days",i.days)),f(a,Kf(36e5),d(mD,2,e," hours",i.hours)),f(a,Kf(3e5),d(mD,2,e," min",i.min))]))}),TD=o(function(e,t,r,n,a,i){var o=f(AN,F([hN(6)]),F([f(Bk,F([aN(22),tN]),Qp(t)),f(Bk,F([Lk(d(JR,1,1,1,.5)),Yk(5),KN(5),rD({blur:4,color:d(JR,0,0,0,.15),offset:L(-3,3),size:0}),W$(f(z$,F([yx]),a))]),l(ED,IR,n,i))])),u=f(Bk,F([BT(xk(80))]),f(WR,F([cN]),e)),s=f(vN,F([aN(17),jN,IA(ex)]),F([Qp(r)]));return f(NN,F([BT(Nk),hN(15),Yk(10)]),F([u,o,s]))}),wD=d(JR,0,0,1,.2),ID=MR({description:"",src:"/DAIHard/static/img/payment-window-icon.svg"}),AD=i(function(e,t,r,n,a){return f(AN,F([KN(8),hN(15),Yk(8),Lk(wD),rD({blur:5,color:d(JR,0,0,0,.3),offset:L(-3,3),size:0})]),F([p(TD,ID,"Payment Window",yD(a),r,n,cD),l(vD,t,a,e)]))}),BD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},kD=function(e){return"Buyer"===e.$?"Once you confirm payment, the Seller has this time window to decide whether to release the funds to you or burn everything. If he doesn't decide before the time is up, funds are released to you by default.":"Once the Buyer confirms payment, you have this long to decide whether to release the funds to the Buyer or, in the case of an attempted scam, burn everything. If you don't decide before the time is up, funds are released to the Buyer by default."},ND=MR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),RD=n(function(e,t,r){return f(Bk,F([KN(8),Yk(8),Lk(wD),rD({blur:5,color:d(JR,0,0,0,.3),offset:L(-3,3),size:0})]),p(TD,ND,"Judgment Window",kD(r),e,t,BD))}),$D=function(e){return{$:"AutorecallIntervalChanged",a:e}},xD=function(e){var t=function(){return"Buyer"===e.$?"Seller":"Buyer"}();return"The offer will expire by this time window if a "+t+" does not commit to the trade, returning the balance and the 1% fee to your wallet. This can also be manually triggered anytime before a "+t+" commits."},_D=MR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),LD=n(function(e,t,r){return f(Bk,F([KN(8),Yk(8),Lk(wD),rD({blur:5,color:d(JR,0,0,0,.3),offset:L(-3,3),size:0})]),p(TD,_D,"Open Window",xD(r),e,t,$D))}),PD=function(e){return f(AN,F([BT(Nk),f(Hk,10,0),hN(20)]),F([l(LD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(AD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(RD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},DD=function(e){return f(AN,F([BT(f(q$,1e3,Nk)),cN,hN(20),C$({bottom:30,left:40,right:40,top:0}),Zk($$(!1)),H$(px(e))]),F([iD(e),PD(e),sD(e.userInfo)]))},UD=Yu(Hm(8226)),OD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(za,e,f(za,t,r))}),o=l(Xa,i,mr,a);return f(za,n,o)}return mr}),MD=r(function(e,t){return l(Wa,za,t,e)}),FD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(MD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),VD=r(function(e,t){var r=Fi(t);return!r||$(r,e)?t:_(r,e)<0?Ja(f(MD,f(_s,e%r,t),l(FD,mr,e/r|0,t))):f(_s,e,t)}),KD=a(function(e,t,r,n){for(;;){if(!r.b)return Ja(n);var a=r.a,i=r.b,o=e(a);if(f(vw,o,t)){var u=e,s=t,c=i,l=n;e=u,t=s,r=c,n=l}else{var u=e,s=f(NE,o,t),c=i,l=f(za,a,n);e=u,t=s,r=c,n=l}}}),HD=function(e){return d(KD,no,bm,e,mr)},jD=r(function(e,t){return f(Bk,F([BT(Nk),H$(f(NN,F([hN(3),BT(VN(100)),BT(t),FN]),f(OD,f(Bk,F([IA(d(JR,0,0,0,.1)),aN(14)]),Qp(UD)),f(nu,f(Af,Bk(F([IA(d(JR,0,0,0,.2))])),Qp),f(VD,100,(e?Ja:no)(HD(f(nu,f(_a,Ro,gi),ja(VR)))))))))]),Qp(" "))}),qD=function(e){return f(AN,F([BT(Nk),TT(Nk),Lk(Fk),Yk(6),rD({blur:20,color:d(iR,0,0,0,.1),offset:L(0,3),size:0}),Yk(10),aD,KN(20)]),F([f(jD,!1,Nk),f(AN,F([cN,hN(15),BT(f(q$,700,Nk))]),f(nu,vN(F([BT(Nk),aN(17),jN,IA(ex),ux])),F([F([f(Bk,F([aN(22),IA(IR)]),Qp("Hold on a second!"))]),F([Qp("This version of DAIHard is live and functional, but a Factory upgrade is coming soon.")]),F([Qp("When that upgrade hits, all current trades will be hidden in the new interface. So feel free to play around here if you want, but don't use the tool seriously in its current state.")]),F([Qp("If you'd like to keep up to date with our upgrades and progress, join our "),f(mA,F([IA(T$),dx]),{label:Qp("Telegram group"),url:"https://t.me/daihardexchange_group"}),Qp(".")])]))),f(Bk,F([cN,Zk(hT(Ef({category:"landing-page",event:"lets-go-clicked",label:'"Let\'s Go" clicked',value:0})))]),f(ix,"Okay, got it. let's go!",e)),f(jD,!0,Nk)]))},GD=function(e){return{$:"ShowCurrencyDropdown",a:e}},zD=n(function(e,t,r){return f(_a,th(t(e)),LN(r))}),YD={$:"AutoabortWindow"},WD={$:"AutoreleaseWindow"},JD={$:"Expiring"},QD={$:"Fiat"},XD={$:"Margin"},ZD={$:"TradeAmount"},eU=function(e){var t=e.a,r=e.b;return f(Bk,F([BT(VN(t)),TT(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,BT(Nk)]),r))},tU={$:"Descending"},rU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),nU=function(e){return f(Bk,F([jN,aN(17)]),Qp(e))},aU=n(function(e,t,r){return f(NN,F([hN(8)]),F([nU(e),f(AN,F([hN(2)]),F([f(Bk,F([KN(4),Gk,Zk(f(rU,t,cv))]),f(WR,F([BT(xk(8)),cN,ON]),SD)),f(Bk,F([KN(4),Gk,Zk(f(rU,t,tU))]),f(WR,F([BT(xk(8)),cN,ON]),CD))]))]))}),iU=r(function(e,t){var r=function(){return"Buyer"===e.$?oN:RR}(),n=_(Yl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoabortInterval)}),oU=r(function(e,t){var r=function(){return"Buyer"===e.$?RR:oN}(),n=_(Yl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoreleaseInterval)}),uU=r(function(e,t){var r=f(TR,e,t);if("TimeLeft"===r.$){var n=r.a,a=f(DR,n.a,n.b)<.05?oN:IR;return d(UR,F([BT(Nk)]),F([aN(16)]),L(a,AR),n)}var i=r.a;return d(UR,F([BT(Nk)]),F([aN(16)]),L(oN,AR),L(Kf(0),i))}),sU=function(e){return QR(e.terms.price)},cU=function(e){var t=du(100*e),r=t-yi(t),n=Gi(yi(t)),a=f(mi,0,3-yo(n));return n+(function(){if(a){return f(Eo,a+1,f(bo,1,ww(r)))}return""}()+"%")},fU=r(function(e,t){return MR({description:"",src:function(){var r=L(e,t);if(r.a){if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-up-green.svg":"/DAIHard/static/img/margin-up-red.svg";r.b;return"/DAIHard/static/img/margin-up.svg"}if("Just"===r.b.$)return r.b.a?"/DAIHard/static/img/margin-down-green.svg":"/DAIHard/static/img/margin-down-red.svg";r.b;return"/DAIHard/static/img/margin-down.svg"}()})}),lU=n(function(e,t,r){return f(WR,f(za,TT(xk(34)),e),f(fU,t,r))}),dU=r(function(e,t){var r=cU(t);if("0%"===r)return f(Bk,F([aN(16)]),Qp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?RR:oN;return f(NN,F([hN(4)]),F([l(lU,mr,a,ba(i)),f(Bk,F([IA(o),aN(16)]),Qp(n))]))}),hU=r(function(e,t){return f(rc,Rk,f(Gf,dU(t),e.derived.margin))}),pU=function(e){return f(rc,Rk,f(Gf,ZR,el(e)))},gU=function(e){return a$(e.parameters.tradeAmount)},vU=function(e){return{$:"TradeClicked",a:e}},yU=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),BT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,IA(l(Tk,16,7,234)),jN]),Qp("View Offer")),onPress:ba(vU(e))})},mU=n(function(e,t,r){return f(NN,F([BT(Nk),hN(1),Lk(AR)]),F([f(AN,F([BT(Nk),hN(1),BT(VN(7))]),F([f(NN,F([BT(VN(6)),hN(1)]),f(nu,eU,F([L(2,f(uU,e,r)),L(1,gU(r)),L(2,sU(r)),L(1,f(hU,r,!$(t,ny))),L(2,f(iU,t,r)),L(2,f(oU,t,r))]))),eU(L(1,pU(r.terms.paymentMethods)))])),f(Bk,F([BT(VN(1)),TT(Nk),FN,Lk(Fk)]),f(Bk,F([cN,ON]),yU(r.id)))]))}),bU=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(AN,F([BT(Nk),TT(Nk),KN(30),hN(5)]),F([f(NN,F([BT(Nk)]),F([f(NN,F([BT(VN(7))]),F([eU(L(2,l(aU,"Expires",JD,Ca))),eU(L(1,l(aU,n,ZD,Ca))),eU(L(2,l(aU,"For Fiat",QD,Ca))),eU(L(1,l(aU,"Margin",XD,Ca))),eU(L(2,l(aU,"Payment Window",YD,Ca))),eU(L(2,l(aU,"Auto-Release",WD,Ca)))])),f(Bk,F([BT(VN(1))]),Rk)])),f(AN,F([BT(Nk),d$(2),Yk(8),f$(g$),hN(1),Lk(g$),FN]),f(nu,f(mU,e,r.browsingRole),t))]))}),CU=n(function(e,t,r){var n=d(zD,e,r.filterFunc,r.sortFunc,v$(t)),a=function(e){return f(Bk,F([aN(24),tN,IA(g$),cN,KN(20)]),Qp(e))},i=L(t.dataFetchStatus.total,n);if("Nothing"===i.a.$){i.a;return a("Querying Factory contract...")}if(i.a.a){if(i.b.b){var o=i.a.a;return l(bU,e,n,r)}var o=i.a.a;return a(_(t.dataFetchStatus.loaded,o-t.dataFetchStatus.invalid)<0?"Searching trades for Open offers...":"No open offers found.")}return a("No trades found.")}),SU={$:"ApplyInputs"},EU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([IA(Fk),cN,ON]),Qp("Apply")),onPress:ba(SU)}),TU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(TA,zk,l(JI,"br-"+Gi(t)+"-"+Gi(r)+Gi(n)+"-"+Gi(a),"border-radius",Gi(t)+"px "+Gi(r)+"px "+Gi(a)+"px "+Gi(n)+"px"))},wU=function(e){return f(Qk,"focus",Po(e))},IU=f(Af,kT,wU),AU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([IU(e(!0)),I_(e(!0))])}();return f(NN,O(e,F([TT(xk(40)),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Bk,F([Lk(AR),TT(xk(40)),TU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Bk,F([ON,f(Hk,10,0)]),r)),f(u_,O(s,O(t,F([BT(xk(100)),TT(xk(40)),f$(AR),TU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),p_({bottom:1,left:0,right:1,top:1})]))),{label:Tx(n),onChange:u,placeholder:i,text:a})]))}),BU=function(e){return{$:"MaxDaiChanged",a:e}},kU=function(e){return{$:"MinDaiChanged",a:e}},NU=r(function(e,t){return f(AN,F([BT(Nk),hN(8)]),F([f(Bk,F([aN(17),jN]),Qp(e)),t]))}),RU=iw(25),$U=function(e){return{$:"MoveX",a:e}},xU=function(e){return f(ZN,RU,$U(-e))},_U={$:"OnLeft"},LU=function(e){return f(QN,_U,e)},PU=a(function(e,t,r,n){var a=r$(F([ON])),i=f(NN,F([hN(8),ON,BT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Qp("max"))])),o=f(NN,F([hN(8),ON,BT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Qp("min"))]));return f(NU,Zf(e)+" Range",f(AN,F([hN(5),BT(xk(200))]),F([v(AU,F([LU(f(z$,F([xU(5),BT(xk(200))]),n.minDai))]),F([IU(GD(!1))]),o,"min "+Zf(e),t,Ca,Ca,kU),v(AU,F([LU(f(z$,F([xU(5),BT(xk(200))]),n.maxDai))]),F([IU(GD(!1))]),i,"max "+Zf(e),r,Ca,Ca,BU)])))}),DU=function(e){var t=f(Th,e,VR);if("Nothing"===t.$)return Qp("*");var r=t.a,n=r.b;return f(WR,F([TT(xk(26))]),n)},UU=function(e){return{$:"FiatTypeInputChanged",a:e}},OU=function(e){return{$:"MaxFiatChanged",a:e}},MU=function(e){return{$:"MinFiatChanged",a:e}},FU=i(function(e,t,r,n,a){var i=DU(t),o=f(NN,F([hN(8),ON,BT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Qp("max"))])),u=f(NN,F([hN(8),ON,BT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Qp("min"))]));return f(NU,"Fiat Type",f(NN,F([hN(5),BT(IT)]),F([f(Bk,F([V$,BT(xk(120))]),d(YP,e,t,GD(!0),UU)),f(AN,F([hN(5),V$,BT(xk(200))]),F([v(AU,F([W$(f(z$,F([X$(5),BT(f(q$,200,IT))]),a.minFiat))]),F([IU(GD(!1))]),u,"min",r,Ca,Ca,MU),v(AU,F([f_(f(z$,F([l_(5),BT(f(q$,200,IT))]),a.maxFiat))]),F([IU(GD(!1))]),o,"max",n,Ca,Ca,OU)]))])))}),VU={$:"AddSearchTerm"},KU=function(e){return{$:"PaymentMethodInputChanged",a:e}},HU=f(Fd,"keyCode",eS),jU=function(e){return f(Qk,"keyup",f(xo,function(t){return 13===t?Po(e):_o(Gi(t))},HU))},qU=function(e){return f(NU,"Search Payment Methods",f(u_,F([V$,BT(xk(250)),TT(xk(40)),f$(AR),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0}),O$(jU(VU))]),{label:Tx("payment methods search"),onChange:KU,placeholder:Ca,text:e}))},GU={$:"ResetSearch"},zU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([IA(Fk),cN,ON]),Qp("Reset")),onPress:ba(GU)}),YU=function(e){return{$:"RemoveTerm",a:e}},WU=function(e){return f(Bk,F([KN(3),V$,Gk,Zk(YU(e)),aN(10),IA(oN)]),Qp("x"))},JU=function(e){if(e.b){var t=e;return f(NN,F([BT(Nk),KN(10),hN(10)]),f(nu,function(e){return f(NN,F([Lk(d(iR,16,7,234,.2)),Yk(5),KN(4),hN(3)]),F([Qp(e),WU(e)]))},t))}return Rk},QU=a(function(e,t,r,n){return f(AN,F([hN(10),BT(IT),cN]),F([f(NN,F([BT(IT),hN(10)]),F([f(Bk,F([BT(IT),V$]),d(PU,e,t.minDai,t.maxDai,r)),f(Bk,F([BT(IT),V$]),h(FU,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(AN,F([BT(IT),V$,hN(5)]),F([qU(t.paymentMethod),JU(t.paymentMethodTerms)])),f(NU," ",f(AN,F([hN(5),BT(IT)]),F([EU,zU])))]))]))}),XU=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),BT(Nk),TT(Nk),Zk(GD(!1))]),F([f(NN,F([BT(Nk),hN(10),KN(30)]),F([d(QU,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(CU,e,t,r)]))}),ZU=f(_a,hu,Nm("USD")),eO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),tO=function(e){return Vv(f(xu,f(yl,hu(10),hu(18)),hu(e)))},rO=F([d(eO,Ff,tO(5),ZU(4),P(Kf(1728e5),Kf(1728e5),Kf(2592e5))),d(eO,ny,tO(2),ZU(7),P(Kf(1728e5),Kf(1728e5),Kf(2592e5)))]),nO=function(e){return f(Yf,Ov(e),3)},aO=PR,iO=r(function(e,t){return n$(t)+" "+Zf(e)}),oO=r(function(e,t){return f(Bk,F([IA(aO),aN(20)]),Qp(f(iO,e,t)))}),uO=RR,sO=function(e){return"$"+Il(e.amount)+" USD"},cO=function(e){return f(Bk,F([IA(uO),aN(20)]),Qp(sO(e)))},fO=function(e){return $(e,Kf(6048e5))?Qp("1 week"):b("QuickCreate.View",{start:{line:132,column:9},end:{line:132,column:19}})("lol bet u forgot about dis. summarizeIntervalElement is a hack! A dirty hack!!")},lO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(oO,e,f(dd,Ov(t),nO(t))):cO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(AN,F([hN(5)]),F([f(oO,e,t.daiAmountIn),cO(t.fiatValue)])):f(oO,e,t.daiAmountIn)}(),a=fO(function(e){var t=e.a,r=e.b,n=e.c;return f(wb,n,f(wb,r,t))}(t.intervals)),i=Qp("---\x3e");return f(AN,F([hN(8)]),F([f(NN,F([hN(4)]),F([n,i,r])),a]))}),dO=r(function(e,t){return d(ax,P(d(JR,0,0,1,1),d(JR,0,0,1,.8),d(JR,0,0,1,.6)),Fk,e,t)}),hO=function(e){return{$:"StartClicked",a:e}},pO=function(e){return f(dO,"Start",hO(e))},gO=n(function(e,t,r){return f(NN,F([hN(40)]),F([f(lO,e,r),t?pO(r):Rk]))}),vO=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),yO=r(function(e,t){if("Just"!==e.$)return f(Z$,"Can't find userInfo...",ba("You shouldn't be seeing this. Maybe your web3 provider changed something just now?"));var r=e.a;if("Spec"!==t.$)return Rk;var n=t.a,a=t.b;switch(a.$){case"ApproveMining":a.a;return f(Z$,"Mining Prepare tx...",Ca);case"ReadyToOpen":return f(ix,"Open Trade",f(vO,r,n));case"OpenNeedsSig":default:return Rk}}),mO=function(e){return{$:"TextInputChanged",a:e}},bO=function(e){return f(dD,mr,f(AN,F([hN(5)]),f(nu,f(Af,vN(mr),xE),function(){return F("Buyer"===e.$?[Qp("Some ideas:"),f(Bk,F([CN]),Qp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Bk,F([CN]),Qp("I'll send you $7 in Steam credit.")),f(Bk,F([CN]),Qp("TransferWise")),f(Bk,F([CN]),Qp("Cash drop in Hume Park, Bulawayo"))]:[Qp("Some ideas:"),f(Bk,F([CN]),Qp("I accept money orders or cashier checks into my Schwab bank account.")),f(Bk,F([CN]),Qp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Bk,F([CN]),Qp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Bk,F([CN]),Qp("Ship me a potato."))])}())))},CO=r(function(e,t){return f(gD,F([BT(Nk),TT(xk(200))]),{label:Tx("payment details"),onChange:mO,placeholder:""===t?ba(bO(e)):Ca,spellcheck:!0,text:t})}),SO=r(function(e,t){return f(AN,F([hN(10)]),f(nu,vN(mr),F([function(){return F("Seller"===e.$?[Qp("How must the "),cO(t),Qp(" be paid?")]:[Qp("How can you deliver the "),cO(t),Qp("?")])}(),F([Qp("You will be able to chat with the "),Qp(function(){return"Seller"===e.$?"buyer":"seller"}()),Qp(" to coordinate further once the trade is in progress.")])])))}),EO=function(e){return{$:"ApproveClicked",a:e}},TO=function(e){return{$:"ChangeState",a:e}},wO={$:"Web3Connect"},IO=n(function(e,t,r){return f(rc,Rk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ba(l(G$,mr,f(AN,F([hN(15),cN,KN(20)]),F([Qp("Text about approving"),function(){if("Just"===t.$){t.a;return f(dO,"Prepare "+n$(n.daiAmountIn)+" "+Zf(e)+" for deposit",EO(n))}return f(ix,"Connect to Wallet",wO)}()])),TO(Sv(Ev))));case"ApproveNeedsSig":var n=r.a.a;return ba(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Qp("Waiting for sig text")])),TO(Sv(Ev))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ba(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Qp("Text about opening")])),TO(f(Pv,n,Lv))));case"OpenMining":var n=r.a;r.b;return ba(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Qp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Qp("You will be redirected when the trade is finished opening.")])),TO(Sv(Ev))));default:break e}return Ca}())}),AO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(AN,F([hN(10),cN]),f(nu,f(gO,e.web3Context.factoryType,!0),rO))}var r=t.a;t.b;return f(AN,F([hN(20),cN]),F([l(gO,e.web3Context.factoryType,!1,r),f(AN,F([hN(10),cN]),F([f(SO,r.initiatorRole,r.fiatValue),f(CO,r.initiatorRole,e.textInput),f(yO,e.userInfo,e.state)]))]))}(),F([l(IO,e.web3Context.factoryType,e.userInfo,e.state)]))},BO=function(e){return{$:"MessageInputChanged",a:e}},kO={$:"MessageSubmit"},NO=function(e){return f(AN,F([BT(Nk),hN(10)]),F([f(gD,F([BT(Nk),TT(xk(100))]),{label:Tx("messageInput"),onChange:BO,placeholder:Ca,spellcheck:!1,text:e.messageInput}),f(yR,F([cN,aN(24)]),{label:Qp("Submit"),onPress:ba(kO)})]))},RO=f(qk,MN,DT.scrollbarsY),$O=r(function(e,t){return f(Bk,F([TT(Nk),BT(Nk)]),f(Bk,O(F([O$(f(U$,"position","absolute")),O$(f(U$,"top","0")),O$(f(U$,"right","0")),O$(f(U$,"bottom","0")),O$(f(U$,"left","0")),RO]),e),t))}),xO=l(Tk,200,205,210),_O=n(function(e,t,r){var n=F([TN,Lk(T$),IA(Fk),TU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([Sx,Lk(xO),IA(IR),TU({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(Bk,O(F([KN(7)]),u),f(vN,mr,F([Qp(O(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 ba(P(l(CA,0,0,1),Fk,"Initiator opened the trade"));case"Recalled":return ba(P(l(CA,0,0,1),Fk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Eo,8,eh(t))+"..";return ba(P(l(CA,1,0,1),Fk,r+" committed to the trade"));case"Aborted":return ba(P(l(CA,1,0,0),Fk,"Buyer aborted the trade"));case"Claimed":return ba(P(l(CA,0,1,0),Fk,"Buyer marked the fiat transfer complete"));case"Released":return ba(P(l(CA,0,0,1),Fk,"Seller released the "+Zf(e)+" and closed the contract"));default:return ba(P(l(CA,0,0,1),Fk,"Seller burned the "+Zf(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Rk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Bk,F([Yk(3),d$(1),f$(l(CA,1,0,1)),cN,Lk(h)]),f(vN,F([IA(p)]),F([Qp(g)])))}),LO=n(function(e,t,r){if(r.b){var n=r;return f($O,F([BT(Nk),TT(Nk),Yk(5),d$(1),f$(IR),KN(10)]),f(AN,F([BT(Nk),TT(Nk),hN(10)]),f(nu,f(_O,e,t),n)))}return f(Bk,F([BT(Nk),TT(Nk),Yk(5),d$(1),f$(IR),cN,IA(l(CA,.5,.5,.5)),CN]),Qp("no messages found."))}),PO=Sr,DO=function(e){return f(AN,F([BT(Nk),TT(Nk),hN(10),d$(1),Yk(5),KN(20)]),F([l(LO,e.web3Context.factoryType,e.userRole,f(PO,function(e){return e.blocknum},Va(e.history))),NO(e)]))},UO=function(e){return f(Bk,F([Lk(Fk),Yk(8),nD,BT(Nk),TT(Nk)]),DO(e))},OO={$:"ToggleChat"},MO=function(e){if(e.showChatHistory){var t=f(rc,Rk,f(Gf,UO,e.chatHistoryModel));return f(Bk,F([TT(Nk),BT(xk(500)),KN(20),TN]),l(G$,F([TT(Nk),BT(Nk)]),f(Df,_S,t),OO))}return Rk},FO=function(e){return"Buyer"===e.initiatorRole.$?Ff:ny},VO=function(e){return qR(e)+" "+e.fiatType},KO={$:"AbortAction"},HO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),jO=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Rk;switch(t.a.$){case"ConfirmingCommit":var r=t.a,n=r.a,a=r.b,i=r.c,o=VO(n.terms.price),u=n$(Vv(i)),s=n$(n.parameters.tradeAmount)+" "+Zf(e.web3Context.factoryType),c=function(){return"Buyer"===FO(n.parameters).$?L(f(Bk,F([jN,IA(IR)]),Qp("buyer")),F([Qp("pay the seller "),f(Bk,F([IA(T$)]),Qp(o)),Qp(" in exchange for the "),f(Bk,F([IA(T$)]),Qp(s)),Qp(" held in this contract.")])):L(f(Bk,F([jN,IA(IR)]),Qp("seller")),F([Qp("accept "),f(Bk,F([IA(T$)]),Qp(o)),Qp(" from the buyer in exchange for the "),f(Bk,F([IA(T$)]),Qp(s)),Qp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,TT(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Qp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(nu,vN(F([cN,aN(18),jN,IA(ex)])),O(F([O(F([Qp("You will deposit "),f(Bk,F([IA(T$)]),Qp(u+" "+Zf(e.web3Context.factoryType))),Qp(", thereby becoming the "),d,Qp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Qp("(This ususally requires two Metamask signatures. Your "+Zf(e.web3Context.factoryType)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(Bk,F([lx,cN]),f(ix,"Yes, I definitely want to commit to this trade.",l(HO,n,a,i)))])),KO);case"ApproveNeedsSig":t.a;return sx(F([Qp("Waiting for user signature for the approve call."),Qp("(check Metamask!)"),Qp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return sx(F([Qp("Mining the initial approve transaction..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction on Etherscan"),url:f(cx,e.web3Context.factoryType,p)}),Qp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return sx(F([Qp("Waiting for user signature for the final commit call."),Qp("(check Metamask!)"),Qp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return sx(F([Qp("Mining the final commit transaction..."),f(mA,F([dx,IA(T$)]),{label:Qp("See the transaction"),url:f(cx,e.web3Context.factoryType,p)})]));case"ConfirmingAction":var g=t.a.a;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,TT(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Qp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(nu,vN(F([cN,aN(18),jN,IA(ex)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Qp('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 '+Zf(e.web3Context.factoryType)+" rather than release it to you.")])]);case"Abort":return F([F([Qp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Zf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Qp("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 F([F([Qp("This will destroy the "+Zf(e.web3Context.factoryType)+" 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(Bk,F([lx,cN]),function(e){return f(ix,e,jS(g))}(function(){switch(g.$){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 "+Zf(e.web3Context.factoryType)+".";default:return"I understand. Burn the "+Zf(e.web3Context.factoryType)+"."}}()))])),KO);case"ActionNeedsSig":var g=t.a.a;return sx(F([Qp("Waiting for user signature for the "+GS(g)+" call."),Qp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return Rk}},qO=NN(F([BT(Nk),Lk(Fk),Yk(5),KN(20),aD,nD])),GO=function(e){return f(NN,F([hN(8)]),F([f(WR,mr,t$),f(Bk,F([aN(24),jN]),Qp(n$(e)))]))},zO=r(function(e,t){var r=f(ag,mb(e),f(Gf,function(e){return e.address},t));return f(v_,function(){var t=L(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"}(),GO(e.parameters.tradeAmount))}),YO=function(e){return f(NN,F([hN(5)]),F([w_(e.fiatType),f(Bk,F([aN(24),jN]),Qp(VO(e)))]))},WO=function(e){return f(v_,"For Fiat",YO(e.terms.price))},JO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},QO=MR({description:"flame",src:"/DAIHard/static/img/flame.png"}),XO=MR({description:"release",src:"/DAIHard/static/img/release.png"}),ZO={$:"ToggleStatsModal"},eM=function(e){return f(PO,no,e)},tM=n(function(e,t,n){var a=f(th,function(e){return $(f(SS,e,n),ba(t))},f(GE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ba(t)}return Ca},Va(e.trades))),i=Fi(a),o=l(Wa,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(dd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(dd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Qf,amountReleased:Qf,numAborts:0,numBurns:0,numReleases:0},a),u=f(Gf,Kf,el(eM(f(GE,function(e){return function(e){return e?ba(e):Ca}(Yl(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}}),rM=function(e){return{$:"ViewUserHistory",a:e}},nM=f(_B,0,mr),aM=f(qk,MN,DT.clipX),iM=f(qk,MN,DT.clipY),oM=f(qk,eN,DT.textNormalWeight),uM=r(function(e,t){return yi(e/t)}),sM=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(_(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),cM=r(function(e,t){var r=e.a,n=e.b;return l(sM,r,f(uM,Yl(t),6e4),n)}),fM=r(function(e,t){return f(es,24,f(uM,f(cM,e,t),60))}),lM=r(function(e,t){return f(es,1e3,Yl(t))}),dM=r(function(e,t){return f(es,60,f(cM,e,t))}),hM={$:"Apr"},pM={$:"Aug"},gM={$:"Dec"},vM={$:"Feb"},yM={$:"Jan"},mM={$:"Jul"},bM={$:"Jun"},CM={$:"Mar"},SM={$:"May"},EM={$:"Nov"},TM={$:"Oct"},wM={$:"Sep"},IM=function(e){var t=f(uM,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)}},AM=r(function(e,t){switch(IM(f(cM,e,t)).month){case 1:return yM;case 2:return vM;case 3:return CM;case 4:return hM;case 5:return SM;case 6:return bM;case 7:return mM;case 8:return pM;case 9:return wM;case 10:return TM;case 11:return EM;default:return gM}}),BM=r(function(e,t){return f(es,60,f(uM,Yl(t),1e3))}),kM={$:"Fri"},NM={$:"Mon"},RM={$:"Sat"},$M={$:"Sun"},xM={$:"Thu"},_M={$:"Tue"},LM={$:"Wed"},PM=r(function(e,t){switch(f(es,7,f(uM,f(cM,e,t),1440))){case 0:return xM;case 1:return kM;case 2:return RM;case 3:return $M;case 4:return NM;case 5:return _M;default:return LM}}),DM=n(function(e,t,r){return e.toAmPm(f(fM,t,r))}),UM=r(function(e,t){return IM(f(cM,e,t)).day}),OM=UM,MM=F([$M,NM,_M,LM,xM,kM,RM]),FM=r(function(e,t){return function(e){return e.a}(f(rc,L(0,$M),el(f(th,function(r){return $(r.b,f(PM,e,t))},f(ji,r(function(e,t){return L(e,t)}),MM)))))}),VM=function(e){return l(Wa,Ya,0,e)},KM=r(function(e,t){return IM(f(cM,e,t)).year}),HM=function(e){return!f(es,4,e)&&(!!f(es,100,e)||!f(es,400,e))},jM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return HM(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}}),qM=F([yM,vM,CM,hM,SM,bM,mM,pM,wM,TM,EM,gM]),GM=r(function(e,t){return f(rc,L(0,yM),el(f(th,function(r){r.a;return $(r.b,f(AM,e,t))},f(ji,r(function(e,t){return L(e,t)}),qM))))}),zM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(GM,e,t))}),YM=r(function(e,t){var r=f(_s,f(zM,e,t)-1,qM);return VM(f(nu,jM(f(KM,e,t)),r))+f(OM,e,t)}),WM=r(function(e,t){return f(zM,e,t)/4|0}),JM=r(function(e,t){var r=Gi(t),n=e-yo(r);return O(f(zi,"",f(nu,function(e){return"0"},f(Hi,1,n))),r)}),QM=function(e){return e?e<=12?e:e-12:12},XM=Bg(315576e5),ZM=r(function(e,t){return Kf(XM*f(KM,e,t))}),eF=r(function(e,t){var r=f(ZM,e,t),n=f(FM,e,r);return 1+((f(YM,e,t)+n)/7|0)}),tF=r(function(e,t){return Gi(f(KM,e,t))}),rF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Gi(f(zM,t,r));case"MonthSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(zM,t,r));case"MonthFixed":return f(JM,2,f(zM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(AM,t,r));case"MonthNameFull":return e.toMonthName(f(AM,t,r));case"QuarterNumber":return Gi(1+f(WM,t,r));case"QuarterSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(1+f(WM,t,r));case"DayOfMonthNumber":return Gi(f(OM,t,r));case"DayOfMonthSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(OM,t,r));case"DayOfMonthFixed":return f(JM,2,f(OM,t,r));case"DayOfYearNumber":return Gi(f(YM,t,r));case"DayOfYearSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(YM,t,r));case"DayOfYearFixed":return f(JM,3,f(YM,t,r));case"DayOfWeekNumber":return Gi(f(FM,t,r));case"DayOfWeekSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(FM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(PM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(PM,t,r));case"WeekOfYearNumber":return Gi(f(eF,t,r));case"WeekOfYearSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(eF,t,r));case"WeekOfYearFixed":return f(JM,2,f(eF,t,r));case"YearNumberLastTwo":return f(Ao,2,f(tF,t,r));case"YearNumber":return f(tF,t,r);case"AmPmUppercase":return HP(l(DM,e,t,r));case"AmPmLowercase":return ll(l(DM,e,t,r));case"HourMilitaryNumber":return Gi(f(fM,t,r));case"HourMilitaryFixed":return f(JM,2,f(fM,t,r));case"HourNumber":return Gi(QM(f(fM,t,r)));case"HourFixed":return f(JM,2,QM(f(fM,t,r)));case"HourMilitaryFromOneNumber":return Gi(1+f(fM,t,r));case"HourMilitaryFromOneFixed":return f(JM,2,1+f(fM,t,r));case"MinuteNumber":return Gi(f(dM,t,r));case"MinuteFixed":return f(JM,2,f(dM,t,r));case"SecondNumber":return Gi(f(BM,t,r));case"SecondFixed":return f(JM,2,f(BM,t,r));case"MillisecondNumber":return Gi(f(lM,t,r));case"MillisecondFixed":return f(JM,3,f(lM,t,r));default:return n.a}}),nF=a(function(e,t,r,n){return f(zi,"",f(nu,l(rF,e,r,n),t))}),aF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),iF=function(e){return e>11?"pm":"am"},oF=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"}},uF=function(e){switch(f(es,100,e)){case 11:case 12:case 13:return"th";default:switch(f(es,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},sF=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"}},cF=p(aF,oF,f(_a,oF,Eo(3)),sF,f(_a,sF,Eo(3)),iF,uF),fF=nF(cF),lF={$:"MonthNameFull"},dF=lF,hF=function(e){return{$:"Text",a:e}},pF=hF,gF={$:"YearNumber"},vF=gF,yF=n(function(e,t,n){var a=r(function(e,t){return f(AN,F([aN(18),hN(6)]),F([f(Bk,F([yN]),Qp(e)),f(Bk,F([oM]),Qp(t))]))}),i=fF(F([dF,pF(", "),vF])),o=f(AN,F([hN(23),BT(Nk)]),O(f(nu,function(e){var t=e.a,r=e.b;return f(a,t,r)},F([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,nM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Gi(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+Zf(e)+" Released"),L("Abort Outcomes",Gi(n.numAborts)+" trades"),L("Burn Outcomes",Gi(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+Zf(e)+" Burned")])),F([f(Bk,F([cN]),f(dO,"View User History",rM(n.asRole)))])));return f(AN,F([Yk(8),aM,iM,Lk(AR),hN(1),rD({blur:20,color:d(JR,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Bk,F([BT(Nk),Lk(Fk),KN(17)]),f(m$,18,t)),f(Bk,F([BT(Nk),Lk(Fk),KN(17)]),o)]))}),mF=a(function(e,t,r,n){var a=l(tM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=JO(t.parameters.initiatorRole)+" Stats";return f(Bk,n?F([f_(f(Bk,F([l_(30),TN]),l(yF,e,t.parameters.initiatorAddress,a)))]):mr,f(v_,i,f(NN,F([BT(Nk),hN(30),Gk,Zk(ZO)]),F([f(NN,mr,F([f(WR,F([TT(xk(28))]),XO),f(Bk,F([aN(24),jN]),Qp(l(Xu,2,D("0"),Gi(a.numReleases))))])),f(NN,mr,F([f(WR,F([TT(xk(28))]),QO),f(Bk,F([aN(24),jN]),Qp(l(Xu,2,D("0"),Gi(a.numAborts))))])),f(NN,mr,F([f(WR,F([TT(xk(28))]),QO),f(Bk,F([aN(24),jN]),Qp(l(Xu,2,D("0"),Gi(a.numBurns))))]))]))))}),bF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+eh(t)}e.a;return"https://kovan.etherscan.io/address/"+eh(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+eh(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+eh(t);case"XDai":e.a;return"https://blockscout.com/poa/dai/address/"+eh(t);case"Rootstock":e.a;return"https://explorer.rsk.co/address/"+eh(t);default:e.a;return""}}),CF=n(function(e,t,r){return f(mA,e,{label:Qp(eh(r)),url:f(bF,t,r)})}),SF=r(function(e,t){return f(v_,"Trade Status",f(AN,F([aN(24),jN,hN(8)]),F([Qp(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(CF,F([aN(12),IA(T$),dx]),t,e.creationInfo.address)])))}),EF=o(function(e,t,r,n,a,i){return qO(F([f(SF,t,n),f(zO,t,r),WO(t),d(mF,n,t,a,i)]))}),TF=l(Tk,9,32,107),wF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),IF=a(function(e,t,r,n){return d(wF,e,t,r,n)}),AF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BF=function(e){return function(e){return d(IF,e.red,e.green,e.blue,e.alpha)}(AF(e))},kF=function(e){return{$:"Circle",a:e}},NF=kF,RF=d(wF,0,0,0,1),$F={$:"Flat"},xF={$:"Sharp"},_F=function(e){return{$:"Uniform",a:e}},LF=_F,PF={cap:$F,dashPattern:mr,dashPhase:0,fill:LF(RF),join:xF,thickness:2},DF=n(function(e,t,r){return U(PF,{dashPattern:e,fill:r,thickness:t})}),UF=DF(mr),OF={$:"Transparent"},MF=OF,FF=f(UF,0,MF),VF=r(function(e,t){return{$:"Shape",a:e,b:t}}),KF=function(e){return{basic:e,handlers:mr,name:Ca,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},HF=function(e){return f(Af,KF,VF(e))},jF=function(e){return HF(L(e,FF))},qF=function(e){return L(-e.a,-e.b)},GF=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return U(t,{shift:L(a.a+r,a.b+n)})}),zF=r(function(e,t){return f(GF,qF(e(t)),t)}),YF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(za,r,a),f(za,n,i))});return l(Xa,t,L(mr,mr),e)},WF=r(function(e,t){return{$:"Path",a:e,b:t}}),JF=Nr,QF=Rr,XF=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=QF(n),i=JF(n);return L(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 L(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Af,f(Af,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},ZF=function(e){return nu(function(t){var r=t.a,n=t.b,a=e/2;return L(r<0?r-a:r+a,n<0?n-a:n+a)})},eV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(ZF,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),tV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return F([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},rV=function(e){var t=nV(e.basic),r=YF(f(nu,XF(e),t)),n=r.a,a=r.b;return{toBottom:-f(rc,0,SI(a)),toLeft:-f(rc,0,SI(n)),toRight:f(rc,0,CI(n)),toTop:f(rc,0,CI(a))}},nV=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(eV,r,L(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(eV,r,L(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(eV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(ZF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(WF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(ZF,$(C,$F)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(eV,0,S);case"Group":var E=e.a;return f(ZF,0,sy(f(nu,f(_a,rV,tV),E)));default:var T=e.b;return f(ZF,0,tV(rV(T)))}},aV=function(e){var t=rV(e);return t.toTop+t.toBottom},iV=function(e){var t=rV(e);return L(-t.toLeft,t.toTop)},oV=function(e){var t=rV(e);return t.toLeft+t.toRight},uV=Un("http://www.w3.org/2000/svg"),sV=uV("svg"),cV=qn("height"),fV=qn("version"),lV=qn("width"),dV=uV("circle"),hV=uV("ellipse"),pV=uV("foreignObject"),gV=uV("g"),vV=uV("image"),yV=uV("polygon"),mV=uV("polyline"),bV=uV("rect"),CV=Nw,SV=uV("text"),EV=qn("id"),TV=qn("points"),wV=qn("r"),IV=qn("rx"),AV=qn("ry"),BV=function(e){return l(Gn,"http://www.w3.org/1999/xlink","xlink:href",it(e))},kV=function(e){return{$:"Group",a:e}},NV=qn("dominant-baseline"),RV=qn("fill"),$V=qn("fill-opacity"),xV=qn("font-family"),_V=qn("font-size"),LV=qn("font-style"),PV=qn("font-variant"),DV=qn("font-weight"),UV=qn("opacity"),OV=qn("stroke"),MV=qn("stroke-dasharray"),FV=qn("stroke-dashoffset"),VV=qn("stroke-linecap"),KV=qn("stroke-linejoin"),HV=qn("stroke-opacity"),jV=qn("stroke-width"),qV=qn("text-anchor"),GV=qn("text-decoration"),zV=qn("transform"),YV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},WV=function(e){return f(zi," ",f(nu,function(e){var t=e.a,r=e.b;return f(zi,",",F([Gi(t),Gi(r)]))},e))},JV=n(function(e,t,r){return d(wF,e,t,r,1)}),QV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Bg(1e4*e)/100};return Tl(F(["rgba(",ww(i(t)),"%,",ww(i(r)),"%,",ww(i(n)),"%,",ww(function(e){return Bg(1e3*e)/1e3}(a)),")"]))},XV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},ZV=function(e){var t=XV(e),r=t.red,n=t.green,a=t.blue;return QV(l(JV,r,n,a))},eK=function(e){if("Uniform"===e.$){var t=e.a;return ZV(t)}return"none"},tK=function(e){var t=XV(e),r=t.alpha;return ww(r)},rK=function(e){if("Uniform"===e.$){var t=e.a;return tK(t)}return"0"},nK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},aK=kr,iK=function(e){var t=ww(e.scale.b),r=ww(e.scale.a),n=ww(-e.rotation/2/aK*360),a=ww(-e.shift.b),i=ww(e.shift.a);return Tl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},oK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([OV(eK(r.fill)),HV(rK(r.fill)),jV(ww(r.thickness)),VV(YV(r.cap)),KV(nK(r.join)),RV("none"),UV(ww(e.opacity)),zV(iK(e)),FV(Gi(r.dashPhase)),MV(WV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([RV(eK(a)),$V(rK(a)),OV(eK(r.fill)),HV(rK(r.fill)),jV(ww(r.thickness)),VV(YV(r.cap)),KV(nK(r.join)),UV(ww(e.opacity)),zV(iK(e)),FV(Gi(r.dashPhase)),MV(WV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([RV(eK(_F(o.color))),xV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),_V(Gi(o.size)),DV(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"}}()),LV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),PV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),GV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),qV("middle"),NV("middle"),zV(iK(e))]);default:return F([zV(iK(e))])}},uK=qn("x"),sK=qn("y"),cK=r(function(e,t){return F([lV(ww(e)),cV(ww(t)),uK(ww(-e/2)),sK(ww(-t/2))])}),fK=function(e){return f(zi," ",f(nu,function(e){var t=e.a,r=e.b;return f(zi,",",F([ww(t),ww(-r)]))},e))},lK=Qk,dK=r(function(e,t){return f(e,t.a,t.b)}),hK=function(e){return f(nu,dK(lK),e)},pK=function(e){e:for(;;){var t=f(rc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(mV,O(F([EV(t),TV(fK(i))]),O(oK(e),hK(e.handlers))),mr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(yV,O(F([EV(t),TV(fK(i))]),O(oK(e),hK(e.handlers))),mr);case"Circle":var c=s.a;return f(dV,O(F([EV(t),wV(ww(c))]),O(oK(e),hK(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(hV,O(F([EV(t),IV(ww(d)),AV(ww(h))]),O(oK(e),hK(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(bV,O(F([EV(t),IV(ww(c)),AV(ww(c))]),O(f(cK,p,g),O(oK(e),hK(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(WF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(SV,O(F([EV(t)]),O(oK(e),hK(e.handlers))),F([CV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(vV,O(F([EV(t),BV(C)]),O(f(cK,p,g),O(oK(e),hK(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(pV,O(F([EV(t)]),O(f(cK,p,g),O(oK(e),hK(e.handlers)))),F([E]));case"Group":var T=n.a;return f(gV,f(za,EV(t),O(oK(e),hK(e.handlers))),l(Wa,r(function(e,t){return f(za,pK(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:kV(F([w,I]))});e=v;continue e}}},gK=r(function(e,t){var r=e.a,n=e.b,a=ww(r),i=ww(n);return f(JT,mr,F([f(sV,F([lV(a),cV(i),fV("1.1")]),F([pK(t)]))]))}),vK=function(e){return f(gK,L(oV(e),aV(e)),f(zF,iV,e))},yK=a(function(e,t,r,n){var a=A_(vK(f(jF,LF(BF(r)),NF(t/2))));return f(Bk,O(F([H$(n)]),e),a)}),mK=MR({description:"chat",src:"/DAIHard/static/img/chat-icon.svg"}),bK=function(e){return f(ZN,RU,$U(e))},CK=d(yK,F([Gk,Zk(OO)]),80,l(CA,1,1,1),f(WR,F([cN,ON,bK(5)]),mK)),SK=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},EK=function(e){return f(AN,F([Yk(12),Lk(AR),KN(15),hN(15)]),F([f(Bk,F([aN(24),tN,CN]),Qp("Fiat Payment Method")),f(vN,F([aN(18),TT(IT),Lk(Fk),rD({blur:5,color:d(JR,0,0,0,.2),offset:L(-3,3),size:0}),Yk(3),KN(5)]),F([f(rc,f(Bk,F([IA(B$),CN]),Qp("No payment methods found.")),f(Gf,Qp,f(Gf,function(e){return e.info},el(e))))]))]))},TK={$:"Active"},wK=function(e){return{$:"ExpandPhase",a:e}},IK=F([Lk(TF),IA(Fk)]),AK=r(function(e,t){return{$:"Min",a:e,b:t}}),BK=r(function(e,t){return f(AK,e,t)}),kK=function(e){return F(e?[Yk(12),V$,TT(f(BK,380,IT))]:[Yk(12),cN])},NK=F([Lk(Fk)]),RK=r(function(e,t){return jf(f(Lu,qf(e),qf(t)))}),$K=r(function(e,t){return d(ax,P(d(JR,1,.6,.2,1),d(JR,1,.6,.2,.8),d(JR,1,.6,.2,.6)),Fk,e,t)}),xK=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),_K=function(e){return{$:"ContractActionClicked",a:e}},LK={$:"Web3Connect"},PK=n(function(e,t,r){if("Just"===r.$){var n=r.a;return"TimeUp"===f(TR,e,t).$?Rk:f(NN,F([hN(8)]),function(){var e=P(t.state.phase,f(mb,t,n.address),f(SS,t,n.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return F([f(Df,jS,f(dO,"Remove and Refund this Trade",KS))])}break e}var r=(e.a,e.b,qf(bb(t.parameters)));return F([f(ix,"Deposit and Commit to Trade",l(xK,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Df,_K,f($K,"Abort Trade",AS)),f(Df,_K,f(ix,"Confirm Payment",LS)),CK])}e.a,e.c.a;return F([CK])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Df,_K,f(ix,"Burn it All!",xS)),f(Df,_K,f(dO,"Release Everything",HS)),CK])}e.a,e.c.a;return F([CK])}break e;default:break e}return mr}())}return f(ix,"Connect to Wallet",LK)}),DK={$:"Finished"},UK={$:"NotStarted"},OK=r(function(e,t){var r=L(xN(t),xN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?UK:$(n,a)?TK:DK}),MK=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(za,r,e),a=t-1,i=r;e=n,t=a,r=i}}),FK=r(function(e,t){return l(MK,mr,e,t)}),VK=i(function(e,t,r,n,a){var i=n$(f(dd,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Zf(e),o=n$(n.parameters.tradeAmount)+" "+Zf(e),u=f(NN,mr,f(FK,3,f(WR,F([TT(xk(18))]),QO))),s=f(Af,Bk(F([IA(l(CA,1,0,0))])),Qp),c=$(t,n.state.phase),d=f(ag,SS(n),f(Gf,function(e){return e.address},a)),h=c?Fk:IR,p=vN(F([IA(h),aN(18),tN])),g=VO(n.terms.price),v=c?l(Tk,0,226,255):l(Tk,16,7,234),y=f(Af,Bk(F([IA(v)])),Qp),m=n$(n.parameters.buyerDeposit)+" "+Zf(e),b=n.parameters.abortPunishment,C=n$(b)+" "+Zf(e),S=n$(f(RK,n.parameters.buyerDeposit,b))+" "+Zf(e),E=n$(f(RK,n.parameters.tradeAmount,b))+" "+Zf(e),T=function(){var r=L(t,d);if("Just"===r.b.$)switch(r.a.$){case"Open":var a=(r.a,r.b.a);return L("And Now, We Wait",function(){return"Buyer"===a.$?f(nu,p,F([F([Qp("Your "),s("burnable deposit"),Qp(" of "),y(m),Qp(" is now held in this contract, and your offer to buy "),y(o),Qp(" for "),y(g),Qp(" is now listed in the marketplace.")]),F([Qp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Qp(" into this contract.")]),F([Qp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Qp(" to you.")])])):f(nu,p,F([F([Qp("Your offer to sell the "),y(o),Qp(" held in this contract for "),y(g),Qp(" is now listed in the marketplace.")]),F([Qp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Qp(" of 1/3 of the trade amount "),y("("+m+")"),Qp(" into this contract.")]),F([Qp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Qp(" to you.")])]))}());case"Committed":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Time to Pay Up",f(nu,p,F([F([Qp("You must now pay the Seller "),y(g),Qp(" via the Fiat Payment Method, "),f(Bk,F([tN]),Qp("and then click ")),s("Confirm Payment"),Qp(" before the payment window runs out. Use the chat to coordinate.")]),F([Qp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(") will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to the Seller, "),y(S),Qp(" to you).")]),F([Qp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Qp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(nu,p,F([F([Qp("Work and communicate with the Buyer to receive "),y(g),Qp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Qp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(") will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to you, "),y(S),Qp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(nu,p,F([F([Qp("If the Seller confirms receipt of payment, or fails to decide within the release window, the combined balance of "),y(i),Qp(" will be released to you.")]),F([Qp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Qp(" In this case the "),y(i),Qp(" will be lost to both parties.")]),F([Qp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(nu,p,F([F([Qp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Qp("So, have you recieved the "),y(g),Qp("? If so, you can click "),y("Release Everything"),Qp(".")]),F([Qp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Qp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Qp("If you don't decide within the Release Window, the balance will be automatically released.")])])));default:r.a;return L("Contract closed.",F([p(F([Qp("Check the chat log for the full history.")]))]))}else switch(r.a.$){case"Open":r.a,r.b;return L("Get it while it's hot",function(){return"Seller"===n.parameters.initiatorRole.$?f(nu,p,F([F([Qp("The Seller has deposited "),y(o),Qp(" into this contract, and offers to sell it for "),y(g),Qp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Qp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Qp(".")]),F([Qp("If the trade is successful, the combined "+Zf(e)+" balance "),y("("+i+")"),Qp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Qp(" for both parties (see Payment Window for more on this).")]),F([Qp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Qp(" within the payment window.")])])):f(nu,p,F([F([Qp("The Buyer is offering to buy "),y(o),Qp(" for "),y(g),Qp(", and has deposited "),y(m),Qp(" into this contract as a "),s("burnable deposit"),Qp(". To become the Seller, deposit "),y(o),Qp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Qp(".")]),F([Qp("When you receive the "),y(g),Qp(" from the Buyer, the combined "+Zf(e)+" balance "),y("("+i+")"),Qp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Qp(" for both parties (see Payment Window for more on this).")]),F([Qp("Don't commit unless you can receive "),y(g),Qp(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":r.a,r.b;return L("Making the Payment",f(nu,p,F([F([Qp("During this phase, the Buyer is expected to transfer "),y(g),Qp(" to the Seller, as described in Fiat Payment Method, "),f(Bk,F([tN]),Qp("and ")),s("Confirm the Payment "),Qp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Qp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(" amount) will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to the Seller, "),y(S),Qp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(nu,p,F([F([Qp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Qp("If the Seller can verify he has received the "),y(g),Qp(", he will probably release the total balance of "),y(o),Qp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Qp(".")]),F([Qp("If the Seller has not made a decision before the Release Window expires, the "),y(o),Qp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(AN,F([BT(Nk),TT(Nk),KN(20),hN(30)]),F([f(NN,F([BT(Nk)]),F([f(Bk,F([aN(24),tN,IA(v),Sx]),Qp(w))])),f(AN,F([BT(Nk),ON,hN(13)]),I),f(Bk,F([TN]),function(){switch(f(OK,n,t).$){case"Active":return l(PK,r,n,a);case"NotStarted":return f(Bk,F([aN(20),tN,CN,IA(g$)]),Qp("Phase not yet started."));default:return f(Bk,F([aN(20),tN,CN]),Qp("Phase no longer active."))}}())]))}),KK=MR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),HK=MR({description:"judgment phase",src:"/DAIHard/static/img/phase-judgment.svg"}),jK={$:"None"},qK=jK,GK=MR({description:"open phase",src:"/DAIHard/static/img/phase-open.svg"}),zK=function(e){switch(e.$){case"Open":return GK;case"Committed":return KK;case"Judgment":return HK;default:return qK}},YK=r(function(e,t){var r=zK(e),n=function(){switch(t.$){case"NotStarted":return l(Tk,10,33,108);case"Active":return l(Tk,0,100,170);default:return l(Tk,1,129,104)}}(),a=A_(vK(f(jF,LF(BF(n)),NF(50))));return f(Bk,F([cN,H$(f(WR,F([cN,ON]),r))]),a)}),WK=function(e){var t=F([CN,tN,aN(20)]);switch(e.$){case"Active":return f(Bk,O(t,F([IA(oN)])),Qp("Active"));case"NotStarted":return f(Bk,O(t,F([IA(g$)])),Qp("Not Started"));default:return f(Bk,t,Qp("Finished"))}},JK=n(function(e,t,r){var n=f(OK,t,e),a=function(){return"Active"===n.$?l(Tk,0,226,255):IR}(),i=f(Bk,F([IA(a),aN(20),tN,cN]),Qp(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Release Window";default:return"Closed"}}())),o=function(){if("Closed"===e.$)return Rk;switch(n.$){case"NotStarted":return d(LR,F([cN]),F([aN(22),jN]),L(IR,AR),f(SR,e,t));case"Active":var a=f(TR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(UR,F([cN]),F([aN(22),jN]),L(Fk,AR),i)}return f(AN,F([cN,hN(10)]),F([f(Bk,F([cN]),Qp(wR(e))),f(dO,"Poke",jS(VS))]));default:return f(Bk,F([TT(xk(1))]),Rk)}}();return f(AN,F([KN(20),hN(10),TT(Nk)]),F([f(Bk,F([V$,cN]),i),f(Bk,F([TT(Nk),cN]),f(Bk,F([ON]),f(YK,e,n))),f(AN,F([hN(10),lx,cN]),F([f(Bk,F([cN]),WK(n)),o]))]))}),QK=u(function(e,t,r,n,a,i,o){var u=f(OK,n,r),s=f(Bk,F([KN(10),BT(Nk),TT(Nk)]),h(VK,t,r,o,n,a)),c=function(){switch(r.$){case"Open":return n.parameters.autorecallInterval;case"Committed":return n.parameters.autoabortInterval;case"Judgment":return n.parameters.autoreleaseInterval;default:return Kf(0)}}(),d=l(JK,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(ER,f(wb,n.state.phaseStartTime,c),o);default:Kf(0)}}(),f(Bk,F([TT(Nk),BT(xk(1)),Lk(function(){return"Active"===u.$?l(CA,0,0,1):AR}())]),Rk)),g=i?f(NN,O(kK(e),O($(u,TK)?IK:NK,F([BT(Nk)]))),F([d,p,s])):f(NN,O(kK(e),O($(u,TK)?IK:NK,F([Gk,Zk(wK(r))]))),F([d]));return!e&&$(u,TK)?f(AN,F([BT(Nk),hN(20),C$({bottom:20,left:0,right:0,top:0})]),F([g,EK(n.terms.paymentMethods)])):g}),XK=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f(NN,F([cN,Yk(12),KN(30),hN(10),Lk(TF),aN(24),tN,IA(Fk)]),F([Qp("Trade "+SK(r.state.closedReason)),CK])):e?f(AN,F([BT(Nk),hN(10)]),F([f(NN,F([BT(Nk),TT(IT),hN(20)]),F([g(QK,e,t,io,r,a,$(n,io),i),g(QK,e,t,aC,r,a,$(n,aC),i),g(QK,e,t,iC,r,a,$(n,iC),i)])),EK(r.terms.paymentMethods)])):f(AN,F([BT(Nk),TT(IT),hN(20)]),F([g(QK,e,t,io,r,a,$(n,io),i),g(QK,e,t,aC,r,a,$(n,aC),i),g(QK,e,t,iC,r,a,$(n,iC),i)]))}),ZK=a(function(e,t,r,n){var a=e>1300;return L(function(){var e=n.trade;switch(e.$){case"LoadedTrade":var i=e.a;return f(AN,F([BT(Nk),TT(Nk),hN(40)]),F([p(EF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Bk,F([BT(Nk),f(Hk,40,0),hN(40)]),p(XK,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Bk,F([cN,ON,aN(30)]),Qp("Loading trade info..."));default:return f(Bk,F([cN,ON,aN(30)]),Qp("Invalid trade"))}}(),F([MO(n),jO(n)]))}),eH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),tH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(qD(Dk(Qv(ny))),mr);case"CreateModel":var n=r.a;return L(f(Df,Oy,DD(n)),mr);case"QuickCreateModel":var a=r.a;return l(eH,Df(Vy),nu(Df(Vy)),AO(a));case"TradeModel":var i=r.a;return l(eH,Df(Hy),nu(Df(Hy)),d(ZK,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Df,vT,l(XU,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Df,dT,l(R$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Bk,F([BT(Nk),TT(Nk),Yk(10)]),n),a)}),rH=function(e){return{$:"DismissNotice",a:e}},nH=r(function(e,t){var n=function(){return"Error"===t.noticeType.$?l(CA,1,1,1):l(CA,0,0,0)}(),a=function(){switch(t.noticeType.$){case"Update":return l(Tk,100,200,255);case"Caution":return l(Tk,255,188,0);case"Error":return l(Tk,255,70,70);default:return l(Tk,200,200,200)}}(),i=f(Bk,F([TN,V$,X$(5),bK(5)]),P$(rH(e)));return f(Bk,F([Lk(a),Yk(10),KN(8),BT(Nk),d$(1),f$(d(JR,0,0,0,.15)),nD]),f(AN,F([hN(4),BT(Nk)]),f(ji,r(function(e,t){return f(vN,F([BT(Nk),IA(n)]),e?t:f(za,i,t))}),t.mainParagraphs)))}),aH=function(e){return $(e,mr)?Rk:f(AN,F([xU(20),X$(20),hN(10),TN,lx,BT(xk(300)),aN(15)]),f(ji,nH,e))},iH=r(function(e,t){var r=f(tH,e,t),n=r.a,a=r.b;return L(f(AN,F([kR(Pk),H$(RN(t)),BT(Nk),TT(Nk),KN(30)]),F([f(Bk,F([TT(xk(50))]),Rk),n])),O(a,F([aH(t.userNotices)])))}),oH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),uH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),sH={$:"AllowHover"},cH={$:"Layout"},fH={backgroundColor:Ca,borderColor:Ca,shadow:ba({blur:3,color:d(bA,155/255,203/255,1,1),offset:L(0,0),size:3})},lH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ba(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ba(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ba(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?fH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?sH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?cH:t.a}()}}(l(Xa,t,{focus:Ca,hover:Ca,mode:Ca},e))},dH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(xT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),xT);case"Text":var a=t.a;return UI(a);default:return UI("")}}),hH=n(function(e,t,r){var n=lH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?oH(n):uH(n)}();return f(dH,a,d(vA,xT,Ak,t,RT(F([r]))))}),pH=iw(5),gH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),vH={$:"SansSerif"},yH=function(e){return{$:"Typeface",a:e}},mH=W,bH=r(function(e,t){return O(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(zi,"-",mH(ll(t)));case"ImportFont":var t=e.a;e.b;return f(zi,"-",mH(ll(t)));default:var t=e.a.name;return f(zi,"-",mH(ll(t)))}}())}),CH=function(){var e=F([yH("Open Sans"),yH("Helvetica"),yH("Verdana"),vH]);return F([f(TA,_k,l(EA,"bg-color-"+wA(d(bA,1,1,1,0)),"background-color",d(bA,1,1,1,0))),f(TA,SA,l(EA,"font-color-"+wA(d(bA,0,0,0,1)),"color",d(bA,0,0,0,1))),f(TA,rN,nN(20)),f(TA,pH,f(gH,l(Wa,bH,"font-",e),e))])}(),SH=n(function(e,t,r){var n=e.options;return l(hH,n,f(za,yA(f(zi," ",F([DT.root,DT.any,DT.single]))),O(CH,t)),r)}),EH=SH({options:mr}),TH=function(e){return f(TA,pH,f(gH,l(Wa,bH,"ff-",e),e))},wH=vH,IH=yH,AH=function(e){return{body:F([function(){var t=f(iH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([BT(Nk),TT(Nk),TH(F([IH("Soleil"),wH]))]),f(nu,H$,n));return f(EH,a,r)}()]),title:"DAIHard"}},BH=jt,kH=BH({init:CB,onUrlChange:Ek,onUrlRequest:Sk,subscriptions:Ck,update:lB,view:AH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:kH(f(xo,function(e){return f(xo,function(t){return f(xo,function(r){return Po({height:r,networkId:t,width:e})},f(Fd,"height",eS))},f(Fd,"networkId",eS))},f(Fd,"width",eS)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?(window.ethereum&&(window.ethereum.autoRefreshOnNetworkChange=!1),web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),a(app),i(app,web3)})):(window.app=s.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),a(app),console.log("Metamask not detected."))}function a(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function i(e,t){o(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&u(e,t)})}function o(e,t){l.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){u(e,t)})}function u(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),c.txSentry(e.ports.txOut,e.ports.txIn,t),c.walletSentry(e.ports.walletSentryPort,t),l.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){f.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=f.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=f.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 s=r(41),c=(r.n(s),r(40)),f=r(39),l=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,f),k(n,e[0],e[1]),k(f,t[0],t[1]),$(n,n,f),$(a,e[3],t[3]),$(a,a,F),$(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),$(e[0],o,u),$(e[1],c,s),$(e[2],s,u),$(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,t[0],a),$(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),R(a,e[1]),$(i,a,M),N(a,a,e[2]),k(i,e[2],i),R(o,i),R(u,o),$(s,u,o),$(r,s,a),$(r,r,i),v(r,r),$(r,r,a),$(r,r,i),$(r,r,i),$(e[0],r,i),R(n,e[0]),$(n,n,i),y(n,a)&&$(e[0],e[0],j),R(n,e[0]),$(n,n,i),y(n,a)?-1:(C(e[0])===t[31]>>7&&N(e[0],U,e[0]),$(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)R(n,n),1!==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 S(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 E(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),S(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)R(n,n),2!==r&&4!==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(55),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/View.elm b/src/View.elm index bc79154..267d873 100644 --- a/src/View.elm +++ b/src/View.elm @@ -91,7 +91,17 @@ headerContent model = , Element.paddingXY 30 17 ] [ headerLink - ("Buy " ++ Config.tokenUnitName model.web3Context.factoryType) + "Create a New Offer" + (GotoRoute Routing.Create) + (case model.submodel of + CreateModel _ -> + Active + + _ -> + Normal + ) + , headerLink + "Sell Offers" (GotoRoute <| Routing.Marketplace Buyer) (case model.submodel of MarketplaceModel marketplaceModel -> @@ -105,7 +115,7 @@ headerContent model = Normal ) , headerLink - ("Sell " ++ Config.tokenUnitName model.web3Context.factoryType) + "Buy Offers" (GotoRoute <| Routing.Marketplace Seller) (case model.submodel of MarketplaceModel marketplaceModel -> @@ -115,16 +125,6 @@ headerContent model = else Normal - _ -> - Normal - ) - , headerLink - "Create a New Offer" - (GotoRoute Routing.Create) - (case model.submodel of - CreateModel _ -> - Active - _ -> Normal )