diff --git a/assets/static/img/aborted.svg b/assets/static/img/aborted.svg new file mode 100644 index 0000000..3f45161 --- /dev/null +++ b/assets/static/img/aborted.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/static/img/burned.svg b/assets/static/img/burned.svg new file mode 100644 index 0000000..b926e87 --- /dev/null +++ b/assets/static/img/burned.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/static/img/chat-icon.svg b/assets/static/img/chat-icon.svg deleted file mode 100644 index 0abecee..0000000 --- a/assets/static/img/chat-icon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/static/img/chat.svg b/assets/static/img/chat.svg new file mode 100644 index 0000000..eadf91a --- /dev/null +++ b/assets/static/img/chat.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/static/img/diamond-give-white.svg b/assets/static/img/diamond-give-white.svg new file mode 100644 index 0000000..696b050 --- /dev/null +++ b/assets/static/img/diamond-give-white.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/assets/static/img/payment-window-icon.svg b/assets/static/img/fiat-bag-white.svg similarity index 100% rename from assets/static/img/payment-window-icon.svg rename to assets/static/img/fiat-bag-white.svg diff --git a/assets/static/img/open-window-white.svg b/assets/static/img/open-window-white.svg new file mode 100644 index 0000000..876cfbd --- /dev/null +++ b/assets/static/img/open-window-white.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/static/img/released.svg b/assets/static/img/released.svg new file mode 100644 index 0000000..178cf53 --- /dev/null +++ b/assets/static/img/released.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/static/img/stop-white.svg b/assets/static/img/stop-white.svg new file mode 100644 index 0000000..14a0d37 --- /dev/null +++ b/assets/static/img/stop-white.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/static/img/time-clock-fire.svg b/assets/static/img/time-clock-fire.svg new file mode 100644 index 0000000..dd57760 --- /dev/null +++ b/assets/static/img/time-clock-fire.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/contract addresses.txt b/contract addresses.txt new file mode 100644 index 0000000..9de14e4 --- /dev/null +++ b/contract addresses.txt @@ -0,0 +1,11 @@ +Redirector: + xDai: 0x092110996699c3E06e998d89F0f4586026e44F0F + Eth: 0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35 + Kovan: 0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21 + +Factory: + xDai: 0x7E370099a7a789dC28810a72381bcd7Be834Ad74 + Eth Dai: 0x5677CFbA35a0Db0469d3d56020d556B942E9ce90 + Eth Native: 0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6 + Kovan Dai: 0xbC69Aff9d93C5EA4a841166C46C68518D02aF818 + Kovan Native: 0xA30773FD520cdf845E1a00441aB09cE39B31F676 \ No newline at end of file diff --git a/docs/404.html b/docs/404.html index 5fcb14a..7cc5c9e 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 5fcb14a..7cc5c9e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/img/aborted.svg b/docs/static/img/aborted.svg new file mode 100644 index 0000000..3f45161 --- /dev/null +++ b/docs/static/img/aborted.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/docs/static/img/burned.svg b/docs/static/img/burned.svg new file mode 100644 index 0000000..b926e87 --- /dev/null +++ b/docs/static/img/burned.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/docs/static/img/chat-icon.svg b/docs/static/img/chat-icon.svg deleted file mode 100644 index 0abecee..0000000 --- a/docs/static/img/chat-icon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/static/img/chat.svg b/docs/static/img/chat.svg new file mode 100644 index 0000000..eadf91a --- /dev/null +++ b/docs/static/img/chat.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/docs/static/img/diamond-give-white.svg b/docs/static/img/diamond-give-white.svg new file mode 100644 index 0000000..696b050 --- /dev/null +++ b/docs/static/img/diamond-give-white.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/docs/static/img/payment-window-icon.svg b/docs/static/img/fiat-bag-white.svg similarity index 100% rename from docs/static/img/payment-window-icon.svg rename to docs/static/img/fiat-bag-white.svg diff --git a/docs/static/img/open-window-white.svg b/docs/static/img/open-window-white.svg new file mode 100644 index 0000000..876cfbd --- /dev/null +++ b/docs/static/img/open-window-white.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/docs/static/img/released.svg b/docs/static/img/released.svg new file mode 100644 index 0000000..178cf53 --- /dev/null +++ b/docs/static/img/released.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/docs/static/img/stop-white.svg b/docs/static/img/stop-white.svg new file mode 100644 index 0000000..14a0d37 --- /dev/null +++ b/docs/static/img/stop-white.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/docs/static/img/time-clock-fire.svg b/docs/static/img/time-clock-fire.svg new file mode 100644 index 0000000..dd57760 --- /dev/null +++ b/docs/static/img/time-clock-fire.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/docs/static/js/main-1a8988b1a444f0e2e0ea.js b/docs/static/js/main-18e4d471fa41020b2b3a.js similarity index 50% rename from docs/static/js/main-1a8988b1a444f0e2e0ea.js rename to docs/static/js/main-18e4d471fa41020b2b3a.js index cb860cf..8bcff9f 100644 --- a/docs/static/js/main-1a8988b1a444f0e2e0ea.js +++ b/docs/static/js/main-18e4d471fa41020b2b3a.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=Tg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?lg(o):fg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Tg(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(dg(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(pg,hg,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(pg,hg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(pg,hg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(pg,hg,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=n(function(e,t,r){return{align:r,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 l(If,t.noticeType,f(nu,nu(Df(e)),t.mainParagraphs),t.align)}),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={$:"BottomRight"},Qp={$:"ShouldBeImpossible"},Xp=function(e){return _f(e)},Zp=r(function(e,t){f(Rl,e,t);return{align:Jp,mainParagraphs:F([F([Xp(e)])]),noticeType:Qp}}),eg={$:"Error"},tg=r(function(e,t){f(Rl,e+" fetch error",t);return{align:Jp,mainParagraphs:F([F([Xp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:eg}}),rg=r(function(e,t){return{align:Jp,mainParagraphs:F([F([Xp('Error mining "'+e+'" transaction: '+t)])]),noticeType:eg}}),ng={$:"Caution"},ag=r(function(e,t){return{align:Jp,mainParagraphs:F([F([Xp('Error signing "'+e+'" transaction: '+t)])]),noticeType:ng}}),ig=r(function(e,t){if("Just"===t.$){return e(t.a)}return Ca}),og=r(function(e,t){return 1-e(1-t)}),ug=function(e){return f(Jo,e,5)},sg=og(ug),cg={easing:sg,offset:12,speed:200},fg=function(e){return{$:"External",a:e}},lg=function(e){return{$:"Internal",a:e}},dg=function(e){return{$:"NotFound",a:e}},hg=function(e){for(;;){e=e.a}},pg=r(function(e,t){return vp(op(f(cp,e,t)))}),gg={$:"Http"},vg={$:"Https"},yg=Hr,mg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),bg=i(function(e,t,r,n,a){if(Dl(a)||f(yg,"@",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(mg,e,f(Eo,o,a),s,t,r,n))}return ba(p(mg,e,a,Ca,t,r,n))}),Cg=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(bg,e,f(bo,i,n),t,r,f(Eo,i,n))}return h(bg,e,"/",t,r,n)}),Sg=n(function(e,t,r){if(Dl(r))return Ca;var n=f(tl,"?",r);if(n.b){var a=n.a;return d(Cg,e,ba(f(bo,a+1,r)),t,f(Eo,a,r))}return d(Cg,e,Ca,t,r)}),Eg=r(function(e,t){if(Dl(t))return Ca;var r=f(tl,"#",t);if(r.b){var n=r.a;return l(Sg,e,ba(f(bo,n+1,t)),f(Eo,n,t))}return l(Sg,e,Ca,t)}),Tg=function(e){return f(ko,"http://",e)?f(Eg,gg,f(bo,7,e)):f(ko,"https://",e)?f(Eg,vg,f(bo,8,e)):Ca},wg=Jt,Ig=zt(Yt),Ag=ca,Bg=r(function(e,t){return L(e,t)}),kg=_r,Ng=a(function(e,t,r,n){var a=_(r,n)>0?Ci:Ya,i=du(r-n),o=f(mi,1,kg(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)}),Rg=r(function(e,t){var n=r(function(t,r){return lp(f(nu,Ag(0),d(Ng,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,Bg,Ig,wg(t)))}),$g=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(Rg,U(cg,{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(ag,"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(tg,"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(ag,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(ed,t,uo,lo,F([Tf(f(rg,"create",B))]))}var M=e.a.a,V=f(ig,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(Zp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',M))]));case"Web3Connect":return d(ed,t,uo,lo,F([wf]));default:return Yp(t)}}),xg=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))]))},_g=function(e){return{$:"TxSentry",a:e}},Lg=r(function(e,t){return Xd(F([L("ref",bh(e)),L("txParams",t)]))}),Pg=function(e){return{$:"Signing",a:e}},Dg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Pg(e)}}),Ug=mn,Og=n(function(e,t,r){var n=e.a,a=xg(r),i=l(Nh,n.ref,f(Dg,r,t),n.txs);return L(_g(U(n,{ref:n.ref+1,txs:i})),f(Ug,n.tagger,n.outPort(f(Lg,n.ref,a))))}),Mg=Og,Fg=r(function(e,t){if("None"===t.$)return L(e,uo);var r=t.a,n=t.b;return l(Mg,e,r,n)}),Vg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Kg=r(function(e,t){if("None"===t.$)return fo;var r=t.a,n=t.b,a=l(Vg,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)}),Hg=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)}},jg=r(function(e,t){return f(fu,Yl(e),Yl(t))}),qg=r(function(e,t){return $(t.state.phase,io)&&$(f(jg,t.derived.phaseEndTime,e),Ka)}),Gg=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))},zg=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))},Yg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),Wg=d(Yg,Ca,Ca,Ca,Ca),Jg=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))}),Qg=function(e){return h(Jg,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(Wg,{minDai:ba(e)})},Gg(e.minDai)),f(zl,function(e){return U(Wg,{maxDai:ba(e)})},Gg(e.maxDai)),f(zl,function(e){return U(Wg,{minFiat:ba(e)})},zg(e.minFiat)),f(zl,function(e){return U(Wg,{maxFiat:ba(e)})},zg(e.maxFiat)))},Xg=r(function(e,t){var r=function(t){return f(Td,function(e){return f(yg,ll(e),ll(t))},e)};return f(Ed,function(e){return r(e.info)},t)}),Zg=r(function(e,t){return U(t,{paymentMethod:e})}),ev=r(function(e,t){return U(t,{paymentMethodTerms:e})}),tv=r(function(e,t){return f(Tu,qf(e),qf(t))}),rv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Za,e.inputs.paymentMethodTerms,F([t]));return nv(U(e,{inputs:f(ev,r,f(Zg,"",e.inputs))}))},nv=function(e){var t=rv(e),n=Qg(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(Xg,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(tv,e.parameters.tradeAmount,r),Oa)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(tv,e.parameters.tradeAmount,r),Ka)}()},s=r(function(e,r){return f(qg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},av={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},iv=r(function(e,t){return f(fu,e.creationInfo.blocknum,t.creationInfo.blocknum)}),ov=n(function(e,t,r){return L(nv({browsingRole:t,errors:Wg,filterFunc:qg,inputs:av,showCurrencyDropdown:!1,sortFunc:iv,userInfo:r,web3Context:e}),uo)}),uv=r(function(e,t){return f(Tu,e.amount,t.amount)}),sv=r(function(e,t){var r=f(th,Gs(e),t.inputs.paymentMethodTerms);return nv(U(t,{inputs:f(ev,r,t.inputs)}))}),cv=function(e){return U(e,{filterFunc:qg,inputs:av,sortFunc:iv})},fv={$:"Ascending"},lv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),dv=function(e){return l(lv,e,uo,mr)},hv=r(function(e,t){return U(t,{fiatType:e})}),pv=r(function(e,t){return U(t,{maxDai:e})}),gv=r(function(e,t){return U(t,{maxFiat:e})}),vv=r(function(e,t){return U(t,{minDai:e})}),yv=r(function(e,t){return U(t,{minFiat:e})}),mv=n(function(e,t,r){return f(e,r,t)}),bv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(lv,U(t,{inputs:f(vv,n,t.inputs)}),uo,mr);case"MaxDaiChanged":var n=e.a;return l(lv,U(t,{inputs:f(pv,n,t.inputs)}),uo,mr);case"MinFiatChanged":var n=e.a;return l(lv,U(t,{inputs:f(yv,n,t.inputs)}),uo,mr);case"MaxFiatChanged":var n=e.a;return l(lv,U(t,{inputs:f(gv,n,t.inputs)}),uo,mr);case"FiatTypeInputChanged":var n=e.a;return l(lv,U(t,{inputs:f(hv,n,t.inputs)}),uo,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(lv,U(t,{inputs:(a?hv(""):no)(t.inputs),showCurrencyDropdown:a}),uo,mr);case"FiatTypeLostFocus":return l(lv,U(t,{showCurrencyDropdown:!1}),uo,mr);case"PaymentMethodInputChanged":var n=e.a;return l(lv,U(t,{inputs:f(Zg,n,t.inputs)}),uo,mr);case"AddSearchTerm":return l(lv,rv(t),uo,mr);case"RemoveTerm":var i=e.a;return l(lv,f(sv,i,t),uo,mr);case"ApplyInputs":return l(lv,nv(t),uo,mr);case"ResetSearch":return l(lv,cv(t),uo,mr);case"TradeClicked":var o=e.a;return l(lv,t,uo,F([po(bf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,fv)?mv:no)(r(function(e,t){switch(u.$){case"Expiring":return f(jg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(tv,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(uv,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(iv,e,t);case"AutoabortWindow":return f(jg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(jg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(lv,U(t,{sortFunc:c}),uo,mr);default:return dv(t)}}),Cv=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}),Sv=function(e){return{$:"AllowanceFetched",a:e}},Ev=function(e){return{$:"Menu",a:e}},Tv={$:"NoneStarted"},wv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Iv=r(function(e,t){var r={state:Ev(Tv),textInput:"",tokenAllowance:Ca,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(Cv,r.web3Context,e,Sv)}return uo}();return d(wv,r,n,lo,mr)}),Av=function(e){return{$:"ApproveSigned",a:e}},Bv=r(function(e,t){var r=Cf(l(fd,id(e),ad(ya(e)),qf(t))),n={onBroadcast:Ca,onMined:Ca,onSign:ba(Av)};return f(yf,n,r)}),kv=function(e){return{$:"OpenMined",a:e}},Nv=function(e){return{$:"OpenSigned",a:e}},Rv=r(function(e,t){var r=Cf(f(Dp,e,t)),n={onBroadcast:Ca,onMined:ba(L(kv,Ca)),onSign:ba(Nv)};return f(yf,n,r)}),$v=function(e){return{$:"ApproveMining",a:e}},xv=function(e){return{$:"ApproveNeedsSig",a:e}},_v={$:"OpenMining"},Lv={$:"OpenNeedsSig"},Pv={$:"ReadyToOpen"},Dv=r(function(e,t){return{$:"Spec",a:e,b:t}}),Uv=function(e){return{$:"StartPrompt",a:e}},Ov=r(function(e,t){return jf(f(xu,qf(e),hu(t)))}),Mv=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Yf,f(Ov,e.daiAmountIn,100*t),100+t)},Fv=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:Mv(t)})}),Vv=function(e){return{appCmds:mr,chainCmd:lo,cmd:uo,model:e}},Kv=function(e){return jf(e)},Hv=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),Sv);return d(wv,t,i,lo,mr)}return Vv(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(tv,r,o.daiAmountIn),Oa)?Ev(Uv(o)):f(Dv,o,Pv)}return Ev(Uv(o))}();return Vv(U(t,{state:u}))}return Vv(U(t,{state:f(Dv,o,Pv)}));case"ApproveClicked":var o=e.a,s=t.web3Context.factoryType;if("Token"===s.$){var a=s.a,c=f(Bv,a,o.daiAmountIn);return d(wv,U(t,{state:Ev(xv(o))}),uo,c,mr)}return d(wv,t,uo,lo,F([Tf(f(Zp,"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 Vv(U(t,{state:f(Dv,o,$v(v))}))}return d(wv,t,uo,lo,F([Tf(f(Zp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(wv,t,uo,lo,F([Tf(f(ag,"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 Vv($(f(Tu,C,qf(o.daiAmountIn)),Oa)?U(t,{tokenAllowance:ba(Kv(C))}):U(t,{state:f(Dv,o,Pv),tokenAllowance:ba(Kv(C))}))}return Vv(t)}var E=b.a.a;return d(wv,t,uo,lo,F([Tf(f(tg,"token allowance",E))]));case"OpenClicked":var n=e.a,T=e.b,w=l(Fv,n,T,t.textInput),c=f(Rv,t.web3Context.factoryType,w);return d(wv,U(t,{state:f(Dv,T,Lv)}),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 Vv(U(t,{state:f(Dv,w,_v)}))}return d(wv,t,uo,lo,F([Tf(f(Zp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(wv,t,uo,lo,F([Tf(f(ag,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ig,Wp,Ql(f(nh,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(wv,t,uo,lo,F([po(bf(R))]))}return d(wv,t,uo,lo,F([Tf(f(Zp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',k))]))}var y=B.a;return d(wv,t,uo,lo,F([Tf(f(rg,"Open trade",y))]));case"TextInputChanged":var x=e.a;return Vv(U(t,{textInput:x}));case"ChangeState":var u=e.a;return Vv(U(t,{state:u}));case"AbortCreate":return Vv(U(t,{state:Ev(Tv)}));case"NoOp":return Vv(t);default:return d(wv,t,uo,lo,F([wf]))}}),jv=function(e){return"Buyer"===e.$?"buyer":"seller"},qv=function(e){return e.a+"="+e.b},Gv=function(e){return e.b?"?"+f(zi,"&",f(nu,qv,e)):""},zv=r(function(e,t){return"/"+(f(zi,"/",e)+Gv(t))}),Yv=function(e){switch(e.$){case"Home":return f(zv,F(["DAIHard"]),mr);case"QuickCreate":return f(zv,F(["DAIHard","quickcreate"]),mr);case"Create":return f(zv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a;return f(zv,F(["DAIHard","trade",Gi(t)]),mr);case"Marketplace":var r=e.a;return f(zv,F(["DAIHard","marketplace",jv(r)]),mr);case"AgentHistory":var n=e.a,r=e.b;return f(zv,F(["DAIHard","history",eh(n),function(){return"Buyer"===r.$?"buyer":"seller"}()]),mr);default:return f(zv,mr,mr)}},Wv={$:"NotFound"},Jv={$:"Create"},Qv={$:"Home"},Xv=function(e){return{$:"Marketplace",a:e}},Zv={$:"QuickCreate"},ey=function(e){return{$:"Parser",a:e}},ty=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),ry=r(function(e,t){return ey(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(ty,f(za,u,r),s,a,i,o(l))])}return mr}return mr})}),ny=f(ry,"ADDRESS",f(_a,Ud,Ql)),ay={$:"Buyer"},iy=f(ry,"BUYERORSELLER",function(e){switch(e){case"buyer":return ba(ay);case"seller":return ba(Ff);default:return Ca}}),oy=f(ry,"NUMBER",il),uy=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(ty,r,n,a,i,e(o))}),sy=r(function(e,t){var r=t.a;return ey(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(nu,uy(u),r(h(ty,n,a,i,o,e)))})}),cy=function(e){return l(Xa,Za,mr,e)},fy=r(function(e,t){return cy(f(nu,e,t))}),ly=function(e){return ey(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(ty,f(za,u,r),s,a,i,o)]):mr}return mr})},dy=r(function(e,t){var r=e.a,n=t.a;return ey(function(e){return f(fy,n,r(e))})}),hy=ey(function(e){return F([e])}),py=f(dy,ly("DAIHard"),function(e){return ey(function(t){return f(fy,function(e){return(0,e.a)(t)},e)})}(F([f(sy,Qv,hy),f(sy,Zv,ly("quickcreate")),f(sy,Jv,ly("create")),f(sy,bf,f(dy,ly("trade"),oy)),f(sy,Xv,f(dy,ly("marketplace"),iy)),f(sy,mf,f(dy,ly("history"),f(dy,ny,iy))),f(sy,function(e){return f(mf,e,Ff)},f(dy,ly("history"),ny))]))),gy=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}},vy=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(za,t,vy(r))}return mr}return mr},yy=function(e){var t=f(Wi,"/",e);if(t.b&&""===t.a){var r=t.b;return vy(r)}var r=t;return vy(r)},my=Xt,by=r(function(e,t){if("Nothing"===t.$)return ba(F([e]));var r=t.a;return ba(f(za,e,r))}),Cy=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=my(n);if("Nothing"===o.$)return t;var u=o.a,s=my(i);if("Nothing"===s.$)return t;var c=s.a;return l(Oh,u,by(c),t)}return t}),Sy=function(e){if("Nothing"===e.$)return Eh;var t=e.a;return l(Xa,Cy,Eh,f(Wi,"&",t))},Ey=r(function(e,t){var r=e.a;return gy(r(h(ty,mr,yy(t.path),Sy(t.query),t.fragment,no)))}),Ty=function(e){return f(rc,Wv,f(Ey,py,e))},wy=ia,Iy=r(function(e,t){return f(wy,e,Yv(t))}),Ay=qe("connectToWeb3",function(e){return ch}),By=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))]))},ky=r(function(e,t){return Xd(F([L("address",Yd(eh(e))),L("signSeedMsg",Yd(t))]))}),Ny=qe("gTagOut",no),Ry=qe("genPrivkey",no),$y=r(function(e,t){return U(t,{userInfo:e})}),xy=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}())}),_y=r(function(e,t){return U(t,{userInfo:e})}),Ly=r(function(e,t){return L(U(t,{userInfo:e}),function(){if("Just"===e.$){var r=e.a;return l(Cv,t.web3Context,r,Sv)}return uo}())}),Py=function(e){return{$:"AllowanceFetched",a:e}},Dy=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,Py)}return uo}())}),Uy=function(e){return{$:"AgentHistoryModel",a:e}},Oy=function(e){return{$:"CreateModel",a:e}},My=function(e){return{$:"CreateMsg",a:e}},Fy=function(e){return{$:"MarketplaceModel",a:e}},Vy=function(e){return{$:"QuickCreateModel",a:e}},Ky=function(e){return{$:"QuickCreateMsg",a:e}},Hy=function(e){return{$:"TradeModel",a:e}},jy=function(e){return{$:"TradeMsg",a:e}},qy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,uo);case"CreateModel":var r=t.a,n=f(xy,e,r),a=n.a,i=n.b;return L(Oy(a),f(Ug,My,i));case"QuickCreateModel":var o=t.a,u=f(Ly,e,o),s=u.a,c=u.b;return L(Vy(s),f(Ug,Ky,c));case"TradeModel":var l=t.a,d=f(Dy,e,l),h=d.a,p=d.b;return L(Hy(h),f(Ug,jy,p));case"MarketplaceModel":var g=t.a;return L(Fy(f(_y,e,g)),uo);default:var v=t.a;return L(Uy(f($y,e,v)),uo)}}),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){return U(t,{web3Context:e})}),Jy=r(function(e,t){switch(t.$){case"BetaLandingPage":return P(t,uo,Ca);case"CreateModel":var r=t.a;return P(Oy(f(zy,e,r)),uo,Ca);case"QuickCreateModel":var n=t.a;return P(Vy(f(Wy,e,n)),uo,Ca);case"TradeModel":t.a;return P(t,uo,ba(Xv(ay)));case"MarketplaceModel":var a=t.a;return P(Fy(f(Yy,e,a)),uo,Ca);default:var i=t.a;return P(Uy(f(Gy,e,i)),uo,Ca)}}),Qy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Xy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Zy=function(e){return Xy(p(Qy,e,Ca,Ca,Ca,Ca,Ca))},em=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),tm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},rm=tm(f(em,Ca,Ca)),nm=r(function(e,t){return{address_:e,blocknum:t}}),am=function(e){return go(function(t){return Bi(L(t,e))})},im=r(function(e,t){return L(t.a,e(t.b))}),om=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,im(e(n)),a(r))},n(t))})}),um=r(function(e,t){return l(om,r(function(e,t){return e(t)}),t,e)}),sm=Uo(f(um,Gd,f(um,Od,am(nm)))),cm=r(function(e,t){return{data:ba(f(pf,"createdTrades(uint256)",F([cd(t)]))),decoder:sm,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}}),fm=n(function(e,t,r){return f(mp,r,f(ip,e.httpProvider,f(cm,ad(e.factoryType),t)))}),lm=function(e){return{$:"CreationInfoFetched",a:e}},dm=r(function(e,t){return l(fm,e,hu(t),lm)}),hm=function(e){return{$:"EventSentryMsg",a:e}},pm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),gm=Do(f(_a,No,$d)),vm=function(e){return rp({decoder:gm,method:"eth_blockNumber",params:mr,url:e})},ym=function(e){return{$:"BlockNumber",a:e}},mm=function(e){return{$:"EventSentry",a:e}},bm=function(e){return{$:"Set_elm_builtin",a:e}},Cm=bm(Eh),Sm=r(function(e,t){return L(mm({blockNumber:Ca,errors:mr,nodePath:t,pending:Cm,ref:1,requests:Eh,tagger:e,watching:Cm}),f(mp,f(_a,ym,e),vm(t)))}),Em=n(function(e,t,r){var n=f(dm,e,r),a=f(Sm,hm,e.httpProvider),i=a.a,o=a.b;return d(pm,{allowance:Ca,chatHistoryModel:Ca,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:io,secureCommInfo:rm,showChatHistory:!1,showStatsModal:!1,trade:Zy(r),txChainStatus:Ca,userInfo:t,web3Context:e},oo(F([n,o])),lo,mr)}),Tm=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}},wm=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}},Im=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}},Am=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}}),Bm=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}},km=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}},Nm=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}}),Rm=r(function(e,t){return{amount:t,fiatType:e}}),$m=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),xm=l(kf,Rm,f(Kd,0,Lo),f(Kd,1,$m)),_m={$:"Bank"},Lm={$:"Cash"},Pm=function(e){switch(e){case"cash":return ba(Lm);case"bank":return ba(_m);case"custom":return ba(jl);default:return Ca}},Dm=f(xo,function(e){var t=Pm(e);if("Just"===t.$){var r=t.a;return Po(r)}return _o("")},Lo),Um=l(kf,ql,f(Fd,"type",Dm),f(Fd,"info",Lo)),Om=ue,Mm=function(e){var t=l(kf,Bp,f(Fd,"price",xm),f(Fd,"paymentmethods",Om(Um)));return f(yh,t,e)},Fm=r(function(e,t){return{commPubkey:t,responder:e}}),Vm=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))}),Km=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))}),Hm=n(function(e,t,r){var n=l(Wa,Km(e),P(0,0,t),r);if(n.b)return Ai("invalid UTF-8 sequence");var a=n.c;return Bi(a)}),jm=q,qm=function(e){return Yu(jm(e))},Gm=function(e){return l(Hm,r(function(e,t){return O(t,qm(e))}),"",e)},zm=go(function(e){var t=e.a,r=e.b;return f(wo,f(So,t,r),f(rh,Gm,f(rh,f(_a,nu($d),kd),f(wo,th(f(_a,Dl,Iu)),f(wo,Ts(2),f(Vm,t,To(r)))))))}),Ym=f(pd,f(Vd,1,zm),f(pd,f(Vd,0,Od),Po(Fm))),Wm=r(function(e,t){return{commPubkey:t,terms:e}}),Jm=f(pd,f(Vd,1,zm),f(pd,f(Vd,0,zm),Po(Wm))),Qm=function(e){return{statement:e}},Xm=f(pd,f(Vd,0,zm),Po(Qm)),Zm=function(e){return{statement:e}},eb=f(pd,f(Vd,0,zm),Po(Zm)),tb={$:"AbortedEvent"},rb={$:"BurnedEvent"},nb={$:"ClaimedEvent"},ab=function(e){return{$:"CommittedEvent",a:e}},ib=function(e){return{$:"InitiatedEvent",a:e}},ob=function(e){return{$:"InitiatorStatementLogEvent",a:e}},ub={$:"PokeEvent"},sb={$:"RecalledEvent"},cb={$:"ReleasedEvent"},fb=function(e){return{$:"ResponderStatementLogEvent",a:e}},lb=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),db=function(e){return lb(e)?Bi(Is(No(e))):Ai("Something in here is not very hexy: "+Dd(e))},hb=Do(db),pb=f(Fd,"topics",f(Kd,0,hb)),gb=function(e){return Is(f(zi,"",f(nu,f(_a,ns,Ns),ff(f(nu,Li,Ss(e))))))},vb=f(xo,function(e){return $(e,gb("Initiated(string,string)"))?f(Bf,ib,Jm):$(e,gb("Committed(address,string)"))?f(Bf,ab,Ym):$(e,gb("Recalled()"))?Po(sb):$(e,gb("Claimed()"))?Po(nb):$(e,gb("Aborted()"))?Po(tb):$(e,gb("Released()"))?Po(cb):$(e,gb("Burned()"))?Po(rb):$(e,gb("InitiatorStatementLog(string)"))?f(Bf,ob,Xm):$(e,gb("ResponderStatementLog(string)"))?f(Bf,fb,eb):$(e,gb("Poke()"))?Po(ub):_o("Unrecognized topic hash")},pb),yb={$:"Initiator"},mb={$:"Responder"},bb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ba(yb):f(ig,function(e){return $(t,e)?ba(mb):Ca},e.state.responder)}),Cb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Sb=function(e){return $(e.buyerDeposit,Jf(e.tradeAmount))&&$(e.abortPunishment,Wf(e.tradeAmount))},Eb={$:"Invalid"},Tb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),wb=function(e){return{$:"LoadedTrade",a:e}},Ib=r(function(e,t){return Kf(Yl(t)+Yl(e))}),Ab=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},Bb=r(function(e,t){return(t-e)/e}),kb=r(function(e,t){var r=Ab(t),n=xl(e);return"USD"===t.fiatType?ba(f(Bb,n,r)):Ca}),Nb=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(kb,e.tradeAmount,r.price),phaseEndTime:f(Ib,t.phaseStartTime,n)}}),Rb=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 wb(g(Tb,e.id,n,a,o,u,s,l(Nb,a,o,u)))}return Xy(e)},$b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Rb(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 Eb}}),xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Rb(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 Eb}}),_b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Rb(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 Eb}}),Lb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Rb(U(r,{state:ba(e)}));case"LoadedTrade":var n=t.a;return wb(U(n,{state:e}));default:return Eb}}),Pb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Rb(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 Eb}}),Db=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}}),Ub=Uo(f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Bo,f(um,Od,am(Db))))))))))),Ob=function(e){return{data:ba(f(pf,"getParameters()",mr)),decoder:Ub,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Mb=function(e){return f(Gf,function(e){return Kf(1e3*e)},il(Il(e)))},Fb=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))}),Vb=function(e){var t=f(Pl,"error converting BigInt to Time.Posix",Mb(e.autoabortInterval)),r=f(Pl,"error converting BigInt to Time.Posix",Mb(e.autoreleaseInterval)),a=f(Pl,"error converting BigInt to Time.Posix",Mb(e.autorecallInterval));return d(Fb,n(function(t,r,n){return{abortPunishment:Kv(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Kv(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatorIsCustodian?Ff:ay,pokeReward:Kv(e.pokeReward),tradeAmount:Kv(e.tradeAmount)}}),a,t,r)},Kb=n(function(e,t,r){return f(mp,r,f(cp,Vb,f(ip,e.httpProvider,Ob(t))))}),Hb=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}}}}}}}}}}},jb=Uo(f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,f(um,Gd,am(Hb)))))))))))),qb=function(e){return{data:ba(f(pf,"getPhaseStartInfo()",mr)),decoder:jb,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Gb=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))}),zb=function(e){return h(Gb,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}}),Mb(e.v6),Mb(e.v7),Mb(e.v8),Mb(e.v9))},Yb=n(function(e,t,r){return f(mp,r,f(cp,zb,f(ip,e.httpProvider,qb(t))))}),Wb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Jb=Uo(f(um,Gd,f(um,Od,f(um,Gd,f(um,Gd,f(um,Gd,am(Wb))))))),Qb=function(e){return{data:ba(f(pf,"getState()",mr)),decoder:Jb,from:Ca,gas:Ca,gasPrice:Ca,nonce:Ca,to:ba(e),value:Ca}},Xb={$:"Aborted"},Zb={$:"Burned"},eC={$:"NotClosed"},tC={$:"Recalled"},rC={$:"Released"},nC=function(e){switch(f(rc,99,il(Il(e)))){case 0:return ba(eC);case 1:return ba(tC);case 2:return ba(Xb);case 3:return ba(rC);case 4:return ba(Zb);default:return Ca}},aC={$:"Closed"},iC={$:"Committed"},oC={$:"Judgment"},uC=function(e){switch(f(rc,99,il(Il(e)))){case 1:return ba(io);case 2:return ba(iC);case 3:return ba(oC);case 4:return ba(aC);default:return Ca}},sC=function(e){return $(e,nd("0x0000000000000000000000000000000000000000"))?Ca:ba(e)},cC=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))}),fC=function(e){var t=Mb(e.phaseStartTimestamp),r=uC(e.phase),a=nC(e.closedReason);return d(cC,n(function(t,r,n){return{balance:Kv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:sC(e.responder)}}),r,t,a)},lC=n(function(e,t,r){return f(mp,r,f(cp,fC,f(ip,e.httpProvider,Qb(t))))}),dC=i(function(e,t,r,n,a){return oo(F([l(Kb,e,t,r),l(lC,e,t,n),l(Yb,e,t,a)]))}),hC=function(e){var t=Wp(e);if("Just"===t.$){return t.a}f(Rl,"Warning! BigInt to Int conversion failed!",Il(e));return 0},pC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),gC=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}}),vC=function(e){return e.b?l(gC,e,mr,0):si},yC=rn,mC=function(e){var t=h(yC,pC,f(Fd,"encapsulation",Lo),f(Fd,"iv",Lo),f(Fd,"tag",Lo),f(Fd,"encrypted",Lo)),r=Om(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.")}(vC(i))},bC=function(e){var t=function(e){var t=yo(e);return t>1114111?Ai("string is too long"):Bi(f(zu,jm(t),e))};return f(wo,zi(""),kd(f(nu,t,e)))},CC=function(e){var t=e.a,r=e.b;return bC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},SC=r(function(e,t){return Xd(F([L("message",Yd(e)),L("pubkeyHexStrings",f(Qd,Yd,F([t.initiatorPubkey,t.responderPubkey])))]))}),EC=function(e){return{$:"LoadedCommInfo",a:e}},TC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),wC=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 EC(f(TC,r,n))}return tm(e)},IC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return wC(U(r,{initiatorPubkey:ba(e)}))}var n=t.a;return EC(U(n,{initiatorPubkey:e}))}),AC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return wC(U(r,{responderPubkey:ba(e)}))}var n=t.a;return EC(U(n,{responderPubkey:e}))}),BC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return ay}r.a,r.b;return Ff}if("Buyer"===r.b.$){r.a,r.b;return Ff}r.a,r.b;return ay}),kC=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}}),NC=function(e){var t=vC(f(kC,Ss(e),mr));return l(Jl,Bg,h(Gb,pC,f(Sc,0,t),f(Sc,1,t),f(Sc,2,t),f(Sc,3,t)),h(Gb,pC,f(Sc,4,t),f(Sc,5,t),f(Sc,6,t),f(Sc,7,t)))},RC={$:"Aborted"},$C={$:"Burned"},xC={$:"Claimed"},_C=function(e){return{$:"Committed",a:e}},LC=function(e){return{$:"Encrypted",a:e}},PC={$:"FailedDecode"},DC={$:"Initiated"},UC={$:"Recalled"},OC={$:"Released"},MC=function(e){return{$:"StateChange",a:e}},FC=function(e){return{$:"Statement",a:e}},VC=lr,KC=fr,HC=r(function(e,t){var r=Si(e),n=32-Si(t.tail)-r,a=l(VC,32,t.tail,e);return n<0?{nodeList:f(za,ci(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(KC,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}}),jC=ur,qC=y,GC=a(function(e,t,r,n){var a=yc&t>>>e;if(_(a,Si(n))>-1){if(5===e)return f(jC,ci(r),n);var i=fi(d(GC,e-oi,t,r,ui));return f(jC,i,n)}var o=f(mc,a,n);if("SubTree"===o.$){var u=o.a,i=fi(d(GC,e-oi,t,r,u));return l(wc,a,i,n)}var i=fi(d(GC,e-oi,t,r,qC(o)));return l(wc,a,i,n)}),zC=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(GC,c,r,e,qC(fi(a)));return d(ri,s,c,f,ui)}return d(ri,s,n,d(GC,n,r,e,a),ui)}return d(ri,s,n,a,e)}),YC=r(function(e,t){var r=(t.a,t.c,t.d),n=Si(e),a=32-Si(r)-n,i=l(VC,32,r,e),o=f(zC,i,t);if(a<0){var u=l(KC,a,n,e);return f(zC,u,o)}return o}),WC=sr,JC=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(WC,i,t,r)}return f(za,e,t)});return{nodeList:l(WC,i,mr,n),nodeListSize:t/32|0,tail:a}},QC=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(WC,o,t,r)}var n=e.a;return f(YC,n,t)});return f(YC,i,l(WC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(WC,o,t,r)}var n=e.a;return f(HC,n,t)});return f(Ei,!0,f(HC,i,l(WC,o,JC(e),a)))}),XC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(za,r,t)}),ZC=f(Xa,XC,mr),eS=n(function(e,t,r){var n=BC(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ba(MC(DC));case"CommittedEvent":var r=t.a;return ba(MC(_C(r.responder)));case"RecalledEvent":return ba(MC(UC));case"ClaimedEvent":return ba(MC(xC));case"AbortedEvent":return ba(MC(RC));case"ReleasedEvent":return ba(MC(OC));case"BurnedEvent":return ba(MC($C));case"InitiatorStatementLogEvent":var r=t.a;return ba(FC({blocknum:e,message:function(){var e=NC(r.statement);if("Just"===e.$){var t=e.a;return LC(t)}return PC}(),who:n(yb)}));case"ResponderStatementLogEvent":var r=t.a;return ba(FC({blocknum:e,message:function(){var e=NC(r.statement);if("Just"===e.$){var t=e.a;return LC(t)}return PC}(),who:n(mb)}));default:return Ca}}(),i=f(Gf,function(t){return{blocknum:e,eventInfo:t,time:Ca}},a);return L(U(r,{history:f(QC,r.history,vC(ZC(F([i]))))}),function(){return"Just"===a.$&&"Statement"===a.a.$}())}),tS=zr,rS=function(e){var t=l(kf,Bg,f(Fd,"id",tS),f(Fd,"message",Lo));return f(zl,Zi,f(Jd,t,e))},nS=function(e){return{$:"Decrypted",a:e}},aS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),iS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(eS,n,a,t),o=i.a,u=i.b;return d(aS,o,u,Ca,mr);case"MessageInputChanged":var s=e.a;return d(aS,U(t,{messageInput:s}),!1,Ca,mr);case"MessageSubmit":return d(aS,U(t,{messageInput:""}),!1,ba(t.messageInput),mr);default:var c=e.a,h=rS(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:nS(v)}),E=U(m,{eventInfo:FC(S)}),T=l(Ac,g,E,t.history);return d(aS,U(t,{history:T}),!1,Ca,mr)}return d(aS,t,!1,Ca,F([Tf(f(Zp,"got a decryption result, but for an event that is not a message!",m))]))}return d(aS,t,!1,Ca,F([Tf(f(Zp,"got a decryption result, but for an id out of bounds!",L(g,t.history)))]))}var w=h.a;return d(aS,t,!1,Ca,F([Tf(f(Zp,"Error decoding decryption result",w))]))}}),oS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),uS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),sS=function(e){return{onBroadcast:Ca,onMined:ba(L(oS(e),Ca)),onSign:ba(uS(e))}},cS=qe("encryptToPubkeys",no),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=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}}),dS=function(e){return{$:"CommitMined",a:e}},hS={$:"CommitNeedsSig"},pS=function(e){return{$:"CommitSigned",a:e}},gS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?lS:fS}(),i=Cf(function(){return"Token"===e.factoryType.$?no:_p(qf(Cb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ba(hS),f(yf,{onBroadcast:Ca,onMined:ba(L(dS,Ca)),onSign:ba(pS)},i))}),vS=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))]))}),yS=qe("decryptMessage",no),mS=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},bS=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 yS(f(vS,r,s))}return uo}return uo},mS(e.history)))}),CS=function(e){if("Just"===e.$){return e.a}return Ca},SS=function(e){var t=CS(l(Jl,bb,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(bS,n,a)}return uo},ES=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 ay}if("Seller"===r.b.$){r.a,r.b;return ay}r.a,r.b;return Ff},f(bb,e,t))}),TS=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(eS,i,o,r),c=s.a,f=s.b,d=u,h=L(c,n||f);e=d,t=h}}),e,L(t,!1))}),wS=o(function(e,t,r,n,a,i){return{history:a,initiatorRole:n,messageInput:i,userInfo:t,userRole:r,web3Context:e}}),IS=i(function(e,t,r,n,a){return f(TS,a,p(wS,e,t,r,n,si,""))}),AS=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(ES,i,o.address);if("Just"===u.$){var s=u.a;return f(Zo,ba,h(IS,e,o,s,i.parameters.initiatorRole,n))}return L(Ca,!1)}return L(Ca,!1)}),BS={$:"Abort"},kS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),NS=function(e){return{$:"ActionNeedsSig",a:e}},RS=function(e){return{$:"ApproveMining",a:e}},$S={$:"ApproveNeedsSig"},xS=function(e){return{$:"ApproveSigned",a:e}},_S={$:"Burn"},LS=function(e){return{$:"ChatHistoryMsg",a:e}},PS={$:"Claim"},DS=function(e){return{$:"CommitMining",a:e}},US=function(e){return{$:"ConfirmingAction",a:e}},OS=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),MS=function(e){return{$:"EventLogFetched",a:e}},FS=function(e){return{$:"ParametersFetched",a:e}},VS=function(e){return{$:"PhaseInfoFetched",a:e}},KS={$:"Poke"},HS={$:"Recall"},jS={$:"Release"},qS=function(e){return{$:"StartContractAction",a:e}},GS=function(e){return{$:"StateFetched",a:e}},zS=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"}},YS=function(e){return d(pm,e,uo,lo,mr)},WS={align:Jp,mainParagraphs:F([F([Xp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:eg},JS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(tg,e,r)}if("Nothing"===t.a.$){t.a;return f(Zp,"Couldn't decode the fetched \""+e+'" result.',Ca)}return f(Zp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),QS={align:Jp,mainParagraphs:F([F([Xp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:eg},XS=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),ZS=n(function(e,t,r){return l(Oh,e,Gf(function(e){return U(e,{logCount:Fi(t)+e.logCount})}),r)}),eE=r(function(e,t){var r=t.a;return bm(f(Uh,e,r))}),tE=n(function(e,t,r){var n=e.a,a=f(Th,t,n.requests);if("Nothing"===a.$)return L(mm(n),uo);var i=a.a,o=L(i.watchOnce,el(r));if("Nothing"===o.b.$){o.b;return L(mm(U(n,{requests:l(ZS,t,r,n.requests)})),uo)}if(o.a){var u=o.b.a;return L(mm(U(n,{requests:l(ZS,t,r,n.requests),watching:f(eE,t,n.watching)})),f(pg,i.tagger,Zh(u)))}return L(mm(U(n,{requests:l(ZS,t,r,n.requests)})),oo(f(nu,function(e){return f(pg,i.tagger,Zh(e))},r)))}),rE=_e,nE=r(function(e,t){return f(mp,f(_a,ym,t),f(up,function(t){return vm(e)},rE(2e3)))}),aE=se,iE=fe,oE=n(function(e,t,r){var n=function(e){return iE(F([e,aE(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)}),uE=a(function(e,t,r,n){return f(pd,l(oE,f(Fd,e,to),t,r),n)}),sE=n(function(e,t,r){return f(pd,f(Fd,e,t),r)}),cE=Do(Ud),fE=yd(f(rc,Cd,bd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),lE=function(e){return{$:"BlockHash",a:e}},dE=function(e){return fE(e)?Bi(lE(No(e))):Ai("Given blockHash "+Dd(e)+" is not valid.")},hE=Do(dE),pE=function(e){return{$:"TxHash",a:e}},gE=function(e){return fE(e)?Bi(pE(No(e))):Ai("Given txHash "+Dd(e)+" is not valid.")},vE=Do(gE),yE=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}}),mE=Yr,bE=l(sE,"blockNumber",gm,l(sE,"blockHash",hE,l(sE,"transactionHash",vE,l(sE,"transactionIndex",gm,l(sE,"logIndex",gm,d(uE,"removed",mE,!1,l(sE,"topics",Om(hb),l(sE,"data",Lo,l(sE,"address",cE,Po(yE)))))))))),CE=function(e){return f(Qd,function(e){if("Just"===e.$){var t=e.a;return Yd(hf(t))}return ch},e)},SE=function(e){return Xd(F([L("fromBlock",ih(e.fromBlock)),L("toBlock",ih(e.toBlock)),L("address",oh(e.address)),L("topics",CE(e.topics))]))},EE=r(function(e,t){return rp({decoder:Om(bE),method:"eth_getLogs",params:F([SE(t)]),url:e})}),TE=function(e){return{$:"BlockNum",a:e}},wE=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(EE,e,U(t,{fromBlock:TE(n),toBlock:TE(a)})))},f(EE,e,t)):f(EE,e,t)}),IE=n(function(e,t,r){var n=r.a,a=r.b;return f(EE,e,U(t,{fromBlock:TE(n),toBlock:TE(a)}))}),AE=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(AE,e,t,i)),c=o;e=u,t=s,r=c}}),BE=r(function(e,t){return l(AE,Nh,t,e)}),kE=r(function(e,t){var r=e.a,n=t.a;return bm(f(BE,r,n))}),NE=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,XS(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},ZC(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(mm(U(r,{blockNumber:ba(a)})),oo(F([f(nE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,IE)]))):L(t,f(nE,r.nodePath,r.tagger))}return L(mm(U(r,{blockNumber:ba(a),pending:Cm,watching:f(kE,r.watching,r.pending)})),oo(F([f(nE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,wE),l(i,L(a,a),r.watching,IE)])))}var s=e.a.a;return L(mm(U(r,{errors:f(za,s,r.errors)})),f(nE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(tE,t,c,d)}var s=e.b.a;return L(mm(U(r,{errors:f(za,s,r.errors)})),uo)}),RE=r(function(e,t){var r=t.a;return bm(l(Nh,e,vr,r))}),$E=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(mm(U(o,{watching:f(RE,a.ref,o.watching)})),f(mp,f(_a,XS(a.ref),a.tagger),e),a.ref)}(l(wE,a.nodePath,n,L(s,s)))}return P(mm(U(o,{pending:f(RE,a.ref,o.pending)})),uo,a.ref)}),xE=$E(!1),_E=function(e){return F([e])},LE=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(dm,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,Py)}return uo}(),a=function(){return"Nothing"===t.chatHistoryModel.$?d(AS,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?SS(t):uo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(pm,u,oo(F([l(lC,t.web3Context,p.creationInfo.address,GS),s,r,n])),lo,mr)}return YS(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(Cb(m.parameters))),Oa))return YS(u);var C=d(gS,t.web3Context,m,b.address,b.commPubkey),S=C.a,E=C.b;return d(pm,U(u,{txChainStatus:S}),uo,E,mr)}return YS(u)}var T=g.a;return d(pm,t,uo,lo,F([Tf(f(tg,"allowance",T))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var w=g.a,I={address:w.address_,blocknum:hC(w.blocknum)},A=l(xE,MS,t.eventSentry,{address:I.address,fromBlock:TE(I.blocknum),toBlock:ap,topics:mr}),B=A.a,k=A.b,u=U(t,{eventSentry:B,trade:f($b,I,t.trade)}),N=oo(F([k,h(dC,u.web3Context,I.address,FS,GS,VS)]));return d(pm,u,N,lo,mr)}if("BadBody"===g.a.$){g.a.a;return d(pm,t,uo,lo,F([Tf(WS)]))}var T=g.a;return d(pm,t,uo,lo,F([Tf(f(tg,"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(Lb,R,t.trade)});return d(pm,u,SS(u),lo,mr)}return d(pm,t,uo,lo,F([Tf(f(JS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var _=g.a.a;if(Sb(_)){var u=U(t,{trade:f(xb,_,t.trade)});return d(pm,u,SS(u),lo,mr)}return d(pm,t,uo,lo,F([Tf(QS)]))}var D=g.a.a;return d(pm,t,uo,lo,F([Tf(f(Zp,"Error decoding fetched trade parameters",D))]))}var M=g.a;return d(pm,t,uo,lo,F([Tf(f(tg,"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(_b,V,t.trade)});return d(pm,u,SS(u),lo,mr)}return d(pm,t,uo,lo,F([Tf(f(JS,"trade state",g))]));case"EventLogFetched":var K=e.a,H=f(Zd,vb,K),j=H.returnData;if("Err"===j.$){var q=j.a;return d(pm,t,uo,lo,F([Tf(f(Zp,"Error decoding contract event",q))]))}var G=j.a,z=function(){switch(G.$){case"InitiatedEvent":var e=G.a;return f(IC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=G.a;return f(AC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),Y=function(){if("InitiatedEvent"===G.$){var e=G.a,r=Mm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(Pb,n,t.trade),Ca)}var a=r.a;return L(t.trade,ba(f(Zp,"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(eS,H.blockNumber,G,r))}return d(AS,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?SS(u):uo;return d(pm,u,N,lo,f(nu,Tf,ZC(F([J]))));case"ExpandPhase":var Z=e.a;return YS(U(t,{expandedPhase:Z}));case"ToggleChat":var ee=!t.showChatHistory;return YS(U(t,{showChatHistory:ee}));case"ToggleStatsModal":var te=!t.showStatsModal;return YS(U(t,{showStatsModal:te}));case"ViewUserHistory":var re=e.a,ne=t.trade;if("LoadedTrade"===ne.$){var m=ne.a;return d(pm,t,uo,lo,F([po(f(mf,m.parameters.initiatorAddress,re))]))}return d(pm,t,uo,lo,F([Tf(f(Zp,"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 YS(U(t,{txChainStatus:ba(l(OS,m,b,ae))}));case"AbortAction":return YS(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(gS,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(xS)};return f(yf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Tu,i,qf(Cb(m.parameters))),Oa)?L(ba($S),n):d(gS,t.web3Context,m,b.address,b.commPubkey)}return L(ba($S),n)}(),S=ie.a,E=ie.b;return d(pm,U(t,{txChainStatus:S}),uo,E,mr);case"ContractActionClicked":var oe=e.a;if($(oe,KS)||$(oe,HS)){var ue=qS(oe),se=t;e=ue,t=se;continue e}return YS(U(t,{txChainStatus:ba(US(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(Zp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(ce.$){case"Recall":var a=Cf(Bm(n.creationInfo.address));return P(ba(NS(HS)),f(yf,sS(HS),a),mr);case"Claim":var a=Cf(Im(n.creationInfo.address));return P(ba(NS(PS)),f(yf,sS(PS),a),mr);case"Abort":var a=Cf(Tm(n.creationInfo.address));return P(ba(NS(BS)),f(yf,sS(BS),a),mr);case"Release":var a=Cf(km(n.creationInfo.address));return P(ba(NS(jS)),f(yf,sS(jS),a),mr);case"Burn":var a=Cf(wm(n.creationInfo.address));return P(ba(NS(_S)),f(yf,sS(_S),a),mr);default:var a=Cf(gf(n.creationInfo.address));return P(ba(NS(KS)),f(yf,sS(KS),a),mr)}}(),S=fe.a,E=fe.b,le=fe.c;return d(pm,U(t,{txChainStatus:S}),uo,E,le);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return YS(U(t,{txChainStatus:ba(RS(he))}))}var D=de.a;return d(pm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ag,"approve",D))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return YS(U(t,{txChainStatus:ba(DS(he))}))}var D=de.a;return d(pm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ag,"commit",D))]));case"CommitMined":return YS(U(t,{txChainStatus:Ca}));case"ActionSigned":var oe=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return YS(U(t,{txChainStatus:ba(f(kS,oe,he))}))}var D=de.a;return d(pm,U(t,{txChainStatus:Ca}),uo,lo,F([Tf(f(ag,zS(oe),D))]));case"ActionMined":var oe=e.a;return YS(U(t,{txChainStatus:Ca}));case"EventSentryMsg":var pe=e.a,ge=f(NE,pe,t.eventSentry),ve=ge.a,N=ge.b;return d(pm,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(iS,ye,be),Se=U(t,{chatHistoryModel:ba(Ce.model)}),s=Ce.shouldCallDecrypt?SS(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(cS(f(SC,r,a)),Ca)}return L(uo,ba(f(Zp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(uo,Ca)}(),Te=Ee.a,we=Ee.b;return d(pm,Se,oo(F([s,Te])),lo,O(f(Mf,LS,Ce.appCmds),f(rc,mr,f(Gf,_E,f(Gf,Tf,we)))))}return d(pm,t,uo,lo,F([Tf(f(Zp,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(rh,CC,mC(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(bb,p,b.address);if("Nothing"===Ne.$)return d(pm,t,uo,lo,F([Tf(f(Zp,"Trying to encrypt, but the user is not involved in this trade.",Ca))]));var Re=Ne.a,$e=function(){return Cf("Initiator"===Re.$?f(Am,p.creationInfo.address,ke):f(Nm,p.creationInfo.address,ke))}();return d(pm,t,uo,f(yf,{onBroadcast:Ca,onMined:Ca,onSign:Ca},$e),mr)}var xe=Be.a,_e=Be.b;return d(pm,t,uo,lo,F([Tf(f(Zp,"Encryption successful, but the user or trade is no longer valid.",L(xe,_e)))]))}var Le=Be.c.a;return d(pm,t,uo,lo,F([Tf(f(Zp,"Error translating JS encryption result into Elm.",Le))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return YS(t)}var D=e.a.a;return d(pm,t,uo,lo,F([Tf(f(rg,"message",D))]));default:return d(pm,t,uo,lo,F([wf]))}}),PE=function(e){return{$:"EventSentryMsg",a:e}},DE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),UE=function(e){var t=f(Sm,PE,e.httpProvider),r=t.a,n=t.b;return L({dataFetchStatus:l(DE,Ca,0,0),eventSentry:r,trades:si,web3Context:e},n)},OE=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}},ME=r(function(e,t){return f(mp,t,f(ip,e.httpProvider,OE(ad(e.factoryType))))}),FE=function(e){return{$:"InitialNumTradesFetched",a:e}},VE=function(e){return f(ME,e.web3Context,FE)},KE=function(e){var t=UE(e),r=t.a,n=t.b;return L(r,oo(F([n,VE(r)])))},HE=r(function(e,t){return{address:e,blocknum:t}}),jE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d($E,!0,e,t,r))}),qE=n(function(e,t,r){var n=function(e){return r(f(Zd,Jm,e).returnData)},a={address:t.address,fromBlock:TE(t.blocknum),toBlock:TE(t.blocknum),topics:F([ba(gb("Initiated(string,string)"))])};return l(jE,n,e,a)}),GE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(za,a,r)}return r}),zE=r(function(e,t){return l(Xa,GE(e),mr,t)}),YE=function(e){return f(zE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ba(t)}return Ca},Va(e.trades))},WE=function(e){return f(Wa,r(function(t,r){return e(t)?r+1:r}),0)},JE=function(e){return f(WE,pi(Eb),Va(e.trades))},QE=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:JE(e),loaded:Fi(YE(e))})})},XE=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),ZE=r(function(e,t){var r=f(Sc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Ac,e,Eb,t.trades));return l(XE,QE(U(t,{trades:n})),uo,mr)}return l(XE,t,uo,F([Tf(f(Zp,"markTradeInvalid ran into an out-of-range error",L(e,t.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(U(r,{trades:o})),mr)}return L(r,F([f(Zp,"updateTradeAddress 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(XE,QE(U(r,{trades:o})),uo,mr)}return l(XE,r,uo,F([Tf(f(Zp,"updateTradeParameters 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(XE,QE(U(r,{trades:o})),uo,mr)}return l(XE,r,uo,F([Tf(f(Zp,"updateTradePhaseTimeInfo 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(XE,QE(U(r,{trades:o})),uo,mr)}return l(XE,r,uo,F([Tf(f(Zp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),aT=n(function(e,t,r){var n=f(Sc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Pb,t,a),o=l(Ac,e,i,r.trades);return l(XE,QE(U(r,{trades:o})),uo,mr)}return l(XE,r,uo,F([Tf(f(Zp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),iT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),oT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),uT=function(e){return{$:"NumTradesFetchedAgain",a:e}},sT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),cT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),fT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),lT=function(e){return l(XE,e,uo,mr)},dT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=hC(n),i=vC(f(nu,Zy,f(Hi,0,a-1))),o=oo(f(nu,function(e){return l(fm,t.web3Context,hu(e),iT(e))},f(Hi,0,a-1)));return l(XE,U(t,{dataFetchStatus:l(DE,ba(a),0,0),trades:i}),o,mr)}var u=r.a;return l(XE,t,uo,F([Tf(f(tg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(XE,t,f(ME,t.web3Context,uT),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=hC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=oo(f(nu,function(e){return l(fm,t.web3Context,hu(e),iT(e))},f(Hi,c,d-1))),g=vC(f(nu,Zy,f(Hi,c,d-1)));return l(XE,U(t,{dataFetchStatus:U(p,{total:ba(d)}),trades:f(QC,t.trades,g)}),o,mr)}return lT(t)}s.b;return l(XE,t,uo,F([Tf(f(Zp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(XE,t,uo,F([Tf(f(tg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(HE,y.address_,hC(y.blocknum)),b=l(qE,t.eventSentry,m,oT(v)),C=b.a,S=b.b,E=oo(F([h(dC,t.web3Context,m.address,sT(v),fT(v),cT(v)),S])),T=l(eT,v,m,t),w=T.a,I=T.b;return l(XE,QE(U(w,{eventSentry:C})),E,f(nu,Tf,I))}var u=r.a;return l(XE,t,uo,F([Tf(f(tg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(XE,t,uo,F([Tf(f(tg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(tT,v,B,t)}var k=r.a.a;return l(XE,t,uo,F([Tf(f(Zp,"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(nT,v,N,t)}return l(XE,t,uo,F([Tf(f(JS,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(rT,v,R,t)}return l(XE,t,uo,F([Tf(f(JS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Mm($.terms);if("Ok"===x.$){var P=x.a;return l(aT,v,P,t)}var D=x.a;return f(ZE,v,t)}var D=r.a;return l(XE,t,uo,F([Tf(f(Zp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(NE,O,t.eventSentry),V=M.a,E=M.b;return l(XE,U(t,{eventSentry:V}),E,mr)}}),hT=function(e){return{$:"AgentHistoryMsg",a:e}},pT=function(e){return{$:"AppCmd",a:e}},gT={$:"BetaLandingPage"},vT={$:"ConnectToWeb3"},yT=function(e){return{$:"MarketplaceMsg",a:e}},mT=function(e){return{$:"TradeCacheMsg",a:e}},bT=r(function(e,t){return f(jn,e,Yd(t))}),CT=function(e){return f(bT,"href",it(e))},ST=qn("rel"),ET=bT("target"),TT=function(e){return{$:"Height",a:e}},wT=TT,IT={$:"Content"},AT=IT,BT=function(e){return{$:"Width",a:e}},kT=BT,NT=function(e){return{$:"Attr",a:e}},RT=function(e){return{$:"NodeName",a:e}},$T=function(e){return{$:"Unkeyed",a:e}},xT={$:"AsEl"},_T=xT,LT=r(function(e,t){return{$:"Field",a:e,b:t}}),PT=f(LT,0,0),DT={$:"NoNearbyChildren"},UT={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"},OT=UT.any+" "+UT.column,MT=UT.any+" "+UT.grid,FT=UT.any+" "+UT.page,VT=UT.any+" "+UT.paragraph,KT=UT.any+" "+UT.row,HT=UT.any+" "+UT.single,jT=function(e){switch(e.$){case"AsRow":return KT;case"AsColumn":return OT;case"AsEl":return HT;case"AsGrid":return MT;case"AsParagraph":return VT;default:return FT}},qT=function(e){return{$:"Keyed",a:e}},GT={$:"NoStyleSheet"},zT=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))}}),YT=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)))}}),WT={$:"AsParagraph"},JT=WT,QT=On("div"),XT=On("p"),ZT=On("s"),ew=On("u"),tw=bT("className"),rw=function(e){return Fn(rt(e))},nw=function(e){return On(rt(e))},aw=function(e){return{$:"Flag",a:e}},iw=function(e){return{$:"Second",a:e}},ow=function(e){return e>31?iw(1< .ctr > ."+UT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",uI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+kw(UT.any)+kw(UT.row)+" > "+kw(UT.any)+" { flex-basis: auto !important; } "+kw(UT.any)+kw(UT.row)+" > "+kw(UT.any)+kw(UT.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"+oI,sI=function(e){return{$:"Intermediate",a:e}},cI=r(function(e,t){return sI({closing:t,others:mr,props:mr,selector:e})}),fI=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,sI({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(fI,f(cI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(za,f(fI,f(cI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(za,f(fI,f(cI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(za,f(fI,f(cI,n.selector,""),v),t.others)})}});return sI(l(Xa,a,n,t))}),lI=O(uI,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(fI,f(cI,r,""),n),t)}),mr,e)))}(O(nI,iI))),dI=l(nw,"style",mr,F([Rw(lI)])),hI=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+'"'}},pI=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}},gI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ed,pI,t.variants)}return!1},vI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),yI=r(function(e,t){return e+" {"+f(zi,"",f(nu,function(e){return e.a+": "+e.b+";"},t))+"}"}),mI=n(function(e,t,r){var n=r.a,a=r.b;return F([f(yI,"."+e+"."+t+", ."+e+" ."+t,n),f(yI,"."+e+"."+t+"> ."+UT.text+", ."+e+" ."+t+" > ."+UT.text,a)])}),bI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(zi," ",O(l(mI,i,UT.sizeByCapital,a),l(mI,i,UT.fullSize,n)))}),CI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(zi," ",F([f(yI,"."+r+"."+UT.sizeByCapital+", ."+r+" ."+UT.sizeByCapital,F([L("line-height","1")])),f(yI,"."+r+"."+UT.sizeByCapital+"> ."+UT.text+", ."+r+" ."+UT.sizeByCapital+" > ."+UT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),SI=function(e){if(e.b){var t=e.a,r=e.b;return ba(l(Wa,mi,t,r))}return Ca},EI=function(e){if(e.b){var t=e.a,r=e.b;return ba(l(Wa,qs,t,r))}return Ca},TI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),wI=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(rc,e.descender,EI(t)),n=f(rc,e.baseline,EI(f(th,function(e){return!$(e,r)},t))),a=f(rc,e.capital,SI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(TI,i,a-n,o),full:l(TI,u,a-r,s)}},II=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",Iw(e.height)),L("vertical-align",Iw(e.vertical)+"em"),L("font-size",Iw(e.size)+"em")]))},AI=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(II(function(e){return e.full}(wI(a))),II(function(e){return e.capital}(wI(a)))))}return t}return t}),Ca,e)},BI=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(zE,t,r))},n=f(nu,gi,e),a=function(e){var t=e.a,r=e.b,a=AI(r);if("Nothing"===a.$)return f(zi,"",f(nu,CI(t),n));var i=a.a;return f(zi,"",f(nu,f(bI,t,i),n))};return O(f(zi,"\n",f(nu,r,e)),f(zi,"\n",f(nu,a,e)))},kI=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)}},NI=function(e){if("FontWith"===e.$){var t=e.a;return ba(f(zi,", ",f(nu,kI,t.variants)))}return Ca},RI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ba(L(t,r))}return Ca},$I=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("+Iw(r)+"px, "+Iw(n)+"px, "+Iw(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("+Iw(o)+"px, "+Iw(u)+"px, "+Iw(s)+"px)",b="scale3d("+Iw(f)+", "+Iw(l)+", "+Iw(d)+")",C="rotate3d("+Iw(p)+", "+Iw(g)+", "+Iw(v)+", "+Iw(y)+"rad)";return ba(m+" "+b+" "+C)}},xI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Wa,vI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Wa,vI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Wa,vI(!1),"",n)+"\n}"}case"Focus":var a=l(Wa,vI(!1),"",n);return f(zi,"\n",F([r+"-fs:focus {"+a+"\n}","."+UT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+UT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+UT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Wa,vI(!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(Tw,"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(Tw,"opacity",Iw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Gi(h),F([f(Tw,"font-size",Gi(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(zi,", ",f(zE,NI,p)),v=F([f(Tw,"font-family",f(zi,", ",f(nu,hI,p))),f(Tw,"font-feature-settings",g),f(Tw,"font-variant",f(Ed,gI,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(Tw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Tw,s,Aw(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=Gi(E)+"px",w=Gi(S)+"px",I="."+UT.row,A="."+(UT.wrapped+I),B="."+UT.alignRight,k="."+UT.paragraph,N="."+UT.page,R="."+UT.alignLeft,$=Iw(E/2)+"px",x=Iw(S/2)+"px",_="."+UT.column,y="."+C,P="."+UT.any;return Tl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Tw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Tw,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Tw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Tw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Tw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Tw,"margin-left",w)])),l(a,t,O(y,k),F([f(Tw,"line-height","calc(1em + "+Gi(E)+"px)")])),l(a,t,"textarea"+y,F([f(Tw,"line-height","calc(1em + "+Gi(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Tw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Tw,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Tw,"content","''"),f(Tw,"display","block"),f(Tw,"height","0"),f(Tw,"width","0"),f(Tw,"margin-top",Gi(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Tw,"content","''"),f(Tw,"display","block"),f(Tw,"height","0"),f(Tw,"width","0"),f(Tw,"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(Tw,"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(Tw,"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,mw,M.rows))+"-cols-"+f(zi,"-",f(nu,mw,M.columns))+"-space-x-"+mw(M.spacing.a)+"-space-y-"+mw(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=$I(ne),y=Cw(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(Tw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,Ca)),topLevel:function(){var r=RI(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(BI(s),c)}),_I=r(function(e,t){return l(nw,"style",mr,F([Rw(f(xI,e,t))]))}),LI=a(function(e,t,r,n){return e?f(za,L("static-stylesheet",dI),f(za,L("dynamic-stylesheet",f(_I,t,l(Wa,Ew,L(Cm,F([Nw(t.focus)])),r).b)),n)):f(za,L("dynamic-stylesheet",f(_I,t,l(Wa,Ew,L(Cm,F([Nw(t.focus)])),r).b)),n)}),PI=a(function(e,t,r,n){return e?f(za,dI,f(za,f(_I,t,l(Wa,Ew,L(Cm,F([Nw(t.focus)])),r).b),n)):f(za,f(_I,t,l(Wa,Ew,L(Cm,F([Nw(t.focus)])),r).b),n)}),DI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(rw,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(LI,!1,e,t,r);default:var e=i.a,t=i.b;return d(LI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return QT;case"p":return XT;default:return nw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(PI,!1,e,t,n);default:var e=i.a,t=i.b;return d(PI,!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(nw,e,n,F([f(u,r,F([tw(UT.any+" "+UT.single)]))]))}}();switch(o.$){case"AsRow":return f(hw,gw,e)&&!f(hw,pw,e)?s:f(hw,sw,e)?f(ew,F([tw(f(zi," ",F([UT.any,UT.single,UT.container,UT.contentCenterY,UT.alignContainerRight])))]),F([s])):f(hw,cw,e)?f(ZT,F([tw(f(zi," ",F([UT.any,UT.single,UT.container,UT.contentCenterY,UT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(hw,dw,e)&&!f(hw,lw,e)?s:f(hw,fw,e)?f(ZT,F([tw(f(zi," ",F([UT.any,UT.single,UT.container,UT.alignContainerCenterY])))]),F([s])):f(hw,uw,e)?f(ew,F([tw(f(zi," ",F([UT.any,UT.single,UT.container,UT.alignContainerBottom])))]),F([s])):s;default:return s}}),UI=Rw,OI=function(e){return f(QT,F([tw(f(zi," ",F([UT.any,UT.text,UT.widthContent,UT.heightContent])))]),F([UI(e)]))},MI=function(e){return l(nw,"div",F([tw(f(zi," ",F([UT.any,UT.text,UT.widthFill,UT.heightFill])))]),F([Rw(e)]))},FI=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,JT),L(f(za,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,JT),L(f(za,L(n,f(s.html,GT,e)),i),Go(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(za,L(n,$(e,_T)?MI(c):OI(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,JT),L(f(za,i(e),n),a);case"Styled":var o=t.a;return $(e,JT),L(f(za,f(o.html,GT,e),n),Go(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(za,$(e,_T)?MI(u):OI(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(DI,n.has,n.node,n.attributes,qT(l(YT,"nearby-element-pls",s,n.children))),styles:g})}return Lf(h(DI,n.has,n.node,n.attributes,qT(l(YT,"nearby-element-pls",s,n.children)),GT))}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(DI,n.has,n.node,n.attributes,$T(f(zT,m,n.children))),styles:g})}return Lf(h(DI,n.has,n.node,n.attributes,$T(f(zT,m,n.children)),GT))}),VI=r(function(e,t){return f(qn,nt(e),ot(t))}),KI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(LT,a|r,n)}var i=e.a;return f(LT,r,i|n)}),HI=ow(7),jI=ow(36),qI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(LT,r|a,n|i)}),GI=ow(6),zI=ow(38),YI=ow(30),WI=ow(29),JI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),QI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),XI=function(e){return{$:"Transform",a:e}},ZI=function(e){return{$:"ChildrenBehind",a:e}},eA=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),tA=function(e){return{$:"ChildrenInFront",a:e}},rA=r(function(e,t){return f(QT,F([tw(function(){switch(e.$){case"Above":return f(zi," ",F([UT.nearby,UT.single,UT.above]));case"Below":return f(zi," ",F([UT.nearby,UT.single,UT.below]));case"OnRight":return f(zi," ",F([UT.nearby,UT.single,UT.onRight]));case"OnLeft":return f(zi," ",F([UT.nearby,UT.single,UT.onLeft]));case"InFront":return f(zi," ",F([UT.nearby,UT.single,UT.inFront]));default:return f(zi," ",F([UT.nearby,UT.single,UT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return Rw("");case"Text":var e=t.a;return OI(e);case"Unstyled":return(0,t.a)(_T);default:return f(t.a.html,GT,_T)}}()]))}),nA=n(function(e,t,r){var n=f(rA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?ZI(F([n])):tA(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?ZI(f(za,n,a)):f(eA,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(eA,F([n]),i):tA(f(za,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(eA,f(za,n,a),i):f(eA,a,f(za,n,i))}}),aA=r(function(e,t){switch(t.$){case"Generic":return RT(e);case"NodeName":var r=t.a;return f(JI,r,e);default:var n=t.a,a=t.b;return f(JI,n,a)}}),iA=function(e){switch(e.$){case"Left":return UT.alignedHorizontally+" "+UT.alignLeft;case"Right":return UT.alignedHorizontally+" "+UT.alignRight;default:return UT.alignedHorizontally+" "+UT.alignCenterX}},oA=function(e){switch(e.$){case"Top":return UT.alignedVertically+" "+UT.alignTop;case"Bottom":return UT.alignedVertically+" "+UT.alignBottom;default:return UT.alignedVertically+" "+UT.alignCenterY}},uA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),sA=function(e){return{$:"Moved",a:e}},cA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return sA(P(r,0,0));case"MoveY":var n=t.a;return sA(P(0,n,0));case"MoveZ":var a=t.a;return sA(P(0,0,a));case"MoveXYZ":var i=t.a;return sA(i);case"Rotate":var i=t.a,o=t.b;return d(uA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(uA,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 sA(P(s,n,a));case"MoveY":var c=t.a;return sA(P(r,c,a));case"MoveZ":var f=t.a;return sA(P(r,n,f));case"MoveXYZ":var i=t.a;return sA(i);case"Rotate":var i=t.a,o=t.b;return d(uA,u,P(1,1,1),i,o);default:var l=t.a;return d(uA,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(uA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(uA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(uA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(uA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(uA,u,h,v,y);default:var m=t.a;return d(uA,u,m,p,o)}}}),fA=function(e){switch(e.$){case"Px":var t=e.a,r=Gi(t),n="height-px-"+r;return P(PT,n,F([l(QI,n,"height",r+"px")]));case"Content":return P(f(KI,jI,PT),UT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(KI,dw,PT),UT.heightFill,mr):P(f(KI,dw,PT),UT.heightFillPortion+" height-fill-"+Gi(a),F([l(QI,UT.any+"."+UT.row+" > "+kw("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(QI,u,"min-height",Gi(i)+"px"),c=fA(o),d=c.a,h=c.b,p=c.c;return P(f(KI,lw,d),u+" "+h,f(za,s,p));default:var g=e.a,o=e.b,u="max-height-"+Gi(g),s=l(QI,u,"max-height",Gi(g)+"px"),v=fA(o),d=v.a,h=v.b,p=v.c;return P(f(KI,lw,d),u+" "+h,f(za,s,p))}},lA=function(e){switch(e.$){case"Px":var t=e.a;return P(PT,UT.widthExact+" width-px-"+Gi(t),F([l(QI,"width-px-"+Gi(t),"width",Gi(t)+"px")]));case"Content":return P(f(KI,zI,PT),UT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(KI,gw,PT),UT.widthFill,mr):P(f(KI,gw,PT),UT.widthFillPortion+" width-fill-"+Gi(r),F([l(QI,UT.any+"."+UT.row+" > "+kw("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(QI,i,"min-width",Gi(n)+"px"),u=lA(a),s=u.a,c=u.b,d=u.c;return P(f(KI,pw,s),i+" "+c,f(za,o,d));default:var h=e.a,a=e.b,i="max-width-"+Gi(h),o=l(QI,i,"max-width",Gi(h)+"px"),p=lA(a),s=p.a,c=p.b,d=p.c;return P(f(KI,pw,s),i+" "+c,f(za,o,d))}},dA=ow(27),hA=r(function(e,t){if($(e,dA)){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}}),pA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=Cw(n);if("Nothing"===s.$)return{attributes:f(za,tw(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(za,tw(e+" "+c),i),children:o,has:r,node:t,styles:f(za,XI(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(hw,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(KI,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(hw,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(hA,E,I)){var p=Sw(I)+" "+e,g=t,v=f(KI,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=Sw(I)+" "+e,g=t,v=f(KI,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(KI,E,r),y=f(cA,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(hw,GI,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=UT.widthExact+" width-px-"+Gi(k)+" "+e,g=t,v=f(KI,GI,r),y=n,m=f(za,l(QI,"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+" "+UT.widthContent,g=t,v=f(KI,zI,f(KI,GI,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+" "+UT.widthFill,g=t,v=f(KI,gw,f(KI,GI,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+" "+UT.widthFillPortion+" width-fill-"+Gi(N),g=t,v=f(KI,gw,f(KI,GI,r)),y=n,m=f(za,l(QI,UT.any+"."+UT.row+" > "+kw("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=lA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(qI,$,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(hw,HI,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(KI,HI,r),y=n,m=f(za,l(QI,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=UT.heightContent+" "+e,g=t,v=f(KI,jI,f(KI,HI,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=UT.heightFill+" "+e,g=t,v=f(KI,dw,f(KI,HI,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+" "+UT.heightFillPortion+" height-fill-"+Gi(N),g=t,v=f(KI,dw,f(KI,HI,r)),y=n,m=f(za,l(QI,UT.any+"."+UT.column+" > "+kw("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=fA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(qI,$,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(aA,"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(aA,"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(aA,"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(aA,"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(aA,"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(aA,"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(aA,"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 RT("p");case"NodeName":var e=t.a;return RT(e);default:var r=t.a,n=t.b;return f(JI,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(VI,"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(VI,"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(VI,"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(VI,"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(nA,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(hw,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(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(KI,cw,e);case"Right":return f(KI,sw,e);default:return e}}(f(KI,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;default:var G=d.a;if(f(hw,WI,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=oA(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(KI,fw,e);case"Bottom":return f(KI,uw,e);default:return e}}(f(KI,WI,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}}}),gA={$:"Untransformed"},vA=gA,yA=a(function(e,t,r,n){return l(FI,e,n,v(pA,jT(e),t,PT,vA,mr,mr,DT,Ja(r)))}),mA=function(e){return NT(tw(e))},bA=r(function(e,t){var r=t.url,n=t.label;return d(yA,_T,RT("a"),f(za,NT(CT(r)),f(za,NT(ST("noopener noreferrer")),f(za,NT(ET("_blank")),f(za,kT(AT),f(za,wT(AT),f(za,mA(UT.contentCenterX+" "+UT.contentCenterY),e)))))),$T(F([n])))}),CA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),SA=n(function(e,t,r){return d(CA,e,t,r,1)}),EA=ow(14),TA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),wA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),IA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return bw(t)+"-"+bw(r)+"-"+bw(n)+"-"+bw(a)},AA=function(e){return f(wA,EA,l(TA,"fc-"+IA(e),"color",e))},BA={align:Jp,mainParagraphs:F([F([Xp("You need a web3 provider (such as "),f(bA,F([AA(l(SA,0,0,1))]),{label:Xp("Metamask"),url:"https://metamask.io/"}),Xp(") to Connect.")]),F([Xp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:ng},kA={align:Jp,mainParagraphs:F([F([Xp("I don't understand that URL...")]),F([Xp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:eg},NA={align:Jp,mainParagraphs:F([F([Xp("Your wallet is set to an incorrect network.")]),F([Xp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:eg},RA=Do(f(_a,df,f(_a,qd,Pl("Error decoding hex to BigInt")))),$A=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.")}})}(),xA=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}}}}}}}}}}}},_A=function(e){return iE(F([f(Bf,ba,e),Po(Ca)]))},LA=f(pd,_A(f(Fd,"status",$A)),f(pd,_A(f(Fd,"root",Lo)),l(sE,"logsBloom",Lo,l(sE,"logs",Om(bE),f(pd,_A(f(Fd,"contractAddress",cE)),l(sE,"cumulativeGasUsed",RA,l(sE,"gasUsed",RA,l(sE,"blockNumber",gm,l(sE,"blockHash",hE,l(sE,"transactionIndex",gm,l(sE,"transactionHash",vE,Po(xA)))))))))))),PA=function(e){var t=e.a;return df(t)},DA=f(_a,PA,Yd),UA=r(function(e,t){return rp({decoder:LA,method:"eth_getTransactionReceipt",params:F([DA(t)]),url:e})}),OA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),MA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),FA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),VA=r(function(e,t){return f(Gf,function(e){return e.toMsg},f(ig,function(e){return e.b},f(ig,function(e){return e.onMinedTagger},f(Th,t,e))))}),KA=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}}}}}}}}}}}},HA=function(e){return iE(F([aE(Ca),f(Bf,ba,e)]))},jA=l(sE,"input",Lo,l(sE,"gas",gm,l(sE,"gasPrice",RA,l(sE,"value",RA,l(sE,"to",HA(cE),l(sE,"from",cE,l(sE,"transactionIndex",gm,l(sE,"blockNumber",HA(gm),l(sE,"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)}(hE),l(sE,"nonce",gm,l(sE,"hash",vE,Po(KA)))))))))))),qA=r(function(e,t){return rp({decoder:jA,method:"eth_getTransactionByHash",params:F([DA(t)]),url:e})}),GA=r(function(e,t){return{attempts:e,sleep:t}}),zA=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(zA,f(GA,a,n),t)},rE(1e3*n)):Xh(e)},t)}),YA=r(function(e,t){return f(up,function(r){return f(zA,{attempts:30,sleep:1},f(qA,e,t))},rE(250))}),WA=r(function(e,t){return f(zA,{attempts:60,sleep:5},f(UA,e,t))}),JA=function(e){return{$:"Mined",a:e}},QA=function(e){return Gf(function(t){return U(t,{status:JA(e)})})},XA=function(e){return{$:"Sent",a:e}},ZA=function(e){return Gf(function(t){return U(t,{status:XA(e)})})},eB=function(e){return{$:"Signed",a:e}},tB=function(e){return Gf(function(t){return U(t,{status:eB(e)})})},rB=function(e){return"Nothing"!==e.$},nB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(_g(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(pg,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(pg,r,Zh(Ai(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(pg,a,Zh(Ai(e)))}t.a,t.b,t.c;return uo};if("Ok"===a.$){var c=a.a,d=rB(o.onBroadcastTagger)||rB(o.onMinedTagger)?f(Ug,r.tagger,f(mp,FA(n),f(YA,r.nodePath,c))):uo;return L(_g(U(r,{txs:l(Oh,n,tB(c),r.txs)})),oo(F([u,d])))}var h=a.a;return L(_g(r),oo(F([u,s(h)])))}return L(_g(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(Ug,r.tagger,f(mp,MA(n),f(WA,r.nodePath,v.hash))):uo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(pg,t,Zh(Bi(v)))}return uo}();return L(_g(U(r,{txs:l(Oh,n,ZA(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(pg,t,Zh(Ai("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(pg,n,Zh(Ai("Error with TxSent stuff")))}e.a,e.b;return uo}();return L(_g(r),s)}return L(_g(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(pg,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(Ug,r.tagger,f(mp,f(OA,n,s),vm(r.nodePath))),f(pg,a,Zh(Bi(C))),f(pg,u.toMsg,Zh(s))]))}return uo}();return L(_g(U(r,{txs:l(Oh,n,QA(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(pg,r,Zh(Ai("TxReceipt decoding failure")))}return uo}();return L(_g(r),E)}return L(_g(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(VA,r.txs,n);if("Just"===A.$){var B=A.a;return L(_g(r),f(pg,B,f(yp,function(e){return Zh(U(I,{doneWatching:!0,reOrg:!0}))},f(up,function(e){return Zh(U(I,{doneWatching:!0}))},f(UA,r.nodePath,T.txHash)))))}return L(_g(r),uo)}if($(w,T.lastCheckedBlock))return L(_g(r),f(Ug,r.tagger,f(mp,f(OA,n,T),f(up,function(e){return vm(r.nodePath)},rE(2e3)))));var k=f(VA,r.txs,n);if("Just"===k.$){var B=k.a;return L(_g(r),oo(F([f(Ug,r.tagger,f(mp,f(OA,n,I),f(up,function(e){return vm(r.nodePath)},rE(2e3)))),f(pg,B,Zh(I))])))}return L(_g(r),uo)}var n=e.a,h=e.c.a;return L(_g(r),uo);default:var h=e.a;return L(_g(r),uo)}}),aB=Qt,iB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Gi(r)}),oB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),uB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(oB,"#",e.fragment,l(oB,"?",e.query,O(f(iB,e.port_,O(t,e.host)),e.path)))},sB=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)}),cB=r(function(e,t){Yv(t);switch(t.$){case"Home":return L(U(e,{submodel:gT}),uo);case"Create":var r=f(td,e.web3Context,e.userInfo),n=f(Fg,e.txSentry,f(Kg,My,r.chainCmd)),a=n.a,i=n.b;return f(lB,f(Mf,My,r.appCmds),L(U(e,{submodel:Oy(r.model),txSentry:a}),oo(F([f(Ug,My,r.cmd),i]))));case"QuickCreate":var r=f(Iv,e.web3Context,e.userInfo),o=f(Fg,e.txSentry,f(Kg,Ky,r.chainCmd)),a=o.a,i=o.b;return f(lB,f(Mf,Ky,r.appCmds),L(U(e,{submodel:Vy(r.model),txSentry:a}),oo(F([f(Ug,Ky,r.cmd),i]))));case"Trade":var u=t.a,r=l(Em,e.web3Context,e.userInfo,u),s=f(Fg,e.txSentry,f(Kg,jy,r.chainCmd)),a=s.a,i=s.b;return f(lB,f(Mf,jy,r.appCmds),L(U(e,{submodel:Hy(r.model),txSentry:a}),oo(F([f(Ug,jy,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(ov,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:Fy(p)}),oo(F([f(Ug,yT,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:Uy(b)}),oo(F([f(Ug,hT,C)])));default:return L(f(ei,kA,e),uo)}}),fB=r(function(e,t){var r=t.a,n=t.b,a=f(dB,pT(e),r),i=a.a,o=a.b;return L(i,oo(F([n,o])))}),lB=r(function(e,t){var r=t.a,n=t.b;return l(Wa,fB,L(r,n),e)}),dB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(dB,vT,t);case"GotoRoute":var n=r.a;return L(t,f(Iy,t.key,n));case"GTag":var a=r.a;return L(t,Ny(By(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(sB,o,t.userNotices)}),uo);case"LinkClicked":var u=e.a,s=function(){if("Internal"===u.$){var e=u.a;return f(wy,t.key,uB(e))}var r=u.a;return aB(r)}();return L(t,s);case"UrlChanged":var c=e.a;return f(hB,c,t);case"GotoRoute":var d=e.a;return L(t,f(Iy,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,tS,p)),v=f(ig,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,Hg(t.web3Context.factoryType)))return L(t,uo);var C=Da(b),S=KE(C),E=S.a,T=S.b,w=f(Jy,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(Ug,mT,T),function(){if("Just"===B.$){var e=B.a;return f(Iy,t.key,e)}return A}()])))}y.b;return L(f(ei,NA,t),uo)}var k=y.a.a;return L(l(ma,ei,f(Zp,"Can't decode networkID from Javascript",k),t),uo);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(ei,BA,t),uo):L(t,Ay(vr));case"WalletStatus":var N=e.a,R=function(){var e=N.account;if("Nothing"===e.$)return uo;var t=e.a;return Ry(f(ky,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(qy,M,t.submodel),I=V.a,s=V.b;return L(U(t,{submodel:I,userInfo:M}),s)}return L(f(ei,f(Zp,"User pubkey set, but I can no longer find the user address!",Ca),t),uo)}var K=_.a;return L(l(ma,ei,f(Zp,"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($g,H,q),z=f(Fg,t.txSentry,f(Kg,My,G.chainCmd)),Y=z.a,W=z.b;return f(lB,f(Mf,My,G.appCmds),L(U(t,{submodel:Oy(G.model),txSentry:Y}),oo(F([f(Ug,My,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(Hv,J,X),Z=f(Fg,t.txSentry,f(Kg,Ky,G.chainCmd)),Y=Z.a,W=Z.b;return f(lB,f(Mf,Ky,G.appCmds),L(U(t,{submodel:Vy(G.model),txSentry:Y}),oo(F([f(Ug,Ky,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(LE,ee,re),ne=f(Fg,t.txSentry,f(Kg,jy,G.chainCmd)),Y=ne.a,W=ne.b;return f(lB,f(Mf,jy,G.appCmds),L(U(t,{submodel:Hy(G.model),txSentry:Y}),oo(F([f(Ug,jy,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(bv,ae,oe);return f(lB,f(Mf,yT,G.appCmds),L(U(t,{submodel:Fy(G.model)}),f(Ug,yT,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(Fg,t.txSentry,f(Kg,hT,G.chainCmd)),Y=fe.a,W=fe.b;return f(lB,f(Mf,hT,G.appCmds),L(U(t,{submodel:Uy(G.model),txSentry:Y}),oo(F([f(Ug,hT,G.cmd),W]))))}return L(t,uo);case"TxSentryMsg":var le=e.a,de=f(nB,le,t.txSentry),I=de.a,he=de.b;return L(U(t,{txSentry:I}),he);case"TradeCacheMsg":var pe=e.a,G=f(dT,pe,t.tradeCache);return L(U(t,{tradeCache:G.tradeCache}),f(Ug,mT,G.cmd));case"NoOp":return L(t,uo);default:var K=e.a;f(Rl,"test",K);return L(t,uo)}}),hB=r(function(e,t){return f(cB,t,Ty(e))}),pB={$:"AllGood"},gB={$:"NoWeb3"},vB=function(e){return{$:"TxSentryMsg",a:e}},yB={$:"WrongNetwork"},mB={align:Jp,mainParagraphs:F([F([Xp("No web3 provider detected. Is "),f(bA,F([AA(l(SA,0,0,1))]),{label:Xp("Metamask"),url:"https://metamask.io/"}),Xp(" or some other web3 provider installed and unlocked?")])]),noticeType:ng},bB={$:"TopLeft"},CB={align:bB,mainParagraphs:F([F([Xp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:ng},SB=n(function(e,t,r){var n=e.a,a=e.b;return _g({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Eh})}),EB=n(function(e,t,r){var n=e.width<1024?ba(CB):Ca,a=function(){if(e.networkId){var t=La(e.networkId);if("Nothing"===t.$)return L(la(da),yB);return L(t.a,pB)}return L(la(da),gB)}(),i=a.a,o=a.b,u=Da(i),s=KE(u),c=s.a,d=s.b,h=l(SB,L(ao,ro),vB,u.httpProvider),p=function(){switch(o.$){case"NoWeb3":return ba(mB);case"WrongNetwork":return ba(NA);default:return Ca}}(),g=ZC(F([n,p])),v=f(hB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:gT,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(Ug,mT,d),m])))}),TB=ze("networkSentryPort",to),wB=Me,IB=wB(mr),AB=function(e){return IB},BB=function(e){return{$:"Refresh",a:e}},kB=r(function(e,t){return{$:"Every",a:e,b:t}}),NB=r(function(e,t){return{processes:t,taggers:e}}),RB=Zh(f(NB,Eh,Eh)),$B=o(function(e,t,a,i,o,u){var s=n(function(r,n,i){e:for(;;){var o=i.a,u=i.b;if(o.b){var s=o.a,c=s.a,f=s.b,h=o.b;if(_(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(AE,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)}),xB=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)}),LB=ke,PB=r(function(e,t){return{$:"Zone",a:e,b:t}}),DB=fa,UB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=LB(f(DB,n,f(Vh,e,n)));return f(up,function(t){return l(UB,e,a,l(Nh,n,t,r))},i)}return Zh(r)}),OB=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},xB(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($B,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(NB,u,e))},f(up,function(t){return l(UB,e,h,g)},v))}),MB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Kf),FB=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,MB))}),VB=r(function(e,t){var r=t.a,n=t.b;return f(kB,r,f(Af,e,n))});gn.Time=De(RB,OB,FB,0,VB);var KB=Oe("Time"),HB=r(function(e,t){return KB(f(kB,e,t))}),jB=function(e){return f(HB,2e3,BB)},qB=function(e){return IB},GB=function(e){return{$:"Refresh",a:e}},zB=function(e){return f(HB,2e3,GB)},YB=function(e){return{$:"DecryptionFinished",a:e}},WB=ze("decryptionFinished",to),JB=ze("encryptionFinished",to),QB=function(e){return{$:"EncryptionFinished",a:e}},XB=function(e){return{$:"Refresh",a:e}},ZB=function(e){return wB(F([f(HB,3e3,XB),JB(QB),WB(function(e){return LS(YB(e))})]))},ek=mn,tk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return IB;case"CreateModel":t.a;return f(ek,My,jB());case"QuickCreateModel":t.a;return f(ek,Ky,zB());case"TradeModel":t.a;return f(ek,jy,ZB());case"MarketplaceModel":t.a;return f(ek,yT,qB());default:t.a;return f(ek,hT,AB())}},rk=ze("userPubkeyResult",to),nk=ze("walletSentryPort",to),ak={$:"CheckForNewTrades"},ik=function(e){return f(HB,5e3,function(e){return ak})},ok=function(e){return{$:"NetworkUpdate",a:e}},uk=function(e){return{$:"Tick",a:e}},sk=function(e){return{$:"UserPubkeySet",a:e}},ck=function(e){return{$:"WalletStatus",a:e}},fk=function(e){return f(Zp,"Error decoding JS walletSentry: "+e,Ca)},lk=function(e){return{$:"ErrorDecoding",a:e}},dk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),hk=l(kf,r(function(e,t){return{ref:e,txHash:t}}),f(Fd,"ref",tS),f(Fd,"txHash",_A(vE))),pk=function(e){var t=f(Jd,hk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(dk,r.ref,Bi(a))}return f(dk,r.ref,Ai("Problem signing/broadcasting Tx. Ref #"+Gi(r.ref)))}t.a;return lk("Error decoding tx data")},gk=function(e){var t=e.a;return f(ek,t.tagger,t.inPort(pk))},vk=f(Bf,xa,tS),yk=Do(f(_a,il,f(_a,Pl("Failure decoding stringy int"),wo(xa)))),mk=iE(F([yk,vk])),bk=r(function(e,t){return{account:e,networkId:t}}),Ck=l(kf,bk,f(Fd,"account",_A(cE)),f(Fd,"networkId",mk)),Sk=n(function(e,t,r){var n=f(Jd,Ck,r);if("Err"===n.$){var a=n.a;return e(Zi(a))}return t(n.a)}),Ek=function(e){var t=f(_a,fk,f(_a,Tf,pT));return wB(O(F([f(HB,1e3,uk),nk(f(Sk,t,ck)),gk(e.txSentry),rk(sk),f(ek,mT,ik(e.tradeCache)),TB(ok)]),F([tk(e)])))},Tk=function(e){return{$:"LinkClicked",a:e}},wk=function(e){return{$:"UrlChanged",a:e}},Ik=n(function(e,t,r){return d(CA,e/255,t/255,r/255,1)}),Ak=l(Ik,10,33,108),Bk={$:"Generic"},kk=Bk,Nk=r(function(e,t){return d(yA,_T,kk,f(za,kT(AT),f(za,wT(AT),e)),$T(F([t])))}),Rk=function(e){return{$:"Fill",a:e}},$k=Rk(1),xk=$f,_k=function(e){return{$:"Px",a:e}},Lk=_k,Pk=ow(8),Dk=function(e){return f(wA,Pk,l(TA,"bg-"+IA(e),"background-color",e))},Uk=f(Nk,F([kT($k),wT(Lk(150)),Dk(Ak)]),xk),Ok=function(e){return{$:"GotoRoute",a:e}},Mk={$:"Active"},Fk={$:"Important"},Vk={$:"Normal"},Kk=l(SA,1,1,1),Hk=ow(2),jk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),qk=r(function(e,t){return $(e,t)?f(wA,Hk,h(jk,"p-"+Gi(e),e,e,e,e)):f(wA,Hk,h(jk,"p-"+Gi(e)+"-"+Gi(t),t,e,t,e))}),Gk=ow(21),zk=r(function(e,t){return{$:"Class",a:e,b:t}}),Yk=f(zk,Gk,UT.cursorPointer),Wk=ow(17),Jk=function(e){return f(wA,Wk,l(QI,"br-"+Gi(e),"border-radius",Gi(e)+"px"))},Qk=function(e){return{$:"Normal",a:e}},Xk=Kn,Zk=r(function(e,t){return f(Xk,e,Qk(t))}),eN=function(e){return f(Zk,"click",Po(e))},tN=f(Af,NT,eN),rN=ow(13),nN=f(zk,rN,UT.textSemiBold),aN=ow(4),iN=function(e){return{$:"FontSize",a:e}},oN=function(e){return f(wA,aN,iN(e))},uN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Jk(4),Dk(l(SA,0,0,1))]);default:return F([Jk(4),Dk(l(SA,.9,0,0))])}}();return f(Nk,O(F([f(qk,23,12),oN(22),nN,AA(Kk),Yk,tN(t)]),n),Xp(e))}),sN=l(Ik,244,0,103),cN=function(e){return{$:"AlignX",a:e}},fN={$:"CenterX"},lN=cN(fN),dN=ow(3),hN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),pN=r(function(e,t){return"spacing-"+Gi(e)+"-"+Gi(t)}),gN=function(e){return f(wA,dN,l(hN,f(pN,e,e),e,e))},vN=function(e){return{$:"Describe",a:e}},yN={$:"Paragraph"},mN=r(function(e,t){return d(yA,JT,kk,f(za,vN(yN),f(za,kT($k),f(za,gN(5),e))),$T(t))}),bN=f(zk,rN,UT.bold),CN=f(Nk,F([oN(29),AA(Kk),bN,lN,Yk,tN(Ok(Qv))]),f(mN,mr,F([Xp("DAI"),f(Nk,F([AA(sN)]),Xp("Hard"))]))),SN=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"}},EN=mA(UT.italic),TN=function(e){return f(Nk,F([oN(18),AA(l(SA,.8,.8,1)),nN,EN,lN]),Xp(SN(e)))},wN={$:"Right"},IN=cN(wN),AN={$:"AsColumn"},BN=AN,kN=r(function(e,t){return d(yA,BN,kk,f(za,mA(UT.contentTop+" "+UT.contentLeft),f(za,wT(AT),f(za,kT(AT),e))),$T(t))}),NN={$:"AsRow"},RN=NN,$N=r(function(e,t){return d(yA,RN,kk,f(za,mA(UT.contentLeft+" "+UT.contentCenterY),f(za,kT(AT),f(za,wT(AT),e))),$T(t))}),xN=function(e){return f($N,F([kT($k),gN(30),f(qk,30,17)]),F([l(uN,"Create a New Offer",Ok(Jv),function(){return"CreateModel"===e.submodel.$?Mk:Vk}()),l(uN,"Sell Offers",Ok(Xv(ay)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ay)?Mk:Vk}return Vk}()),l(uN,"Buy Offers",Ok(Xv(Ff)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Ff)?Mk:Vk}return Vk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(uN,"My Trades",Ok(f(mf,r.address,Ff)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Mk:Vk}return Vk}())}return l(uN,"Connect to Wallet",vT,Fk)}(),f(kN,F([IN,gN(0),f(qk,8,0)]),F([CN,TN(e)]))]))},_N=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ba(e.agentAddress))}},LN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},PN=function(e){return r(function(e,t){var r=f(fu,LN(e.state.phase),LN(t.state.phase));return $(r,Ua)?r:f(jg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},DN=Er,UN=r(function(e,t){return f(_a,th(e),DN(t))}),ON=function(e){return{$:"AlignY",a:e}},MN={$:"CenterY"},FN=ON(MN),VN=ow(20),KN=f(zk,VN,UT.clip),HN=Rk,jN=function(e){return f(wA,Hk,h(jk,"p-"+Gi(e),e,e,e,e))},qN=function(e){var t=e.a,r=e.b;return f(Nk,F([kT(HN(t)),wT(Lk(60)),KN,Dk(Kk)]),f(Nk,F([jN(12),FN,kT($k)]),r))},GN=f(zk,rN,UT.textMedium),zN=function(e){return f(Nk,F([GN,oN(17)]),Xp(e))},YN=function(e){return{$:"Poke",a:e}},WN=ow(33),JN={$:"Hover"},QN=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),XN=zn,ZN=r(function(e,t){return{$:"Nearby",a:e,b:t}}),eR={$:"NoAttribute"},tR=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),rR=r(function(e,t){switch(t.$){case"NoAttribute":return eR;case"Describe":var r=t.a;return vN(r);case"AlignX":var n=t.a;return cN(n);case"AlignY":var a=t.a;return ON(a);case"Width":var n=t.a;return BT(n);case"Height":var n=t.a;return TT(n);case"Class":var n=t.a,a=t.b;return f(zk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(wA,i,o);case"Nearby":var u=t.a,s=t.b;return f(ZN,u,f(Pf,e,s));case"Attr":var c=t.a;return NT(f(XN,e,c));default:var l=t.a,d=t.b;return f(tR,l,d)}}),nR=function(e){return f(rR,hg,e)},aR=r(function(e,t){var r=t.a,n=t.b,a=nR(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(cA,n,o));default:return L(r,n)}}),iR=function(e){var t=l(Wa,aR,L(mr,gA),e),r=t.a,n=t.b;return f(za,XI(n),r)},oR=function(e){return f(wA,WN,f(QN,JN,iR(e)))},uR=a(function(e,t,r,n){return d(CA,e/255,t/255,r/255,n)}),sR=me,cR=r(function(e,t){return f(jn,e,sR(t))}),fR=cR("disabled"),lR=function(e){return f(qn,"tabIndex",Gi(e))},dR=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},hR=function(e){return f(Ed,dR,e)?eR:mA("focusable")},pR=function(e){return{$:"MayPreventDefault",a:e}},gR=r(function(e,t){return f(Xk,e,pR(t))}),vR=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 NT(f(gR,"keyup",f(Bf,function(e){return L(e,!0)},n)))}),yR=function(e){return f(vR,"Enter",e)},mR={$:"Button"},bR=r(function(e,t){var r=t.onPress,n=t.label;return d(yA,_T,kk,f(za,kT(AT),f(za,wT(AT),f(za,mA(UT.contentCenterX+" "+UT.contentCenterY+" "+UT.seButton+" "+UT.noTextSelection),f(za,Yk,f(za,hR(e),f(za,vN(mR),f(za,NT(lR(0)),function(){if("Nothing"===r.$)return f(za,NT(fR(!0)),e);var t=r.a;return f(za,tN(t),f(za,yR(t),e))}()))))))),$T(F([n])))}),CR=function(e){return f(bR,F([Dk(d(uR,16,7,234,.2)),jN(5),Jk(4),kT($k),oR(F([Dk(d(uR,16,7,234,.4))]))]),{label:f(Nk,F([lN,AA(l(Ik,16,7,234)),GN,oN(14)]),Xp("Poke")),onPress:ba(YN(e))})},SR=function(e){return{$:"TimeLeft",a:e}},ER=function(e){return{$:"TimeUp",a:e}},TR=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)}}),wR=r(function(e,t){return Kf(Yl(e)-Yl(t))}),IR=r(function(e,t){var r=f(TR,t.state.phase,t),n=f(wR,e,t.state.phaseStartTime),a=f(wR,r,n);return Yl(a)>0?SR(L(a,r)):ER(r)}),AR=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},BR=l(SA,0,0,0),kR=l(Ik,233,237,242),NR={$:"Behind"},RR=function(e){return f(ZN,NR,e)},$R=r(function(e,t){var r=kg(200*e),n=200-r,a=f(Nk,F([kT(HN(n))]),xk),i=F([wT(Lk(3)),Jk(20)]),o=f(Nk,O(i,F([kT(HN(r)),Dk(t)])),xk),u=f(Nk,O(i,F([kT($k),Dk(kR)])),xk);return f($N,F([kT($k),RR(u)]),F([o,a]))}),xR=l(Ik,51,183,2),_R=function(e){return Yl(e)<0},LR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),PR=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(LR,hC(t),hC(r),hC(n),hC(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))))},DR=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=PR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f($N,O(F([gN(5)]),e),F([f(Nk,O(F([AA(h)]),t),Xp(f(u,c.days,"d"))),f(Nk,O(F([AA(d)]),t),Xp(f(u,c.hours,"h"))),f(Nk,O(F([AA(s)]),t),Xp(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}}),UR=l(SA,1,1,0),OR=r(function(e,t){return Yl(e)/Yl(t)}),MR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(OR,o,u),c=(f(Nk,F([lN]),d(DR,mr,mr,L(a,i),o)),s<.1?sN:s<.2?UR:xR);return f(kN,O(F([gN(5)]),e),F([d(DR,F([lN]),t,L(a,i),o),f($R,1-s,c)]))}),FR=a(function(e,t,r,n){var a=f(IR,e,t);if("TimeLeft"===a.$){var i=a.a,o=r&&f(OR,i.a,i.b)<.05?sN:BR;return d(MR,F([kT($k)]),F([oN(16)]),L(o,kR),i)}return f(kN,F([gN(4),kT($k)]),O(F([f(Nk,F([lN,oN(14)]),Xp(AR(t.state.phase)))]),n?F([f(Nk,F([lN]),CR(t.creationInfo.address))]):mr))}),VR=function(e){return{$:"JustImage",a:e}},KR=VR,HR=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,KR({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","₫")]))),jR=function(e){return f(rc,"",f(Gf,gi,f(Th,e,HR)))},qR=function(e){return yo(e)<=3?e:qR(f(Al,3,e))+","+f(Ao,3,e)},GR=function(e){return qR(Il(e))},zR=function(e){return O(jR(e.fiatType),GR(e.amount))},YR=bT("alt"),WR=function(e){return f(bT,"src",ot(e))},JR=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(yA,_T,kk,f(za,mA(UT.imageContainer),e),$T(F([d(yA,_T,RT("img"),O(F([NT(WR(r)),NT(YR(n))]),a),$T(mr))])))}),QR=r(function(e,t){if("None"===t.$)return xk;var r=t.a;return f(JR,e,r)}),XR=CA,ZR=function(e){var t=function(){var t=f(Th,e.fiatType,HR);if("Nothing"===t.$)return xk;var r=t.a,n=(r.a,r.b);return f(QR,F([wT(Lk(26))]),n)}();return f($N,F([gN(4)]),F([t,f(Nk,F([AA(d(XR,0,0,0,.5)),GN,kT(Lk(50))]),Xp(e.fiatType)),Xp(zR(e))]))},e$=function(e){return ZR(e)},t$=function(e){return f(Nk,F([kT($k),wT($k),KN]),f(mN,F([oN(12)]),F([Xp(e.info)])))},r$=function(e){return f(rc,xk,f(Gf,t$,el(e)))},n$=VR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),a$=function(e){return f(QR,f(za,wT(Lk(26)),e),n$)},i$=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,Iw,f(Gf,function(e){return e/100},f(Gf,ii,f(Gf,kg,f(Gf,bi(100),$l(t))))))));default:var n=r.a;return f(rc,f(Eo,n,t),f(Gf,Gi,f(Gf,kg,$l(t))))}},o$=function(e){var t=i$(e);return f($N,F([gN(4)]),F([a$(mr),f(Nk,F([oN(16)]),Xp(t))]))},u$=function(e){return o$(e)},s$=function(e){return{$:"TradeClicked",a:e}},c$=function(e){return f(bR,F([Dk(d(uR,16,7,234,.2)),jN(11),Jk(4),kT($k),oR(F([Dk(d(uR,16,7,234,.4))]))]),{label:f(Nk,F([lN,AA(l(Ik,16,7,234)),GN]),Xp("View Offer")),onPress:ba(s$(e))})},f$=i(function(e,t,r,n,a){return f($N,F([kT($k),gN(1)]),F([function(){switch(n.$){case"Open":return qN(L(2,d(FR,e,a,!1,t)));case"Committed":return qN(L(2,d(FR,e,a,$(r,ay),t)));case"Judgment":return qN(L(2,d(FR,e,a,$(r,Ff),t)));default:return xk}}(),qN(L(1,u$(a.parameters.tradeAmount))),qN(L(2,e$(a.terms.price))),qN(L(6,r$(a.terms.paymentMethods))),qN(L(2,c$(a.id)))]))}),l$=ow(28),d$=function(e){return f(wA,l$,l(TA,"bc-"+IA(e),"border-color",e))},h$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),p$=function(e){return f(wA,dA,h(h$,"b-"+Gi(e),e,e,e,e))},g$=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(kN,F([kT($k),wT($k),f(qk,30,10),gN(5)]),F([f($N,F([kT($k)]),F([$(r.viewPhase,aC)?xk:qN(L(2,zN(n))),qN(L(1,zN(a))),qN(L(2,zN("For Fiat"))),qN(L(6,zN("Payment Methods"))),qN(L(2,xk))])),f(kN,F([kT($k),p$(1),Jk(8),d$(kR),gN(1),Dk(kR),KN]),f(nu,d(f$,e,!$(r.userInfo,Ca),r.agentRole,r.viewPhase),t))]))}),v$=n(function(e,t,r){return $(f(ES,e,r),ba(t))}),y$=l(Ik,150,150,150),m$=function(e){return f(th,function(e){return Sb(e.parameters)},YE(e))},b$=n(function(e,t,r){var n=l(UN,_N(r),PN(),m$(t)),a=f(th,function(e){return l(v$,e,r.agentRole,r.agentAddress)&&$(e.state.phase,r.viewPhase)},n),i=function(e){return f(Nk,F([oN(24),nN,AA(y$),lN,jN(20)]),Xp(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(g$,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.")}),C$=r(function(e,t){return f(Nk,F([Jk(4),Dk(d(XR,0,0,1,.1)),AA(l(Ik,16,7,234)),oN(e),nN,f(qk,15,13)]),Xp(eh(t)))}),S$=a(function(e,t,r,n){return"pad-"+Gi(e)+"-"+Gi(t)+"-"+Gi(r)+"-"+Gi(n)}),E$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(wA,Hk,h(jk,"p-"+Gi(t),t,t,t,t)):f(wA,Hk,h(jk,d(S$,t,r,n,a),t,r,n,a))},T$=function(e){return function(){var t=e.userInfo;return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(Nk,F([f(qk,30,10),oN(24),nN]),Xp("Your Trades")):f($N,F([gN(10),E$({bottom:30,left:30,right:30,top:10})]),F([f(Nk,F([oN(24),nN]),Xp("Trade History for User")),f(C$,18,e.agentAddress)]))},w$=function(e){return{$:"ViewPhaseChanged",a:e}},I$=l(SA,0,0,1),A$=function(e){var t=F([oN(20),bN,Yk]),r=function(e){return e?O(t,F([AA(I$)])):t};return f($N,F([gN(30)]),F([f(Nk,O(F([tN(w$(io))]),r($(e,io))),Xp("Open")),f(Nk,O(F([tN(w$(iC))]),r($(e,iC))),Xp("Payment Due")),f(Nk,O(F([tN(w$(oC))]),r($(e,oC))),Xp("Release Due")),f(Nk,O(F([tN(w$(aC))]),r($(e,aC))),Xp("Closed"))]))},B$=function(e){return f(Nk,F([f(qk,30,10)]),A$(e.viewPhase))},k$=function(e){return{$:"ViewUserRoleChanged",a:e}},N$=d(uR,1,31,52,.13),R$=function(e){var t=F([oN(24),nN,Yk]),r=function(){return"Buyer"===e.$?L(t,O(t,F([AA(N$)]))):L(O(t,F([AA(N$)])),t)}(),n=r.a,a=r.b;return f($N,F([gN(20)]),F([f(Nk,O(F([tN(k$(Ff))]),a),Xp("As the Seller")),f(Nk,O(F([tN(k$(ay))]),n),Xp("As the Buyer"))]))},$$=function(e){return f(Nk,F([f(qk,30,10)]),R$(e.agentRole))},x$=n(function(e,t,r){return f(kN,F([Jk(5),Dk(Kk),kT($k),wT($k),f(qk,0,20)]),F([T$(r),$$(r),B$(r),l(b$,e,t,r)]))}),_$=function(e){return{$:"ShowCurrencyDropdown",a:e}},L$={$:"AbortCreate"},P$=r(function(e,t){return{$:"ConfirmCreate",a:e,b:t}}),D$=function(e){return f(nu,function(e){return F([f(Nk,F([AA(sN)]),Xp("Caution! ")),Xp(e)])},ZC(F([$(f(jg,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(jg,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])))},U$=function(e){return f(Nk,F([E$({bottom:5,left:5,right:5,top:0}),tN(e),Jk(30),Dk(d(XR,1,1,1,.4)),p$(1),d$(d(XR,0,0,0,.3)),Yk,oN(14)]),f(Nk,F([AA(d(XR,0,0,0,.7))]),Xp("x")))},O$=Hn,M$=O$,F$=NT,V$=r(function(e,t){return f(Nk,F([RR(f(Nk,F([Dk(e),F$(f(M$,"position","fixed")),F$(f(M$,"z-index","1000")),F$(f(M$,"top","0")),F$(f(M$,"left","0")),F$(f(M$,"width","100%")),F$(f(M$,"height","100%"))]),xk)),kT($k),wT($k)]),t)}),K$={$:"Top"},H$=ON(K$),j$={$:"InFront"},q$=function(e){return f(ZN,j$,e)},G$=r(function(e,t){return{$:"Max",a:e,b:t}}),z$=r(function(e,t){return f(G$,e,t)}),Y$=n(function(e,t,r){return l(ma,V$,d(XR,0,0,.3,.6),f(Nk,O(F([lN,FN,kT(f(z$,500,AT)),Dk(Kk),Jk(8),q$(f(Nk,F([IN,H$]),U$(r)))]),e),t))}),W$=r(function(e,t){if("Nothing"===t.$)return xk;var r=t.a;return f(Nk,O(F([Jk(5),d$(l(SA,.9,0,0)),p$(1),Dk(l(SA,1,.4,.4)),jN(5),lN,FN,kT(f(z$,200,AT)),oN(14)]),e),f(mN,mr,F([Xp(r)])))}),J$={$:"Above"},Q$=function(e){return f(ZN,J$,e)},X$=ow(26),Z$=function(e){return{$:"MoveY",a:e}},ex=function(e){return f(tR,X$,Z$(-e))},tx=r(function(e,t){return f(Nk,F([Jk(4),f(qk,25,17),oN(18),nN,Dk(kR),Q$(f(W$,F([ex(5)]),t))]),Xp(e))}),rx=d(uR,1,31,52,.64),nx=ow(32),ax={$:"Active"},ix=function(e){return f(wA,nx,f(QN,ax,iR(e)))},ox=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Nk,F([Jk(4),Yk,tN(n),f(qk,25,17),AA(t),oN(18),nN,Dk(a),ix(F([Dk(o)])),oR(F([Dk(i)]))]),Xp(r))}),ux=r(function(e,t){return d(ox,P(d(XR,1,0,0,1),d(XR,1,0,0,.8),d(XR,1,0,0,.6)),Kk,e,t)}),sx=ow(12),cx=f(zk,sx,UT.textCenter),fx=function(e){return V$(d(XR,0,0,.3,.6))(f(kN,F([gN(10),lN,FN,Dk(d(XR,0,0,0,.5)),Jk(8),jN(20)]),f(nu,function(e){return f(mN,F([lN,FN,oN(20),nN,AA(Kk),cx]),F([e]))},e)))},lx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+PA(t)}e.a;return"https://kovan.etherscan.io/tx/"+PA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+PA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+PA(t);case"XDai":e.a;return"https://blockscout.com/poa/dai/tx/"+PA(t);case"Rootstock":e.a;return"https://explorer.rsk.co/tx/"+PA(t);default:e.a;return""}}),dx={$:"Bottom"},hx=ON(dx),px=mA(UT.underline),gx=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(Xp(i$(Kv(n))),f(ux,"Yes, I definitely want to open this trade.",f(P$,r,n)))}return L(Xp("??"),f(tx,"(loading exact fees...)",Ca))}(),i=a.a,o=a.b;return l(Y$,mr,f(kN,F([gN(20),jN(20),lN,wT($k),cx]),F([f(Nk,F([oN(26),nN,lN,FN]),Xp("Just to Confirm...")),f(kN,F([gN(20),lN,FN]),f(nu,mN(F([lN,oN(18),GN,AA(rx)])),O(D$(r),O(F([F([Xp("You will deposit "),i,Xp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Xp("This ususally requires two Metamask signatures. Your "+n+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(Nk,F([hx,lN]),o)])),L$);case"ApproveNeedsSig":return fx(F([Xp("Waiting for user signature for the approve call."),Xp("(check Metamask!)"),Xp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var r=e.a,u=e.b;return fx(F([Xp("Mining the initial approve transaction..."),f(bA,F([px,AA(I$)]),{label:Xp("See the transaction on Etherscan"),url:f(lx,t.web3Context.factoryType,u)}),Xp("Funds will not leave your wallet until you sign the next transaction.")]));case"CreateNeedsSig":return fx(F([Xp("Waiting for user signature for the create call."),Xp("(check Metamask!)")]));default:var u=e.a;return fx(F([Xp("Mining the final create call..."),f(bA,F([px,AA(I$)]),{label:Xp("See the transaction on Etherscan"),url:f(lx,t.web3Context.factoryType,u)}),Xp("You will be redirected when it's mined.")]))}}),vx=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return xk;var r=t.a;return f(gx,r,e)},yx=function(e){return{$:"TradeAmountChanged",a:e}},mx=bT("id"),bx=F$(mx("inputError")),Cx=l(Ik,109,127,138),Sx=function(e){return f($N,F([gN(4)]),F([a$(mr),f(Nk,F([oN(24),GN,AA(Cx)]),Xp(Zf(e)))]))},Ex={$:"Left"},Tx=cN(Ex),wx=function(e){return{$:"HiddenLabel",a:e}},Ix=wx,Ax=bT("type"),Bx=function(e){return L(e,!0)},kx=function(e){return{$:"MayStopPropagation",a:e}},Nx=r(function(e,t){return f(Xk,e,kx(t))}),Rx=r(function(e,t){return l(Xa,Fd,t,e)}),$x=f(Rx,F(["target","value"]),Lo),xx=function(e){return f(Nx,"input",f(Bf,Bx,f(Bf,e,$x)))},_x=ow(0),Lx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),Px=function(e){var t=function(e){return 1-e}(f(qs,1,f(mi,0,e)));return f(wA,_x,f(Lx,"transparency-"+bw(t),t))},Dx=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),Ux=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(yA,BN,RT("label"),e,$T(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(yA,_T,kk,a,$T(F([i])));switch(n.$){case"Above":return d(yA,BN,RT("label"),e,$T(F([o,r])));case"Below":return d(yA,BN,RT("label"),e,$T(F([r,o])));case"OnRight":return d(yA,RN,RT("label"),e,$T(F([r,o])));default:return d(yA,RN,RT("label"),e,$T(F([o,r])))}}),Ox=VI,Mx=f(Af,NT,Ox("autocomplete")),Fx=l(SA,136/255,138/255,133/255),Vx=l(SA,186/255,189/255,182/255),Kx=f(qk,12,12),Hx=l(SA,1,1,1),jx=F([Kx,Jk(3),d$(Vx),Dk(Hx),p$(1),gN(3),kT($k)]),qx=function(e){return{$:"Label",a:e}},Gx=function(e){if("HiddenLabel"===e.$){var t=e.a;return vN(qx(t))}return eR},zx=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},Yx=function(e){return"HiddenLabel"===e.$},Wx=cR("spellcheck"),Jx=f(Af,NT,Wx),Qx=J,Xx=ow(47),Zx=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Fi(Qx(e))),o=(i-1)*t+f(rc,0,f(Gf,a,r))+f(rc,0,f(Gf,a,n));return f(wA,Xx,l(QI,"textarea-height-"+Gi(i),"height",function(e){return"calc("+Gi(e)+"em + "+Gi(o)+"px) !important"}(i)))}),e_=bT("value"),t_=f(Af,NT,e_),r_={$:"LivePolite"},n_=vN(r_),a_=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(yw,"width",n)?L(r,n):L(f(za,e,r),f(RE,"width",n));case"Height":e.a;return f(yw,"height",n)?L(r,n):L(f(za,e,r),f(RE,"height",n));case"Describe":e.a;return f(yw,"described",n)?L(r,n):L(f(za,e,r),f(RE,"described",n));case"Nearby":e.a,e.b;return L(f(za,e,r),n);case"AlignX":return f(yw,"align-x",n)?L(r,n):L(f(za,e,r),f(RE,"align-x",n));case"AlignY":return f(yw,"align-y",n)?L(r,n):L(f(za,e,r),f(RE,"align-y",n));default:return f(yw,"transform",n)?L(r,n):L(f(za,e,r),f(RE,"transform",n))}}),L(mr,Cm),e).a},i_=r(function(e,t){return l(Xa,r(function(e,r){return t(e)?f(za,e,r):r}),mr,a_(e))}),o_=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}},u_=f(Af,Lf,Fu),s_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([NT(xx(n.onChange))]),o=O(jx,t),u=f(i_,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,zx,o),c=f(i_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(i_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(i_,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([t_(n.text),NT(Ax(a)),Jx(e.spellchecked),mA(UT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return eR;var r=t.a;return Mx(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(o_(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(Dx,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(Dx,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([Jx(e.spellchecked),mA(UT.inputMultiline),f(rc,eR,f(Gf,Mx,e.autofill)),function(){if("Nothing"===u.$)return eR;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return E$({bottom:f(mi,0,n-(v/2|0)),left:a,right:r,top:f(mi,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?eR:s.a?d(Zx,n.text,v,u,g):eR}()]),h),F([u_(UI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(yA,_T,kk,f(za,kT($k),cy(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([q$(f(Nk,f(za,Kx,O(s,O(F([AA(Fx),mA(UT.noTextSelection+" "+UT.passPointerEvents),d$(d(XR,0,0,0,0)),Dk(d(XR,0,0,0,0)),wT($k),kT($k),Px(""===n.text?1:0)]),r))),a))])}()]))),$T(F([d(yA,_T,RT(v),cy(F([F([hR(t),Gx(n.label)]),y,i])),$T(m))])));return l(Ux,f(za,f(zk,Gk,UT.cursorText),f(za,Yx(n.label)?eR:gN(5),f(za,n_,u))),n.label,b)}),c_=s_({autofill:Ca,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),f_=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(c_,F([kT($k),wT(Lk(40)),p$(0)]),{label:Ix(r),onChange:i,placeholder:n,text:a});return f($N,O(F([gN(5)]),e),ZC(F([f(Gf,Nk(F([Tx])),o),ba(s),f(Gf,Nk(F([IN])),u)])))}),l_={$:"Below"},d_=function(e){return f(ZN,l_,e)},h_=function(e){return f(tR,X$,Z$(e))},p_=n(function(e,t,r){return p(f_,F([kT(Lk(150)),GN,oN(24),d_(f(W$,F([bx,h_(5)]),r))]),L(Ca,ba(Sx(e))),"dai input",Ca,t,yx)}),g_=r(function(e,t){return f(wA,dA,h(h$,"b-"+Gi(e)+"-"+Gi(t),t,e,t,e))}),v_=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?p$(r):f(g_,n,r):f(wA,dA,h(h$,"b-"+Gi(r)+"-"+Gi(a)+"-"+Gi(t)+"-"+Gi(n),r,a,t,n))},y_=Nk(F([d$(kR),v_({bottom:2,left:0,right:0,top:0})])),m_=r(function(e,t){return f(kN,F([gN(10)]),F([f(Nk,F([oN(17),nN]),Xp(e)),t]))}),b_=function(e){return y_(f(m_,function(){return"Buyer"===e.inputs.userRole.$?"You're buying":"You're selling"}(),l(p_,e.web3Context.factoryType,e.inputs.daiAmount,e.errors.daiAmount)))},C_=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 "+i$(f(Yf,r,100))+" "+Zf(e.web3Context.factoryType)+"."}return"There is a 1% fee."}();return f($N,F([lN,f(qk,20,10),Dk(l(Ik,10,33,108)),Jk(8),gN(5)]),F([f(Nk,F([oN(18),AA(l(Ik,0,226,255)),nN]),Xp(t)),f(Nk,F([oN(17),AA(Kk),GN]),Xp("We only collect this fee when trades resolve successfully."))]))},S_=function(e){return{$:"FiatAmountChanged",a:e}},E_=function(e){return{$:"FiatTypeChanged",a:e}},T_=r(function(e,t){return l(AE,n(function(t,r,n){return f(e,t,r)?l(Nh,t,r,n):n}),Eh,t)}),w_=function(e){return f(T_,r(function(t,r){return f(yg,e,t)}),HR)},I_=VR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),A_=function(e){return f(QR,F([wT(Lk(26))]),f(rc,I_,f(Gf,Ro,f(Th,e,HR))))},B_=function(e){return F$(f(Nx,"click",Po(L(e,!0))))},k_=u_,N_=function(e){return{$:"AppendProperty",a:e}},R_=r(function(e,t){return N_(e+":"+t)}),$_=r(function(e,t){return f(R_,e,t.value)}),x_=$_("cursor"),__={$:"Compatible"},L_={cursor:__,value:"default"},P_=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),D_=function(e){return{$:"PseudoClassSelector",a:e}},U_=function(e){return P_(D_(e))}("hover"),O_=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),M_=O_,F_=M_,V_=F_("span"),K_=r(function(e,t){return f(jn,at(e),ot(t))}),H_=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),j_=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),q_=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),G_=r(function(e,t){return t<>>32-e}),z_=function(e){var t=e.hash?e.seed^f(q_,461845907,f(G_,15,f(q_,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(q_,2246822507,r^r>>>16),a=f(q_,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Y_=r(function(e,t){return f(q_,5,f(G_,13,e^f(q_,461845907,f(G_,15,f(q_,3432918353,t)))))+3864292196}),W_=r(function(e,t){var r=t.hash|(255&Li(e))<";default:return""}},nP=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+"]"}},aP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(zi,"",f(za,t,f(nu,nP,r)));case"UniversalSelectorSequence":var r=e.a;return Go(r)?"*":f(zi,"",f(nu,nP,r));default:var t=e.a,r=e.b;return f(zi,"",f(za,t,f(nu,nP,r)))}},iP=function(e){var t=e.a,r=e.b;return f(zi," ",F([rP(t),aP(r)]))},oP=function(e){var t=e.a,r=e.b,n=e.c,a=f(za,aP(t),f(nu,iP,r)),i=f(zi,"",F([f(rc,"",f(Gf,tP,n))]));return f(ks,f(zi," ",f(th,f(Af,Iu,Dl),a)),i)},uP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(zi,", ",f(nu,oP,f(za,r,n)));return f(zi,"",F([i," {\n",e,eP(a),"\n",e,"}"]))}),sP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(uP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(zi,",\n",f(nu,YL,r))+" {\n"+f(zi,"\n\n",f(nu,f(Af,XL,uP(" ")),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"}},cP=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([qL(t),f(zi,"\n",f(nu,JL,r)),f(zi,"\n",f(nu,QL,n)),f(zi,"\n\n",f(nu,sP,a))])))},fP=function(e){return cP(jL(VL(e)))},lP=function(e){return f(zi,"\n\n",f(nu,fP,e))},dP=function(e){return{$:"Snippet",a:e}},hP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),pP=function(e){return{$:"StyleBlockDeclaration",a:e}},gP=r(function(e,t){var r=l(pL,t,mr,Ca);return dP(F([pP(l(hP,r,mr,e))]))}),vP=function(e){return Go(e)?"unstyled":f(zu,D("_"),ns(f(J_,15739,lP(_E(Q_(_E(f(gP,e,AL(mr)))))))))},yP=function(e){var t=vP(e),r=f(K_,"className",Yd(t));return l(H_,r,e,t)},mP=a(function(e,t,r,n){return f(e,f(za,yP(t),r),n)}),bP=function(e){return{$:"Unstyled",a:e}},CP=function(e){return bP(Rw(e))},SP=CP,EP=r(function(e,t){return f(Mn,e,rt(t))}),TP=function(e){return Un(rt(e))},wP=r(function(e,t){var r=e.b,n=e.c;return Go(r)?t:l(Nh,n,r,t)}),IP=function(e){return e.a},AP=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,wP,i,s),p=l(Wa,BP,L(mr,h),c),g=p.a,v=p.b,o=l(nw,u,f(nu,IP,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,wP,i,s),m=l(Wa,BP,L(mr,h),c),g=m.a,v=m.b,o=d(TP,y,u,f(nu,IP,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,wP,i,s),b=l(Wa,AP,L(mr,h),c),g=b.a,v=b.b,o=l(rw,u,f(nu,IP,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,wP,i,s),C=l(Wa,AP,L(mr,h),c),g=C.a,v=C.b,o=d(EP,y,u,f(nu,IP,s),Ja(g));return L(f(za,L(r,o),a),v)}}),BP=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,wP,n,o),c=l(Wa,BP,L(mr,s),u),h=c.a,p=c.b,a=l(nw,i,f(nu,IP,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,wP,n,o),v=l(Wa,BP,L(mr,s),u),h=v.a,p=v.b,a=d(TP,g,i,f(nu,IP,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,wP,n,o),y=l(Wa,AP,L(mr,s),u),h=y.a,p=y.b,a=l(rw,i,f(nu,IP,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,wP,n,o),m=l(Wa,AP,L(mr,s),u),h=m.a,p=m.b,a=d(EP,g,i,f(nu,IP,o),Ja(h));return L(f(za,a,r),p)}}),kP=r(function(e,t){return h(Ih,wh,e,t,Sh,Sh)}),NP=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}}}),RP=function(e){var t=f(NP,Ca,e);if("Nothing"===t.$)return Eh;var r=t.a,n=r.a,a=r.b;return f(kP,n,a)},$P=function(e){return{$:"ClassSelector",a:e}},xP=function(e){var t=e.a,r=e.b;return f(gP,r,AL(F([$P(t)])))},_P=function(e){return lP(_E(Q_(f(nu,xP,ja(e)))))},LP=function(e){return l(nw,"style",mr,_E(Rw(_P(e))))},PP=n(function(e,t,r){var n=f(nu,IP,t),a=RP(t),i=l(Wa,BP,L(mr,a),r),o=i.a,u=i.b,s=LP(u);return l(nw,e,n,f(za,s,Ja(o)))}),DP=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}}),UP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(DP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),OP=r(function(e,t){return L(f(UP,"_",t),LP(e))}),MP=n(function(e,t,r){var n=f(nu,IP,t),a=RP(t),i=l(Wa,AP,L(mr,a),r),o=i.a,u=i.b,s=f(OP,u,o);return l(rw,e,n,f(za,s,Ja(o)))}),FP=a(function(e,t,r,n){var a=f(nu,IP,r),i=RP(r),o=l(Wa,AP,L(mr,i),n),u=o.a,s=o.b,c=f(OP,s,u);return d(EP,e,t,a,f(za,c,Ja(u)))}),VP=a(function(e,t,r,n){var a=f(nu,IP,r),i=RP(r),o=l(Wa,BP,L(mr,i),n),u=o.a,s=o.b,c=LP(s);return d(TP,e,t,a,f(za,c,Ja(u)))}),KP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(PP,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(VP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(MP,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(FP,a,t,r,n)}},HP=KP,jP=function(e){return k_(HP(d(mP,V_,F([U_(F([x_(L_)]))]),mr,F([SP(e)]))))},qP=Q,GP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),zP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),YP=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(GP,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(zP,a,t,i))}return Ca}())}),L(Ca,Ca),e)},WP=r(function(e,t){var r=YP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(yA,RN,kk,f(za,mA(UT.contentLeft+" "+UT.contentCenterY+" "+UT.wrapped),f(za,kT(AT),f(za,wT(AT),e))),$T(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(E$({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(yA,RN,kk,f(za,mA(UT.contentLeft+" "+UT.contentCenterY+" "+UT.wrapped),f(za,kT(AT),f(za,wT(AT),O(e,F([h]))))),$T(t))}var p=-s/2,g=-u/2;return d(yA,_T,kk,e,$T(F([d(yA,RN,kk,f(za,mA(UT.contentLeft+" "+UT.contentCenterY+" "+UT.wrapped),f(za,NT(f(M$,"margin",Iw(p)+"px "+Iw(g)+"px")),f(za,NT(f(M$,"width","calc(100% + "+Gi(u)+"px)")),f(za,NT(f(M$,"height","calc(100% + "+Gi(s)+"px)")),f(za,f(wA,dN,l(hN,o,u,s)),mr))))),$T(t))])))}),JP=a(function(e,t,r,n){var a=f(c_,F([kT(Lk(80)),wT(Lk(40)),oN(24),GN,d$(kR),B_(r)]),{label:Ix("currency type"),onChange:f(_a,qP,n),placeholder:Ca,text:t}),i=f(Th,t,HR),o=function(){var r=L(e,i);if(r.a){if("Just"===r.b.$)return xk;r.b;return f(WP,F([kT(Lk(350)),d$(BR),p$(1),Dk(Kk),jN(10),lN]),f(nu,function(e){var t=e.a,r=e.b,a=r.b;return f($N,F([kT(Lk(80)),gN(9),f(qk,0,5),B_(n(t)),oR(F([Dk(l(SA,.8,.8,1))]))]),F([f(QR,F([wT(Lk(26))]),a),f(Nk,F([oN(16),nN]),jP(t))]))},ja(w_(t))))}return xk}();return f($N,F([gN(4),d_(o)]),F([A_(t),a]))}),QP=i(function(e,t,r,n,a){var i=Xp(jR(e)),o=f(Nk,F([d_(f(W$,F([bx,h_(5)]),a))]),d(JP,r,e,_$(!0),E_));return p(f_,F([kT(Lk(250)),GN,oN(24),d_(f(W$,F([bx,h_(5)]),n))]),L(ba(i),ba(o)),"fiat input",Ca,t,S_)}),XP=function(e){return y_(f(m_,"For fiat",h(QP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},ZP=function(e){return{$:"ChangeRole",a:e}},eD=r(function(e,t){var r=F([oN(24),GN,Yk]),n=function(){return"Buyer"===t.$?L(r,O(r,F([AA(N$)]))):L(O(r,F([AA(N$)])),r)}(),a=n.a,i=n.b;return f($N,F([gN(20)]),F([f(Nk,O(F([tN(ZP(Ff))]),i),Xp("Sell "+Zf(e))),f(Nk,O(F([tN(ZP(ay))]),a),Xp("Buy "+Zf(e)))]))}),tD=function(e){return f(m_,"Trade Type",f(eD,e.web3Context.factoryType,e.inputs.userRole))},rD=ow(19),nD=function(e){return Tl(F([e.inset?"box-inset":"box-",Iw(e.offset.a)+"px",Iw(e.offset.b)+"px",Iw(e.blur)+"px",Iw(e.size)+"px",IA(e.color)]))},aD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(wA,rD,l(QI,nD(t),"box-shadow",Bw(t)))},iD=aD({blur:20,color:d(uR,0,0,0,.04),offset:L(0,3),size:0}),oD=f(zk,dN,UT.spaceEvenly),uD=function(e){return f(kN,F([kT($k),gN(20),Dk(Kk),Jk(5),jN(20),iD]),F([f($N,F([kT($k),oD]),F([tD(e),b_(e),XP(e)])),C_(e)]))},sD=function(e){return{$:"CreateClicked",a:e}},cD={$:"Web3Connect"},fD=function(e){return f(Nk,F([lN]),function(){if("Just"===e.$){var t=e.a;return f(ux,"Open Trade",sD(t))}return f(ux,"Connect to Wallet",cD)}())},lD=function(e){return{$:"AutoabortIntervalChanged",a:e}},dD=function(e){return{$:"ChangePaymentMethodText",a:e}},hD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),pD=hD,gD=function(e){return f(pD,mr,function(){return Xp("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")}())},vD={$:"TextArea"},yD=r(function(e,t){return l(s_,{autofill:Ca,spellchecked:t.spellcheck,type_:vD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),mD=n(function(e,t,r){var n=f(Nk,F([oN(22),nN]),Xp("Payment Method")),a=f(yD,F([kT($k),wT(Lk(150)),Dk(d(XR,1,1,1,.5))]),{label:Ix("payment method"),onChange:dD,placeholder:""===r?ba(gD(t)):Ca,spellcheck:!0,text:r});return f(kN,F([gN(10),kT($k),Q$(f(W$,F([bx,h_(30),jN(10),oN(20),kT(Lk(400))]),e))]),F([n,a]))}),bD=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 to 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."},CD=a(function(e,t,r,n){var a=l(Xu,e,D("0"),Gi(n));return f(Nk,F([oN(22),AA(t)]),Xp(O(a,r)))}),SD=function(e){return Yl(e)<0?Kf(0):e},ED=VR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),TD=VR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),wD=n(function(e,t,n){var a=r(function(e,r){return f(kN,F([gN(4)]),F([f(Nk,F([jN(4),Yk,tN(n(f(Ib,t,e)))]),f(QR,F([wT(Lk(10))]),TD)),r,f(Nk,F([jN(4),Yk,tN(n(function(e){return Yl(e)?e:Kf(3e5)}(SD(f(wR,t,e)))))]),f(QR,F([wT(Lk(10))]),ED))]))}),i=PR(t);return f($N,F([oD,gN(10)]),F([f(a,Kf(864e5),d(CD,3,e," days",i.days)),f(a,Kf(36e5),d(CD,2,e," hours",i.hours)),f(a,Kf(3e5),d(CD,2,e," min",i.min))]))}),ID=o(function(e,t,r,n,a,i){var o=f(kN,F([gN(6)]),F([f(Nk,F([oN(22),nN]),Xp(t)),f(Nk,F([Dk(d(XR,1,1,1,.5)),Jk(5),jN(5),aD({blur:4,color:d(XR,0,0,0,.15),offset:L(-3,3),size:0}),Q$(f(W$,F([bx]),a))]),l(wD,BR,n,i))])),u=f(Nk,F([kT(Lk(80))]),f(QR,F([lN]),e)),s=f(mN,F([oN(17),GN,AA(rx)]),F([Xp(r)]));return f($N,F([kT($k),gN(15),Jk(10)]),F([u,o,s]))}),AD=d(XR,0,0,1,.2),BD=VR({description:"",src:"/DAIHard/static/img/payment-window-icon.svg"}),kD=i(function(e,t,r,n,a){return f(kN,F([jN(8),gN(15),Jk(8),Dk(AD),aD({blur:5,color:d(XR,0,0,0,.3),offset:L(-3,3),size:0})]),F([p(ID,BD,"Payment Window",bD(a),r,n,lD),l(mD,t,a,e)]))}),ND=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},RD=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."},$D=VR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),xD=n(function(e,t,r){return f(Nk,F([jN(8),Jk(8),Dk(AD),aD({blur:5,color:d(XR,0,0,0,.3),offset:L(-3,3),size:0})]),p(ID,$D,"Judgment Window",RD(r),e,t,ND))}),_D=function(e){return{$:"AutorecallIntervalChanged",a:e}},LD=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."},PD=VR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),DD=n(function(e,t,r){return f(Nk,F([jN(8),Jk(8),Dk(AD),aD({blur:5,color:d(XR,0,0,0,.3),offset:L(-3,3),size:0})]),p(ID,PD,"Open Window",LD(r),e,t,_D))}),UD=function(e){return f(kN,F([kT($k),f(qk,10,0),gN(20)]),F([l(DD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(kD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(xD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},OD=function(e){return f(kN,F([kT(f(z$,1e3,$k)),lN,gN(20),E$({bottom:30,left:40,right:40,top:0}),tN(_$(!1)),q$(vx(e))]),F([uD(e),UD(e),fD(e.userInfo)]))},MD=Yu(jm(8226)),FD=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}),VD=r(function(e,t){return l(Wa,za,t,e)}),KD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(VD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HD=r(function(e,t){var r=Fi(t);return!r||$(r,e)?t:_(r,e)<0?Ja(f(VD,f(_s,e%r,t),l(KD,mr,e/r|0,t))):f(_s,e,t)}),jD=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(yw,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(RE,o,t),c=i,l=f(za,a,n);e=u,t=s,r=c,n=l}}}),qD=function(e){return d(jD,no,Cm,e,mr)},GD=r(function(e,t){return f(Nk,F([kT($k),q$(f($N,F([gN(3),kT(HN(100)),kT(t),KN]),f(FD,f(Nk,F([AA(d(XR,0,0,0,.1)),oN(14)]),Xp(MD)),f(nu,f(Af,Nk(F([AA(d(XR,0,0,0,.2))])),Xp),f(HD,100,(e?Ja:no)(qD(f(nu,f(_a,Ro,gi),ja(HR)))))))))]),Xp(" "))}),zD=function(e){return f(kN,F([kT($k),wT($k),Dk(Kk),Jk(6),aD({blur:20,color:d(uR,0,0,0,.1),offset:L(0,3),size:0}),Jk(10),oD,jN(20)]),F([f(GD,!1,$k),f(kN,F([lN,gN(15),kT(f(z$,700,$k))]),f(nu,mN(F([kT($k),oN(17),GN,AA(rx),cx])),F([F([f(Nk,F([oN(22),AA(BR)]),Xp("Hold on a second!"))]),F([Xp("This version of DAIHard is live and functional, but a Factory upgrade is coming soon.")]),F([Xp("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([Xp("If you'd like to keep up to date with our upgrades and progress, join our "),f(bA,F([AA(I$),px]),{label:Xp("Telegram group"),url:"https://t.me/daihardexchange_group"}),Xp(".")])]))),f(Nk,F([lN,tN(pT(Ef({category:"landing-page",event:"lets-go-clicked",label:'"Let\'s Go" clicked',value:0})))]),f(ux,"Okay, got it. let's go!",e)),f(GD,!0,$k)]))},YD=function(e){return{$:"ShowCurrencyDropdown",a:e}},WD=n(function(e,t,r){return f(_a,th(t(e)),DN(r))}),JD={$:"AutoabortWindow"},QD={$:"AutoreleaseWindow"},XD={$:"Expiring"},ZD={$:"Fiat"},eU={$:"Margin"},tU={$:"TradeAmount"},rU=function(e){var t=e.a,r=e.b;return f(Nk,F([kT(HN(t)),wT(Lk(60)),KN,Dk(Kk)]),f(Nk,F([jN(12),FN,kT($k)]),r))},nU={$:"Descending"},aU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),iU=function(e){return f(Nk,F([GN,oN(17)]),Xp(e))},oU=n(function(e,t,r){return f($N,F([gN(8)]),F([iU(e),f(kN,F([gN(2)]),F([f(Nk,F([jN(4),Yk,tN(f(aU,t,fv))]),f(QR,F([kT(Lk(8)),lN,FN]),TD)),f(Nk,F([jN(4),Yk,tN(f(aU,t,nU))]),f(QR,F([kT(Lk(8)),lN,FN]),ED))]))]))}),uU=r(function(e,t){var r=function(){return"Buyer"===e.$?sN:xR}(),n=_(Yl(t.parameters.autoabortInterval),216e5)<0?r:BR;return d(DR,mr,mr,L(n,kR),t.parameters.autoabortInterval)}),sU=r(function(e,t){var r=function(){return"Buyer"===e.$?xR:sN}(),n=_(Yl(t.parameters.autoabortInterval),216e5)<0?r:BR;return d(DR,mr,mr,L(n,kR),t.parameters.autoreleaseInterval)}),cU=r(function(e,t){var r=f(IR,e,t);if("TimeLeft"===r.$){var n=r.a,a=f(OR,n.a,n.b)<.05?sN:BR;return d(MR,F([kT($k)]),F([oN(16)]),L(a,kR),n)}var i=r.a;return d(MR,F([kT($k)]),F([oN(16)]),L(sN,kR),L(Kf(0),i))}),fU=function(e){return ZR(e.terms.price)},lU=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,Iw(r)))}return""}()+"%")},dU=r(function(e,t){return VR({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"}()})}),hU=n(function(e,t,r){return f(QR,f(za,wT(Lk(34)),e),f(dU,t,r))}),pU=r(function(e,t){var r=lU(t);if("0%"===r)return f(Nk,F([oN(16)]),Xp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?xR:sN;return f($N,F([gN(4)]),F([l(hU,mr,a,ba(i)),f(Nk,F([AA(o),oN(16)]),Xp(n))]))}),gU=r(function(e,t){return f(rc,xk,f(Gf,pU(t),e.derived.margin))}),vU=function(e){return f(rc,xk,f(Gf,t$,el(e)))},yU=function(e){return o$(e.parameters.tradeAmount)},mU=function(e){return{$:"TradeClicked",a:e}},bU=function(e){return f(bR,F([Dk(d(uR,16,7,234,.2)),jN(11),Jk(4),kT($k),oR(F([Dk(d(uR,16,7,234,.4))]))]),{label:f(Nk,F([lN,AA(l(Ik,16,7,234)),GN]),Xp("View Offer")),onPress:ba(mU(e))})},CU=n(function(e,t,r){return f($N,F([kT($k),gN(1),Dk(kR)]),F([f(kN,F([kT($k),gN(1),kT(HN(7))]),F([f($N,F([kT(HN(6)),gN(1)]),f(nu,rU,F([L(2,f(cU,e,r)),L(1,yU(r)),L(2,fU(r)),L(1,f(gU,r,!$(t,ay))),L(2,f(uU,t,r)),L(2,f(sU,t,r))]))),rU(L(1,vU(r.terms.paymentMethods)))])),f(Nk,F([kT(HN(1)),wT($k),KN,Dk(Kk)]),f(Nk,F([lN,FN]),bU(r.id)))]))}),SU=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(kN,F([kT($k),wT($k),jN(30),gN(5)]),F([f($N,F([kT($k)]),F([f($N,F([kT(HN(7))]),F([rU(L(2,l(oU,"Expires",XD,Ca))),rU(L(1,l(oU,n,tU,Ca))),rU(L(2,l(oU,"For Fiat",ZD,Ca))),rU(L(1,l(oU,"Margin",eU,Ca))),rU(L(2,l(oU,"Payment Window",JD,Ca))),rU(L(2,l(oU,"Auto-Release",QD,Ca)))])),f(Nk,F([kT(HN(1))]),xk)])),f(kN,F([kT($k),p$(2),Jk(8),d$(y$),gN(1),Dk(y$),KN]),f(nu,f(CU,e,r.browsingRole),t))]))}),EU=n(function(e,t,r){var n=d(WD,e,r.filterFunc,r.sortFunc,m$(t)),a=function(e){return f(Nk,F([oN(24),nN,AA(y$),lN,jN(20)]),Xp(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(SU,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.")}),TU={$:"ApplyInputs"},wU=f(bR,F([Dk(I$),jN(10),Jk(5)]),{label:f(Nk,F([AA(Kk),lN,FN]),Xp("Apply")),onPress:ba(TU)}),IU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(wA,Wk,l(QI,"br-"+Gi(t)+"-"+Gi(r)+Gi(n)+"-"+Gi(a),"border-radius",Gi(t)+"px "+Gi(r)+"px "+Gi(a)+"px "+Gi(n)+"px"))},AU=function(e){return f(Zk,"focus",Po(e))},BU=f(Af,NT,AU),kU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([BU(e(!0)),B_(e(!0))])}();return f($N,O(e,F([wT(Lk(40)),aD({blur:20,color:d(uR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Nk,F([Dk(kR),wT(Lk(40)),IU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Nk,F([FN,f(qk,10,0)]),r)),f(c_,O(s,O(t,F([kT(Lk(100)),wT(Lk(40)),d$(kR),IU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),v_({bottom:1,left:0,right:1,top:1})]))),{label:Ix(n),onChange:u,placeholder:i,text:a})]))}),NU=function(e){return{$:"MaxDaiChanged",a:e}},RU=function(e){return{$:"MinDaiChanged",a:e}},$U=r(function(e,t){return f(kN,F([kT($k),gN(8)]),F([f(Nk,F([oN(17),GN]),Xp(e)),t]))}),xU=ow(25),_U=function(e){return{$:"MoveX",a:e}},LU=function(e){return f(tR,xU,_U(-e))},PU={$:"OnLeft"},DU=function(e){return f(ZN,PU,e)},UU=a(function(e,t,r,n){var a=a$(F([FN])),i=f($N,F([gN(8),FN,kT(Lk(60))]),F([a,f(Nk,F([oN(16),FN]),Xp("max"))])),o=f($N,F([gN(8),FN,kT(Lk(60))]),F([a,f(Nk,F([oN(16),FN]),Xp("min"))]));return f($U,Zf(e)+" Range",f(kN,F([gN(5),kT(Lk(200))]),F([v(kU,F([DU(f(W$,F([LU(5),kT(Lk(200))]),n.minDai))]),F([BU(YD(!1))]),o,"min "+Zf(e),t,Ca,Ca,RU),v(kU,F([DU(f(W$,F([LU(5),kT(Lk(200))]),n.maxDai))]),F([BU(YD(!1))]),i,"max "+Zf(e),r,Ca,Ca,NU)])))}),OU=function(e){var t=f(Th,e,HR);if("Nothing"===t.$)return Xp("*");var r=t.a,n=r.b;return f(QR,F([wT(Lk(26))]),n)},MU=function(e){return{$:"FiatTypeInputChanged",a:e}},FU=function(e){return{$:"MaxFiatChanged",a:e}},VU=function(e){return{$:"MinFiatChanged",a:e}},KU=i(function(e,t,r,n,a){var i=OU(t),o=f($N,F([gN(8),FN,kT(Lk(60))]),F([i,f(Nk,F([oN(16),FN]),Xp("max"))])),u=f($N,F([gN(8),FN,kT(Lk(60))]),F([i,f(Nk,F([oN(16),FN]),Xp("min"))]));return f($U,"Fiat Type",f($N,F([gN(5),kT(AT)]),F([f(Nk,F([H$,kT(Lk(120))]),d(JP,e,t,YD(!0),MU)),f(kN,F([gN(5),H$,kT(Lk(200))]),F([v(kU,F([Q$(f(W$,F([ex(5),kT(f(z$,200,AT))]),a.minFiat))]),F([BU(YD(!1))]),u,"min",r,Ca,Ca,VU),v(kU,F([d_(f(W$,F([h_(5),kT(f(z$,200,AT))]),a.maxFiat))]),F([BU(YD(!1))]),o,"max",n,Ca,Ca,FU)]))])))}),HU={$:"AddSearchTerm"},jU=function(e){return{$:"PaymentMethodInputChanged",a:e}},qU=f(Fd,"keyCode",tS),GU=function(e){return f(Zk,"keyup",f(xo,function(t){return 13===t?Po(e):_o(Gi(t))},qU))},zU=function(e){return f($U,"Search Payment Methods",f(c_,F([H$,kT(Lk(250)),wT(Lk(40)),d$(kR),aD({blur:20,color:d(uR,233,237,242,.05),offset:L(0,3),size:0}),F$(GU(HU))]),{label:Ix("payment methods search"),onChange:jU,placeholder:Ca,text:e}))},YU={$:"ResetSearch"},WU=f(bR,F([Dk(I$),jN(10),Jk(5)]),{label:f(Nk,F([AA(Kk),lN,FN]),Xp("Reset")),onPress:ba(YU)}),JU=function(e){return{$:"RemoveTerm",a:e}},QU=function(e){return f(Nk,F([jN(3),H$,Yk,tN(JU(e)),oN(10),AA(sN)]),Xp("x"))},XU=function(e){if(e.b){var t=e;return f($N,F([kT($k),jN(10),gN(10)]),f(nu,function(e){return f($N,F([Dk(d(uR,16,7,234,.2)),Jk(5),jN(4),gN(3)]),F([Xp(e),QU(e)]))},t))}return xk},ZU=a(function(e,t,r,n){return f(kN,F([gN(10),kT(AT),lN]),F([f($N,F([kT(AT),gN(10)]),F([f(Nk,F([kT(AT),H$]),d(UU,e,t.minDai,t.maxDai,r)),f(Nk,F([kT(AT),H$]),h(KU,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(kN,F([kT(AT),H$,gN(5)]),F([zU(t.paymentMethod),XU(t.paymentMethodTerms)])),f($U," ",f(kN,F([gN(5),kT(AT)]),F([wU,WU])))]))]))}),eO=n(function(e,t,r){return f(kN,F([Jk(5),Dk(Kk),kT($k),wT($k),tN(YD(!1))]),F([f($N,F([kT($k),gN(10),jN(30)]),F([d(ZU,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(EU,e,t,r)]))}),tO=f(_a,hu,Rm("USD")),rO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),nO=function(e){return Kv(f(xu,f(yl,hu(10),hu(18)),hu(e)))},aO=F([d(rO,Ff,nO(5),tO(4),P(Kf(1728e5),Kf(1728e5),Kf(2592e5))),d(rO,ay,nO(2),tO(7),P(Kf(1728e5),Kf(1728e5),Kf(2592e5)))]),iO=function(e){return f(Yf,Mv(e),3)},oO=UR,uO=r(function(e,t){return i$(t)+" "+Zf(e)}),sO=r(function(e,t){return f(Nk,F([AA(oO),oN(20)]),Xp(f(uO,e,t)))}),cO=xR,fO=function(e){return"$"+Il(e.amount)+" USD"},lO=function(e){return f(Nk,F([AA(cO),oN(20)]),Xp(fO(e)))},dO=function(e){return $(e,Kf(6048e5))?Xp("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!!")},hO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(sO,e,f(dd,Mv(t),iO(t))):lO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(kN,F([gN(5)]),F([f(sO,e,t.daiAmountIn),lO(t.fiatValue)])):f(sO,e,t.daiAmountIn)}(),a=dO(function(e){var t=e.a,r=e.b,n=e.c;return f(Ib,n,f(Ib,r,t))}(t.intervals)),i=Xp("---\x3e");return f(kN,F([gN(8)]),F([f($N,F([gN(4)]),F([n,i,r])),a]))}),pO=r(function(e,t){return d(ox,P(d(XR,0,0,1,1),d(XR,0,0,1,.8),d(XR,0,0,1,.6)),Kk,e,t)}),gO=function(e){return{$:"StartClicked",a:e}},vO=function(e){return f(pO,"Start",gO(e))},yO=n(function(e,t,r){return f($N,F([gN(40)]),F([f(hO,e,r),t?vO(r):xk]))}),mO=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),bO=r(function(e,t){if("Just"!==e.$)return f(tx,"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 xk;var n=t.a,a=t.b;switch(a.$){case"ApproveMining":a.a;return f(tx,"Mining Prepare tx...",Ca);case"ReadyToOpen":return f(ux,"Open Trade",f(mO,r,n));case"OpenNeedsSig":default:return xk}}),CO=function(e){return{$:"TextInputChanged",a:e}},SO=function(e){return f(pD,mr,f(kN,F([gN(5)]),f(nu,f(Af,mN(mr),_E),function(){return F("Buyer"===e.$?[Xp("Some ideas:"),f(Nk,F([EN]),Xp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Nk,F([EN]),Xp("I'll send you $7 in Steam credit.")),f(Nk,F([EN]),Xp("TransferWise")),f(Nk,F([EN]),Xp("Cash drop in Hume Park, Bulawayo"))]:[Xp("Some ideas:"),f(Nk,F([EN]),Xp("I accept money orders or cashier checks into my Schwab bank account.")),f(Nk,F([EN]),Xp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Nk,F([EN]),Xp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Nk,F([EN]),Xp("Ship me a potato."))])}())))},EO=r(function(e,t){return f(yD,F([kT($k),wT(Lk(200))]),{label:Ix("payment details"),onChange:CO,placeholder:""===t?ba(SO(e)):Ca,spellcheck:!0,text:t})}),TO=r(function(e,t){return f(kN,F([gN(10)]),f(nu,mN(mr),F([function(){return F("Seller"===e.$?[Xp("How must the "),lO(t),Xp(" be paid?")]:[Xp("How can you deliver the "),lO(t),Xp("?")])}(),F([Xp("You will be able to chat with the "),Xp(function(){return"Seller"===e.$?"buyer":"seller"}()),Xp(" to coordinate further once the trade is in progress.")])])))}),wO=function(e){return{$:"ApproveClicked",a:e}},IO=function(e){return{$:"ChangeState",a:e}},AO={$:"Web3Connect"},BO=n(function(e,t,r){return f(rc,xk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ba(l(Y$,mr,f(kN,F([gN(15),lN,jN(20)]),F([Xp("Text about approving"),function(){if("Just"===t.$){t.a;return f(pO,"Prepare "+i$(n.daiAmountIn)+" "+Zf(e)+" for deposit",wO(n))}return f(ux,"Connect to Wallet",AO)}()])),IO(Ev(Tv))));case"ApproveNeedsSig":var n=r.a.a;return ba(l(Y$,mr,f(kN,F([gN(15),jN(20),lN]),F([Xp("Waiting for sig text")])),IO(Ev(Tv))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ba(l(Y$,mr,f(kN,F([gN(15),jN(20),lN]),F([Xp("Text about opening")])),IO(f(Dv,n,Pv))));case"OpenMining":var n=r.a;r.b;return ba(l(Y$,mr,f(kN,F([gN(15),jN(20),lN]),F([Xp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Xp("You will be redirected when the trade is finished opening.")])),IO(Ev(Tv))));default:break e}return Ca}())}),kO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(kN,F([gN(10),lN]),f(nu,f(yO,e.web3Context.factoryType,!0),aO))}var r=t.a;t.b;return f(kN,F([gN(20),lN]),F([l(yO,e.web3Context.factoryType,!1,r),f(kN,F([gN(10),lN]),F([f(TO,r.initiatorRole,r.fiatValue),f(EO,r.initiatorRole,e.textInput),f(bO,e.userInfo,e.state)]))]))}(),F([l(BO,e.web3Context.factoryType,e.userInfo,e.state)]))},NO=function(e){return{$:"MessageInputChanged",a:e}},RO={$:"MessageSubmit"},$O=function(e){return f(kN,F([kT($k),gN(10)]),F([f(yD,F([kT($k),wT(Lk(100))]),{label:Ix("messageInput"),onChange:NO,placeholder:Ca,spellcheck:!1,text:e.messageInput}),f(bR,F([lN,oN(24)]),{label:Xp("Submit"),onPress:ba(RO)})]))},xO=f(zk,VN,UT.scrollbarsY),_O=r(function(e,t){return f(Nk,F([wT($k),kT($k)]),f(Nk,O(F([F$(f(M$,"position","absolute")),F$(f(M$,"top","0")),F$(f(M$,"right","0")),F$(f(M$,"bottom","0")),F$(f(M$,"left","0")),xO]),e),t))}),LO=l(Ik,200,205,210),PO=n(function(e,t,r){var n=F([IN,Dk(I$),AA(Kk),IU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([Tx,Dk(LO),AA(BR),IU({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(Nk,O(F([jN(7)]),u),f(mN,mr,F([Xp(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(SA,0,0,1),Kk,"Initiator opened the trade"));case"Recalled":return ba(P(l(SA,0,0,1),Kk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Eo,8,eh(t))+"..";return ba(P(l(SA,1,0,1),Kk,r+" committed to the trade"));case"Aborted":return ba(P(l(SA,1,0,0),Kk,"Buyer aborted the trade"));case"Claimed":return ba(P(l(SA,0,1,0),Kk,"Buyer marked the fiat transfer complete"));case"Released":return ba(P(l(SA,0,0,1),Kk,"Seller released the "+Zf(e)+" and closed the contract"));default:return ba(P(l(SA,0,0,1),Kk,"Seller burned the "+Zf(e)+" and closed the contract"))}}();if("Nothing"===c.$)return xk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Nk,F([Jk(3),p$(1),d$(l(SA,1,0,1)),lN,Dk(h)]),f(mN,F([AA(p)]),F([Xp(g)])))}),DO=n(function(e,t,r){if(r.b){var n=r;return f(_O,F([kT($k),wT($k),Jk(5),p$(1),d$(BR),jN(10)]),f(kN,F([kT($k),wT($k),gN(10)]),f(nu,f(PO,e,t),n)))}return f(Nk,F([kT($k),wT($k),Jk(5),p$(1),d$(BR),lN,AA(l(SA,.5,.5,.5)),EN]),Xp("no messages found."))}),UO=Sr,OO=function(e){return f(kN,F([kT($k),wT($k),gN(10),p$(1),Jk(5),jN(20)]),F([l(DO,e.web3Context.factoryType,e.userRole,f(UO,function(e){return e.blocknum},Va(e.history))),$O(e)]))},MO=function(e){return f(Nk,F([Dk(Kk),Jk(8),iD,kT($k),wT($k)]),OO(e))},FO={$:"ToggleChat"},VO=function(e){if(e.showChatHistory){var t=f(rc,xk,f(Gf,MO,e.chatHistoryModel));return f(Nk,F([wT($k),kT(Lk(500)),jN(20),IN]),l(Y$,F([wT($k),kT($k)]),f(Df,LS,t),FO))}return xk},KO=function(e){return"Buyer"===e.initiatorRole.$?Ff:ay},HO=function(e){return zR(e)+" "+e.fiatType},jO={$:"AbortAction"},qO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),GO=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return xk;switch(t.a.$){case"ConfirmingCommit":var r=t.a,n=r.a,a=r.b,i=r.c,o=HO(n.terms.price),u=i$(Kv(i)),s=i$(n.parameters.tradeAmount)+" "+Zf(e.web3Context.factoryType),c=function(){return"Buyer"===KO(n.parameters).$?L(f(Nk,F([GN,AA(BR)]),Xp("buyer")),F([Xp("pay the seller "),f(Nk,F([AA(I$)]),Xp(o)),Xp(" in exchange for the "),f(Nk,F([AA(I$)]),Xp(s)),Xp(" held in this contract.")])):L(f(Nk,F([GN,AA(BR)]),Xp("seller")),F([Xp("accept "),f(Nk,F([AA(I$)]),Xp(o)),Xp(" from the buyer in exchange for the "),f(Nk,F([AA(I$)]),Xp(s)),Xp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(Y$,mr,f(kN,F([gN(20),jN(20),lN,wT($k),cx]),F([f(Nk,F([oN(26),nN,lN,FN]),Xp("Just to Confirm...")),f(kN,F([gN(20),lN,FN]),f(nu,mN(F([lN,oN(18),GN,AA(rx)])),O(F([O(F([Xp("You will deposit "),f(Nk,F([AA(I$)]),Xp(u+" "+Zf(e.web3Context.factoryType))),Xp(", thereby becoming the "),d,Xp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Xp("(This ususally requires two Metamask signatures. Your "+Zf(e.web3Context.factoryType)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(Nk,F([hx,lN]),f(ux,"Yes, I definitely want to commit to this trade.",l(qO,n,a,i)))])),jO);case"ApproveNeedsSig":t.a;return fx(F([Xp("Waiting for user signature for the approve call."),Xp("(check Metamask!)"),Xp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return fx(F([Xp("Mining the initial approve transaction..."),f(bA,F([px,AA(I$)]),{label:Xp("See the transaction on Etherscan"),url:f(lx,e.web3Context.factoryType,p)}),Xp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return fx(F([Xp("Waiting for user signature for the final commit call."),Xp("(check Metamask!)"),Xp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return fx(F([Xp("Mining the final commit transaction..."),f(bA,F([px,AA(I$)]),{label:Xp("See the transaction"),url:f(lx,e.web3Context.factoryType,p)})]));case"ConfirmingAction":var g=t.a.a;return l(Y$,mr,f(kN,F([gN(20),jN(20),lN,wT($k),cx]),F([f(Nk,F([oN(26),nN,lN,FN]),Xp("Just to Confirm...")),f(kN,F([gN(20),lN,FN]),f(nu,mN(F([lN,oN(18),GN,AA(rx)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Xp('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([Xp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Zf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Xp("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([Xp("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(Nk,F([hx,lN]),function(e){return f(ux,e,qS(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)+"."}}()))])),jO);case"ActionNeedsSig":var g=t.a.a;return fx(F([Xp("Waiting for user signature for the "+zS(g)+" call."),Xp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return xk}},zO=$N(F([kT($k),Dk(Kk),Jk(5),jN(20),oD,iD])),YO=function(e){return f($N,F([gN(8)]),F([f(QR,mr,n$),f(Nk,F([oN(24),GN]),Xp(i$(e)))]))},WO=r(function(e,t){var r=f(ig,bb(e),f(Gf,function(e){return e.address},t));return f(m_,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"}(),YO(e.parameters.tradeAmount))}),JO=function(e){return f($N,F([gN(5)]),F([A_(e.fiatType),f(Nk,F([oN(24),GN]),Xp(HO(e)))]))},QO=function(e){return f(m_,"For Fiat",JO(e.terms.price))},XO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},ZO=VR({description:"flame",src:"/DAIHard/static/img/flame.png"}),eM=VR({description:"release",src:"/DAIHard/static/img/release.png"}),tM={$:"ToggleStatsModal"},rM=function(e){return f(UO,no,e)},nM=n(function(e,t,n){var a=f(th,function(e){return $(f(ES,e,n),ba(t))},f(zE,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(rM(f(zE,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}}),aM=function(e){return{$:"ViewUserHistory",a:e}},iM=f(PB,0,mr),oM=f(zk,VN,UT.clipX),uM=f(zk,VN,UT.clipY),sM=f(zk,rN,UT.textNormalWeight),cM=r(function(e,t){return yi(e/t)}),fM=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}}),lM=r(function(e,t){var r=e.a,n=e.b;return l(fM,r,f(cM,Yl(t),6e4),n)}),dM=r(function(e,t){return f(es,24,f(cM,f(lM,e,t),60))}),hM=r(function(e,t){return f(es,1e3,Yl(t))}),pM=r(function(e,t){return f(es,60,f(lM,e,t))}),gM={$:"Apr"},vM={$:"Aug"},yM={$:"Dec"},mM={$:"Feb"},bM={$:"Jan"},CM={$:"Jul"},SM={$:"Jun"},EM={$:"Mar"},TM={$:"May"},wM={$:"Nov"},IM={$:"Oct"},AM={$:"Sep"},BM=function(e){var t=f(cM,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)}},kM=r(function(e,t){switch(BM(f(lM,e,t)).month){case 1:return bM;case 2:return mM;case 3:return EM;case 4:return gM;case 5:return TM;case 6:return SM;case 7:return CM;case 8:return vM;case 9:return AM;case 10:return IM;case 11:return wM;default:return yM}}),NM=r(function(e,t){return f(es,60,f(cM,Yl(t),1e3))}),RM={$:"Fri"},$M={$:"Mon"},xM={$:"Sat"},_M={$:"Sun"},LM={$:"Thu"},PM={$:"Tue"},DM={$:"Wed"},UM=r(function(e,t){switch(f(es,7,f(cM,f(lM,e,t),1440))){case 0:return LM;case 1:return RM;case 2:return xM;case 3:return _M;case 4:return $M;case 5:return PM;default:return DM}}),OM=n(function(e,t,r){return e.toAmPm(f(dM,t,r))}),MM=r(function(e,t){return BM(f(lM,e,t)).day}),FM=MM,VM=F([_M,$M,PM,DM,LM,RM,xM]),KM=r(function(e,t){return function(e){return e.a}(f(rc,L(0,_M),el(f(th,function(r){return $(r.b,f(UM,e,t))},f(ji,r(function(e,t){return L(e,t)}),VM)))))}),HM=function(e){return l(Wa,Ya,0,e)},jM=r(function(e,t){return BM(f(lM,e,t)).year}),qM=function(e){return!f(es,4,e)&&(!!f(es,100,e)||!f(es,400,e))},GM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return qM(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}}),zM=F([bM,mM,EM,gM,TM,SM,CM,vM,AM,IM,wM,yM]),YM=r(function(e,t){return f(rc,L(0,bM),el(f(th,function(r){r.a;return $(r.b,f(kM,e,t))},f(ji,r(function(e,t){return L(e,t)}),zM))))}),WM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(YM,e,t))}),JM=r(function(e,t){var r=f(_s,f(WM,e,t)-1,zM);return HM(f(nu,GM(f(jM,e,t)),r))+f(FM,e,t)}),QM=r(function(e,t){return f(WM,e,t)/4|0}),XM=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)}),ZM=function(e){return e?e<=12?e:e-12:12},eF=kg(315576e5),tF=r(function(e,t){return Kf(eF*f(jM,e,t))}),rF=r(function(e,t){var r=f(tF,e,t),n=f(KM,e,r);return 1+((f(JM,e,t)+n)/7|0)}),nF=r(function(e,t){return Gi(f(jM,e,t))}),aF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Gi(f(WM,t,r));case"MonthSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(WM,t,r));case"MonthFixed":return f(XM,2,f(WM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(kM,t,r));case"MonthNameFull":return e.toMonthName(f(kM,t,r));case"QuarterNumber":return Gi(1+f(QM,t,r));case"QuarterSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(1+f(QM,t,r));case"DayOfMonthNumber":return Gi(f(FM,t,r));case"DayOfMonthSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(FM,t,r));case"DayOfMonthFixed":return f(XM,2,f(FM,t,r));case"DayOfYearNumber":return Gi(f(JM,t,r));case"DayOfYearSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"DayOfYearFixed":return f(XM,3,f(JM,t,r));case"DayOfWeekNumber":return Gi(f(KM,t,r));case"DayOfWeekSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(KM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(UM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(UM,t,r));case"WeekOfYearNumber":return Gi(f(rF,t,r));case"WeekOfYearSuffix":return function(t){return O(Gi(t),e.toOrdinalSuffix(t))}(f(rF,t,r));case"WeekOfYearFixed":return f(XM,2,f(rF,t,r));case"YearNumberLastTwo":return f(Ao,2,f(nF,t,r));case"YearNumber":return f(nF,t,r);case"AmPmUppercase":return qP(l(OM,e,t,r));case"AmPmLowercase":return ll(l(OM,e,t,r));case"HourMilitaryNumber":return Gi(f(dM,t,r));case"HourMilitaryFixed":return f(XM,2,f(dM,t,r));case"HourNumber":return Gi(ZM(f(dM,t,r)));case"HourFixed":return f(XM,2,ZM(f(dM,t,r)));case"HourMilitaryFromOneNumber":return Gi(1+f(dM,t,r));case"HourMilitaryFromOneFixed":return f(XM,2,1+f(dM,t,r));case"MinuteNumber":return Gi(f(pM,t,r));case"MinuteFixed":return f(XM,2,f(pM,t,r));case"SecondNumber":return Gi(f(NM,t,r));case"SecondFixed":return f(XM,2,f(NM,t,r));case"MillisecondNumber":return Gi(f(hM,t,r));case"MillisecondFixed":return f(XM,3,f(hM,t,r));default:return n.a}}),iF=a(function(e,t,r,n){return f(zi,"",f(nu,l(aF,e,r,n),t))}),oF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),uF=function(e){return e>11?"pm":"am"},sF=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"}},cF=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"}}},fF=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"}},lF=p(oF,sF,f(_a,sF,Eo(3)),fF,f(_a,fF,Eo(3)),uF,cF),dF=iF(lF),hF={$:"MonthNameFull"},pF=hF,gF=function(e){return{$:"Text",a:e}},vF=gF,yF={$:"YearNumber"},mF=yF,bF=n(function(e,t,n){var a=r(function(e,t){return f(kN,F([oN(18),gN(6)]),F([f(Nk,F([bN]),Xp(e)),f(Nk,F([sM]),Xp(t))]))}),i=dF(F([pF,vF(", "),mF])),o=f(kN,F([gN(23),kT($k)]),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,iM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Gi(n.numReleases)+" trades / "+i$(n.amountReleased)+" "+Zf(e)+" Released"),L("Abort Outcomes",Gi(n.numAborts)+" trades"),L("Burn Outcomes",Gi(n.numBurns)+" trades / "+i$(n.amountBurned)+" "+Zf(e)+" Burned")])),F([f(Nk,F([lN]),f(pO,"View User History",aM(n.asRole)))])));return f(kN,F([Jk(8),oM,uM,Dk(kR),gN(1),aD({blur:20,color:d(XR,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Nk,F([kT($k),Dk(Kk),jN(17)]),f(C$,18,t)),f(Nk,F([kT($k),Dk(Kk),jN(17)]),o)]))}),CF=a(function(e,t,r,n){var a=l(nM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=XO(t.parameters.initiatorRole)+" Stats";return f(Nk,n?F([d_(f(Nk,F([h_(30),IN]),l(bF,e,t.parameters.initiatorAddress,a)))]):mr,f(m_,i,f($N,F([kT($k),gN(30),Yk,tN(tM)]),F([f($N,mr,F([f(QR,F([wT(Lk(28))]),eM),f(Nk,F([oN(24),GN]),Xp(l(Xu,2,D("0"),Gi(a.numReleases))))])),f($N,mr,F([f(QR,F([wT(Lk(28))]),ZO),f(Nk,F([oN(24),GN]),Xp(l(Xu,2,D("0"),Gi(a.numAborts))))])),f($N,mr,F([f(QR,F([wT(Lk(28))]),ZO),f(Nk,F([oN(24),GN]),Xp(l(Xu,2,D("0"),Gi(a.numBurns))))]))]))))}),SF=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""}}),EF=n(function(e,t,r){return f(bA,e,{label:Xp(eh(r)),url:f(SF,t,r)})}),TF=r(function(e,t){return f(m_,"Trade Status",f(kN,F([oN(24),GN,gN(8)]),F([Xp(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(EF,F([oN(12),AA(I$),px]),t,e.creationInfo.address)])))}),wF=o(function(e,t,r,n,a,i){return zO(F([f(TF,t,n),f(WO,t,r),QO(t),d(CF,n,t,a,i)]))}),IF=l(Ik,9,32,107),AF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),BF=a(function(e,t,r,n){return d(AF,e,t,r,n)}),kF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},NF=function(e){return function(e){return d(BF,e.red,e.green,e.blue,e.alpha)}(kF(e))},RF=function(e){return{$:"Circle",a:e}},$F=RF,xF=d(AF,0,0,0,1),_F={$:"Flat"},LF={$:"Sharp"},PF=function(e){return{$:"Uniform",a:e}},DF=PF,UF={cap:_F,dashPattern:mr,dashPhase:0,fill:DF(xF),join:LF,thickness:2},OF=n(function(e,t,r){return U(UF,{dashPattern:e,fill:r,thickness:t})}),MF=OF(mr),FF={$:"Transparent"},VF=FF,KF=f(MF,0,VF),HF=r(function(e,t){return{$:"Shape",a:e,b:t}}),jF=function(e){return{basic:e,handlers:mr,name:Ca,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},qF=function(e){return f(Af,jF,HF(e))},GF=function(e){return qF(L(e,KF))},zF=function(e){return L(-e.a,-e.b)},YF=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)})}),WF=r(function(e,t){return f(YF,zF(e(t)),t)}),JF=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)},QF=r(function(e,t){return{$:"Path",a:e,b:t}}),XF=Nr,ZF=Rr,eV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=ZF(n),i=XF(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)},tV=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)})},rV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(tV,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),nV=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)])},aV=function(e){var t=iV(e.basic),r=JF(f(nu,eV(e),t)),n=r.a,a=r.b;return{toBottom:-f(rc,0,EI(a)),toLeft:-f(rc,0,EI(n)),toRight:f(rc,0,SI(n)),toTop:f(rc,0,SI(a))}},iV=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(rV,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(rV,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(rV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(tV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(QF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(tV,$(C,_F)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(rV,0,S);case"Group":var E=e.a;return f(tV,0,cy(f(nu,f(_a,aV,nV),E)));default:var T=e.b;return f(tV,0,nV(aV(T)))}},oV=function(e){var t=aV(e);return t.toTop+t.toBottom},uV=function(e){var t=aV(e);return L(-t.toLeft,t.toTop)},sV=function(e){var t=aV(e);return t.toLeft+t.toRight},cV=Un("http://www.w3.org/2000/svg"),fV=cV("svg"),lV=qn("height"),dV=qn("version"),hV=qn("width"),pV=cV("circle"),gV=cV("ellipse"),vV=cV("foreignObject"),yV=cV("g"),mV=cV("image"),bV=cV("polygon"),CV=cV("polyline"),SV=cV("rect"),EV=Rw,TV=cV("text"),wV=qn("id"),IV=qn("points"),AV=qn("r"),BV=qn("rx"),kV=qn("ry"),NV=function(e){return l(Gn,"http://www.w3.org/1999/xlink","xlink:href",it(e))},RV=function(e){return{$:"Group",a:e}},$V=qn("dominant-baseline"),xV=qn("fill"),_V=qn("fill-opacity"),LV=qn("font-family"),PV=qn("font-size"),DV=qn("font-style"),UV=qn("font-variant"),OV=qn("font-weight"),MV=qn("opacity"),FV=qn("stroke"),VV=qn("stroke-dasharray"),KV=qn("stroke-dashoffset"),HV=qn("stroke-linecap"),jV=qn("stroke-linejoin"),qV=qn("stroke-opacity"),GV=qn("stroke-width"),zV=qn("text-anchor"),YV=qn("text-decoration"),WV=qn("transform"),JV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},QV=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))},XV=n(function(e,t,r){return d(AF,e,t,r,1)}),ZV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return kg(1e4*e)/100};return Tl(F(["rgba(",Iw(i(t)),"%,",Iw(i(r)),"%,",Iw(i(n)),"%,",Iw(function(e){return kg(1e3*e)/1e3}(a)),")"]))},eK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tK=function(e){var t=eK(e),r=t.red,n=t.green,a=t.blue;return ZV(l(XV,r,n,a))},rK=function(e){if("Uniform"===e.$){var t=e.a;return tK(t)}return"none"},nK=function(e){var t=eK(e),r=t.alpha;return Iw(r)},aK=function(e){if("Uniform"===e.$){var t=e.a;return nK(t)}return"0"},iK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},oK=kr,uK=function(e){var t=Iw(e.scale.b),r=Iw(e.scale.a),n=Iw(-e.rotation/2/oK*360),a=Iw(-e.shift.b),i=Iw(e.shift.a);return Tl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},sK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([FV(rK(r.fill)),qV(aK(r.fill)),GV(Iw(r.thickness)),HV(JV(r.cap)),jV(iK(r.join)),xV("none"),MV(Iw(e.opacity)),WV(uK(e)),KV(Gi(r.dashPhase)),VV(QV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([xV(rK(a)),_V(aK(a)),FV(rK(r.fill)),qV(aK(r.fill)),GV(Iw(r.thickness)),HV(JV(r.cap)),jV(iK(r.join)),MV(Iw(e.opacity)),WV(uK(e)),KV(Gi(r.dashPhase)),VV(QV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([xV(rK(PF(o.color))),LV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),PV(Gi(o.size)),OV(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"}}()),DV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),UV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),YV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),zV("middle"),$V("middle"),WV(uK(e))]);default:return F([WV(uK(e))])}},cK=qn("x"),fK=qn("y"),lK=r(function(e,t){return F([hV(Iw(e)),lV(Iw(t)),cK(Iw(-e/2)),fK(Iw(-t/2))])}),dK=function(e){return f(zi," ",f(nu,function(e){var t=e.a,r=e.b;return f(zi,",",F([Iw(t),Iw(-r)]))},e))},hK=Zk,pK=r(function(e,t){return f(e,t.a,t.b)}),gK=function(e){return f(nu,pK(hK),e)},vK=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(CV,O(F([wV(t),IV(dK(i))]),O(sK(e),gK(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(bV,O(F([wV(t),IV(dK(i))]),O(sK(e),gK(e.handlers))),mr);case"Circle":var c=s.a;return f(pV,O(F([wV(t),AV(Iw(c))]),O(sK(e),gK(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(gV,O(F([wV(t),BV(Iw(d)),kV(Iw(h))]),O(sK(e),gK(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(SV,O(F([wV(t),BV(Iw(c)),kV(Iw(c))]),O(f(lK,p,g),O(sK(e),gK(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(QF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(TV,O(F([wV(t)]),O(sK(e),gK(e.handlers))),F([EV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(mV,O(F([wV(t),NV(C)]),O(f(lK,p,g),O(sK(e),gK(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(vV,O(F([wV(t)]),O(f(lK,p,g),O(sK(e),gK(e.handlers)))),F([E]));case"Group":var T=n.a;return f(yV,f(za,wV(t),O(sK(e),gK(e.handlers))),l(Wa,r(function(e,t){return f(za,vK(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:RV(F([w,I]))});e=v;continue e}}},yK=r(function(e,t){var r=e.a,n=e.b,a=Iw(r),i=Iw(n);return f(QT,mr,F([f(fV,F([hV(a),lV(i),dV("1.1")]),F([vK(t)]))]))}),mK=function(e){return f(yK,L(sV(e),oV(e)),f(WF,uV,e))},bK=a(function(e,t,r,n){var a=k_(mK(f(GF,DF(NF(r)),$F(t/2))));return f(Nk,O(F([q$(n)]),e),a)}),CK=VR({description:"chat",src:"/DAIHard/static/img/chat-icon.svg"}),SK=function(e){return f(tR,xU,_U(e))},EK=d(bK,F([Yk,tN(FO)]),80,l(SA,1,1,1),f(QR,F([lN,FN,SK(5)]),CK)),TK=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wK=function(e){return f(kN,F([Jk(12),Dk(kR),jN(15),gN(15)]),F([f(Nk,F([oN(24),nN,EN]),Xp("Fiat Payment Method")),f(mN,F([oN(18),wT(AT),Dk(Kk),aD({blur:5,color:d(XR,0,0,0,.2),offset:L(-3,3),size:0}),Jk(3),jN(5)]),F([f(rc,f(Nk,F([AA(N$),EN]),Xp("No payment methods found.")),f(Gf,Xp,f(Gf,function(e){return e.info},el(e))))]))]))},IK={$:"Active"},AK=function(e){return{$:"ExpandPhase",a:e}},BK=F([Dk(IF),AA(Kk)]),kK=r(function(e,t){return{$:"Min",a:e,b:t}}),NK=r(function(e,t){return f(kK,e,t)}),RK=function(e){return F(e?[Jk(12),H$,wT(f(NK,380,AT))]:[Jk(12),lN])},$K=F([Dk(Kk)]),xK=r(function(e,t){return jf(f(Lu,qf(e),qf(t)))}),_K=r(function(e,t){return d(ox,P(d(XR,1,.6,.2,1),d(XR,1,.6,.2,.8),d(XR,1,.6,.2,.6)),Kk,e,t)}),LK=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),PK=function(e){return{$:"ContractActionClicked",a:e}},DK={$:"Web3Connect"},UK=n(function(e,t,r){if("Just"===r.$){var n=r.a;return"TimeUp"===f(IR,e,t).$?xk:f($N,F([gN(8)]),function(){var e=P(t.state.phase,f(bb,t,n.address),f(ES,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,qS,f(pO,"Remove and Refund this Trade",HS))])}break e}var r=(e.a,e.b,qf(Cb(t.parameters)));return F([f(ux,"Deposit and Commit to Trade",l(LK,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Df,PK,f(_K,"Abort Trade",BS)),f(Df,PK,f(ux,"Confirm Payment",PS)),EK])}e.a,e.c.a;return F([EK])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Df,PK,f(ux,"Burn it All!",_S)),f(Df,PK,f(pO,"Release Everything",jS)),EK])}e.a,e.c.a;return F([EK])}break e;default:break e}return mr}())}return f(ux,"Connect to Wallet",DK)}),OK={$:"Finished"},MK={$:"NotStarted"},FK=r(function(e,t){var r=L(LN(t),LN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?MK:$(n,a)?IK:OK}),VK=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}}),KK=r(function(e,t){return l(VK,mr,e,t)}),HK=i(function(e,t,r,n,a){var i=i$(f(dd,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Zf(e),o=i$(n.parameters.tradeAmount)+" "+Zf(e),u=f($N,mr,f(KK,3,f(QR,F([wT(Lk(18))]),ZO))),s=f(Af,Nk(F([AA(l(SA,1,0,0))])),Xp),c=$(t,n.state.phase),d=f(ig,ES(n),f(Gf,function(e){return e.address},a)),h=c?Kk:BR,p=mN(F([AA(h),oN(18),nN])),g=HO(n.terms.price),v=c?l(Ik,0,226,255):l(Ik,16,7,234),y=f(Af,Nk(F([AA(v)])),Xp),m=i$(n.parameters.buyerDeposit)+" "+Zf(e),b=n.parameters.abortPunishment,C=i$(b)+" "+Zf(e),S=i$(f(xK,n.parameters.buyerDeposit,b))+" "+Zf(e),E=i$(f(xK,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([Xp("Your "),s("burnable deposit"),Xp(" of "),y(m),Xp(" is now held in this contract, and your offer to buy "),y(o),Xp(" for "),y(g),Xp(" is now listed in the marketplace.")]),F([Xp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Xp(" into this contract.")]),F([Xp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Xp(" to you.")])])):f(nu,p,F([F([Xp("Your offer to sell the "),y(o),Xp(" held in this contract for "),y(g),Xp(" is now listed in the marketplace.")]),F([Xp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Xp(" of 1/3 of the trade amount "),y("("+m+")"),Xp(" into this contract.")]),F([Xp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Xp(" 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([Xp("You must now pay the Seller "),y(g),Xp(" via the Fiat Payment Method, "),f(Nk,F([nN]),Xp("and then click ")),s("Confirm Payment"),Xp(" before the payment window runs out. Use the chat to coordinate.")]),F([Xp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Xp(" (1/4 of the "),s("burnable deposit"),Xp(") will be "),s("burned"),Xp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Xp(" to the Seller, "),y(S),Xp(" to you).")]),F([Xp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Xp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(nu,p,F([F([Xp("Work and communicate with the Buyer to receive "),y(g),Xp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Xp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Xp(" (1/4 of the "),s("burnable deposit"),Xp(") will be "),s("burned"),Xp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Xp(" to you, "),y(S),Xp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(nu,p,F([F([Xp("If the Seller confirms receipt of payment, or fails to decide within the release window, the combined balance of "),y(i),Xp(" will be released to you.")]),F([Xp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Xp(" In this case the "),y(i),Xp(" will be lost to both parties.")]),F([Xp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(nu,p,F([F([Xp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Xp("So, have you recieved the "),y(g),Xp("? If so, you can click "),y("Release Everything"),Xp(".")]),F([Xp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Xp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Xp("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([Xp("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([Xp("The Seller has deposited "),y(o),Xp(" into this contract, and offers to sell it for "),y(g),Xp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Xp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Xp(".")]),F([Xp("If the trade is successful, the combined "+Zf(e)+" balance "),y("("+i+")"),Xp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Xp(" for both parties (see Payment Window for more on this).")]),F([Xp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Xp(" within the payment window.")])])):f(nu,p,F([F([Xp("The Buyer is offering to buy "),y(o),Xp(" for "),y(g),Xp(", and has deposited "),y(m),Xp(" into this contract as a "),s("burnable deposit"),Xp(". To become the Seller, deposit "),y(o),Xp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Xp(".")]),F([Xp("When you receive the "),y(g),Xp(" from the Buyer, the combined "+Zf(e)+" balance "),y("("+i+")"),Xp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Xp(" for both parties (see Payment Window for more on this).")]),F([Xp("Don't commit unless you can receive "),y(g),Xp(" 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([Xp("During this phase, the Buyer is expected to transfer "),y(g),Xp(" to the Seller, as described in Fiat Payment Method, "),f(Nk,F([nN]),Xp("and ")),s("Confirm the Payment "),Xp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Xp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Xp(" (1/4 of the "),s("burnable deposit"),Xp(" amount) will be "),s("burned"),Xp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Xp(" to the Seller, "),y(S),Xp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(nu,p,F([F([Xp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Xp("If the Seller can verify he has received the "),y(g),Xp(", he will probably release the total balance of "),y(o),Xp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Xp(".")]),F([Xp("If the Seller has not made a decision before the Release Window expires, the "),y(o),Xp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(kN,F([kT($k),wT($k),jN(20),gN(30)]),F([f($N,F([kT($k)]),F([f(Nk,F([oN(24),nN,AA(v),Tx]),Xp(w))])),f(kN,F([kT($k),FN,gN(13)]),I),f(Nk,F([IN]),function(){switch(f(FK,n,t).$){case"Active":return l(UK,r,n,a);case"NotStarted":return f(Nk,F([oN(20),nN,EN,AA(y$)]),Xp("Phase not yet started."));default:return f(Nk,F([oN(20),nN,EN]),Xp("Phase no longer active."))}}())]))}),jK=VR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),qK=VR({description:"judgment phase",src:"/DAIHard/static/img/phase-judgment.svg"}),GK={$:"None"},zK=GK,YK=VR({description:"open phase",src:"/DAIHard/static/img/phase-open.svg"}),WK=function(e){switch(e.$){case"Open":return YK;case"Committed":return jK;case"Judgment":return qK;default:return zK}},JK=r(function(e,t){var r=WK(e),n=function(){switch(t.$){case"NotStarted":return l(Ik,10,33,108);case"Active":return l(Ik,0,100,170);default:return l(Ik,1,129,104)}}(),a=k_(mK(f(GF,DF(NF(n)),$F(50))));return f(Nk,F([lN,q$(f(QR,F([lN,FN]),r))]),a)}),QK=function(e){var t=F([EN,nN,oN(20)]);switch(e.$){case"Active":return f(Nk,O(t,F([AA(sN)])),Xp("Active"));case"NotStarted":return f(Nk,O(t,F([AA(y$)])),Xp("Not Started"));default:return f(Nk,t,Xp("Finished"))}},XK=n(function(e,t,r){var n=f(FK,t,e),a=function(){return"Active"===n.$?l(Ik,0,226,255):BR}(),i=f(Nk,F([AA(a),oN(20),nN,lN]),Xp(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 xk;switch(n.$){case"NotStarted":return d(DR,F([lN]),F([oN(22),GN]),L(BR,kR),f(TR,e,t));case"Active":var a=f(IR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(MR,F([lN]),F([oN(22),GN]),L(Kk,kR),i)}return f(kN,F([lN,gN(10)]),F([f(Nk,F([lN]),Xp(AR(e))),f(pO,"Poke",qS(KS))]));default:return f(Nk,F([wT(Lk(1))]),xk)}}();return f(kN,F([jN(20),gN(10),wT($k)]),F([f(Nk,F([H$,lN]),i),f(Nk,F([wT($k),lN]),f(Nk,F([FN]),f(JK,e,n))),f(kN,F([gN(10),hx,lN]),F([f(Nk,F([lN]),QK(n)),o]))]))}),ZK=u(function(e,t,r,n,a,i,o){var u=f(FK,n,r),s=f(Nk,F([jN(10),kT($k),wT($k)]),h(HK,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(XK,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(wR,f(Ib,n.state.phaseStartTime,c),o);default:Kf(0)}}(),f(Nk,F([wT($k),kT(Lk(1)),Dk(function(){return"Active"===u.$?l(SA,0,0,1):kR}())]),xk)),g=i?f($N,O(RK(e),O($(u,IK)?BK:$K,F([kT($k)]))),F([d,p,s])):f($N,O(RK(e),O($(u,IK)?BK:$K,F([Yk,tN(AK(r))]))),F([d]));return!e&&$(u,IK)?f(kN,F([kT($k),gN(20),E$({bottom:20,left:0,right:0,top:0})]),F([g,wK(n.terms.paymentMethods)])):g}),eH=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f($N,F([lN,Jk(12),jN(30),gN(10),Dk(IF),oN(24),nN,AA(Kk)]),F([Xp("Trade "+TK(r.state.closedReason)),EK])):e?f(kN,F([kT($k),gN(10)]),F([f($N,F([kT($k),wT(AT),gN(20)]),F([g(ZK,e,t,io,r,a,$(n,io),i),g(ZK,e,t,iC,r,a,$(n,iC),i),g(ZK,e,t,oC,r,a,$(n,oC),i)])),wK(r.terms.paymentMethods)])):f(kN,F([kT($k),wT(AT),gN(20)]),F([g(ZK,e,t,io,r,a,$(n,io),i),g(ZK,e,t,iC,r,a,$(n,iC),i),g(ZK,e,t,oC,r,a,$(n,oC),i)]))}),tH=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(kN,F([kT($k),wT($k),gN(40)]),F([p(wF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Nk,F([kT($k),f(qk,40,0),gN(40)]),p(eH,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Nk,F([lN,FN,oN(30)]),Xp("Loading trade info..."));default:return f(Nk,F([lN,FN,oN(30)]),Xp("Invalid trade"))}}(),F([VO(n),GO(n)]))}),rH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),nH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(zD(Ok(Xv(ay))),mr);case"CreateModel":var n=r.a;return L(f(Df,My,OD(n)),mr);case"QuickCreateModel":var a=r.a;return l(rH,Df(Ky),nu(Df(Ky)),kO(a));case"TradeModel":var i=r.a;return l(rH,Df(jy),nu(Df(jy)),d(tH,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Df,yT,l(eO,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Df,hT,l(x$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Nk,F([kT($k),wT($k),Jk(10)]),n),a)}),aH=function(e){return{$:"DismissNotice",a:e}},iH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(SA,1,1,1):l(SA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ik,100,200,255);case"Caution":return l(Ik,255,188,0);case"Error":return l(Ik,255,70,70);default:return l(Ik,200,200,200)}}(),o=f(Nk,F([IN,H$,ex(5),SK(5)]),U$(aH(t)));return f(Nk,F([Dk(i),Jk(10),jN(8),kT($k),p$(1),d$(d(XR,0,0,0,.15)),iD]),f(kN,F([gN(4),kT($k)]),f(ji,r(function(e,t){return f(mN,F([kT($k),AA(a)]),e?t:f(za,o,t))}),n.mainParagraphs)))},oH=function(e){return $(e,mr)?mr:F([f(kN,F([LU(20),ex(20),gN(10),IN,hx,kT(Lk(300)),oN(15)]),f(nu,iH,f(th,function(e){return $(e.b.align,Jp)},f(ji,r(function(e,t){return L(e,t)}),e)))),f(kN,F([SK(20),h_(100),gN(10),Tx,H$,kT(Lk(300)),oN(15)]),f(nu,iH,f(th,function(e){return $(e.b.align,bB)},f(ji,r(function(e,t){return L(e,t)}),e))))])},uH=r(function(e,t){var r=f(nH,e,t),n=r.a,a=r.b;return L(f(kN,F([RR(Uk),q$(xN(t)),kT($k),wT($k),jN(30)]),F([f(Nk,F([wT(Lk(50))]),xk),n])),O(a,oH(t.userNotices)))}),sH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),cH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),fH={$:"AllowHover"},lH={$:"Layout"},dH={backgroundColor:Ca,borderColor:Ca,shadow:ba({blur:3,color:d(CA,155/255,203/255,1,1),offset:L(0,0),size:3})},hH=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.$?dH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?fH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?lH:t.a}()}}(l(Xa,t,{focus:Ca,hover:Ca,mode:Ca},e))},pH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(_T);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),_T);case"Text":var a=t.a;return OI(a);default:return OI("")}}),gH=n(function(e,t,r){var n=hH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?sH(n):cH(n)}();return f(pH,a,d(yA,_T,kk,t,$T(F([r]))))}),vH=ow(5),yH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),mH={$:"SansSerif"},bH=function(e){return{$:"Typeface",a:e}},CH=W,SH=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,"-",CH(ll(t)));case"ImportFont":var t=e.a;e.b;return f(zi,"-",CH(ll(t)));default:var t=e.a.name;return f(zi,"-",CH(ll(t)))}}())}),EH=function(){var e=F([bH("Open Sans"),bH("Helvetica"),bH("Verdana"),mH]);return F([f(wA,Pk,l(TA,"bg-color-"+IA(d(CA,1,1,1,0)),"background-color",d(CA,1,1,1,0))),f(wA,EA,l(TA,"font-color-"+IA(d(CA,0,0,0,1)),"color",d(CA,0,0,0,1))),f(wA,aN,iN(20)),f(wA,vH,f(yH,l(Wa,SH,"font-",e),e))])}(),TH=n(function(e,t,r){var n=e.options;return l(gH,n,f(za,mA(f(zi," ",F([UT.root,UT.any,UT.single]))),O(EH,t)),r)}),wH=TH({options:mr}),IH=function(e){return f(wA,vH,f(yH,l(Wa,SH,"ff-",e),e))},AH=mH,BH=bH,kH=function(e){return{body:F([function(){var t=f(uH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([kT($k),wT($k),IH(F([BH("Soleil"),AH]))]),f(nu,q$,n));return f(wH,a,r)}()]),title:"DAIHard"}},NH=jt,RH=NH({init:EB,onUrlChange:wk,onUrlRequest:Tk,subscriptions:Ek,update:dB,view:kH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:RH(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",tS))},f(Fd,"networkId",tS))},f(Fd,"width",tS)))(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,ja(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+S(e,Ka(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+S(e,Ma(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=ja(e),t=ja(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ka(e),t=Ka(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 Ai(n)?n:wi(f(Ni,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(!Ai(n))return wi(f(ki,o,n.a));i=M(L(o,n.a),i)}return Ii(Ya(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(Dh,o,function(e){return ya(Uh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Mh,e,L(r,qh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Mh,e,L(r,jh({received:n.loaded,size:n.lengthComputable?ya(n.total):ma}))))})}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=Sg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?cg(o):sg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Sg(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(fg(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(dg,lg,Ie(function(t){try{sa.location=e}catch(e){Dn.location.reload(!1)}}))}function Xt(e){try{return ya(decodeURIComponent(e))}catch(e){return ma}}function Zt(){return f($a,tu(ws),f($a,is,Ts))}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?Da:r?Fa:Pa})),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===Pa?0:n===Da?-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 ya(f(e,t,0).b)}catch(e){return ma}}),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?ya(l):ma}a.push(d(pd,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?ya(o):ma}return r(d(pd,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(Hh)}),i.addEventListener("timeout",function(){a(Gh)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Uh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Vh(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(dg,lg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(dg,lg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(dg,lg,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 Ai(r)?ya(r.a):ma}),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=function(e){return{$:"Token",a:e}},va=r(function(e,t){return e(t)}),ya=function(e){return{$:"Just",a:e}},ma={$:"Nothing"},ba=function(e){e:for(;;)switch(e.$){case"Mainnet":return ya(ga(ha));case"Kovan":return ya(ga(pa));case"Private":if(100===e.a)return ya(la(da));break e;default:break e}return ma},Ca={$:"ETCMain"},Sa={$:"ETCTest"},Ea={$:"Expanse"},Ta={$:"Kovan"},wa={$:"Mainnet"},Ia=function(e){return{$:"Private",a:e}},Aa={$:"Rinkeby"},Ba={$:"Ropsten"},ka={$:"RskMain"},Na={$:"RskTest"},Ra=function(e){switch(e){case 1:return wa;case 2:return Ea;case 3:return Ba;case 4:return Aa;case 30:return ka;case 31:return Na;case 42:return Ta;case 41:return Ca;case 62:return Sa;default:return Ia(e)}},$a=n(function(e,t,r){return t(e(r))}),xa=f($a,Ra,ba),_a=n(function(e,t,r){return{factoryType:e,httpProvider:t,wsProvider:r}}),La=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return l(_a,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws")}e.a;return l(_a,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws")}switch(e.a.$){case"Eth":e.a;return l(_a,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws");case"Kovan":e.a;return l(_a,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws");default:e.a;return l(_a,e,"https://dai.poa.network","")}},Pa={$:"EQ"},Da={$:"LT"},Ua=cr,Oa=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(Ua,o,r,n)}var a=t.a;return l(Ua,e,r,a)});return l(Ua,o,l(Ua,e,t,i),a)}),Ma=function(e){return l(Oa,qa,mr,e)},Fa={$:"GT"},Va=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(Va,e,t,o)),c=i;e=u,t=s,r=c}}),Ka=function(e){return l(Va,n(function(e,t,r){return f(qa,L(e,t),r)}),mr,e)},Ha=function(e){return l(Va,n(function(e,t,r){return f(qa,e,r)}),mr,e)},ja=function(e){var t=e.a;return Ha(t)},qa=br,Ga=Tr,za=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}}),Ya=function(e){return l(za,qa,mr,e)},Wa=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(za,e,t,Ya(p)):d(Wa,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}),Ja=n(function(e,t,r){return d(Wa,e,t,0,r)}),Qa=r(function(e,t){return t.b?l(Ja,qa,t,e):e}),Xa=r(function(e,t){return U(t,{userNotices:f(Qa,t.userNotices,F([e]))})}),Za=r(function(e,t){return l(za,Xa,t,e)}),ei=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),ti=$r,ri=r(function(e,t){return Lr(t)/Lr(e)}),ni=K,ai=ti(f(ri,2,32)),ii=rr,oi=d(ei,0,ai,ii,ii),ui=function(e){return{$:"Leaf",a:e}},si=function(e){return{$:"SubTree",a:e}},ci=ar,fi=r(function(e,t){for(;;){var r=f(ci,32,e),n=r.a,a=r.b,i=f(qa,si(n),t);if(!a.b)return Ya(i);var o=a,u=i;e=o,t=u}}),li=r(function(e,t){return t(e)}),di=hr,hi=function(e){return e.a},pi=r(function(e,t){for(;;){var r=ti(t/32);if(1===r)return f(ci,32,e).a;var n=f(fi,e,mr),a=r;e=n,t=a}}),gi=xr,vi=r(function(e,t){return _(e,t)>0?e:t}),yi=Ir,mi=wr,bi=m,Ci=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=gi(f(ri,32,r-1)),a=e?Ya(t.nodeList):t.nodeList,i=f(pi,a,t.nodeListSize);return d(ei,bi(t.tail)+r,f(vi,5,n*ai),i,t.tail)}return d(ei,bi(t.tail),ai,ii,t.tail)}),Si=nr,Ei=i(function(e,t,r,n,a){for(;;){if(t<0)return f(Ci,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=ui(l(Si,32,t,e)),o=e,u=t-32,s=r,c=f(qa,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),Ti=r(function(e,t){if(e<=0)return oi;var r=e%32,n=l(Si,r,e-r,t);return h(Ei,t,e-r-32,e,mr,n)}),wi=function(e){return{$:"Err",a:e}},Ii=function(e){return{$:"Ok",a:e}},Ai=function(e){return"Ok"===e.$},Bi=r(function(e,t){return{$:"Failure",a:e,b:t}}),ki=r(function(e,t){return{$:"Field",a:e,b:t}}),Ni=r(function(e,t){return{$:"Index",a:e,b:t}}),Ri=function(e){return{$:"OneOf",a:e}},$i=yr,xi=j,_i=function(e){var t=xi(e);return 97<=t&&t<=122},Li=function(e){var t=xi(e);return t<=90&&65<=t},Pi=function(e){return _i(e)||Li(e)},Di=function(e){var t=xi(e);return t<=57&&48<=t},Ui=function(e){return _i(e)||Li(e)||Di(e)},Oi=function(e){return l(za,r(function(e,t){return t+1}),0,e)},Mi=Cr,Fi=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(qa,t,r);e=n,t=a,r=i}}),Vi=r(function(e,t){return l(Fi,e,t,mr)}),Ki=r(function(e,t){return l(Mi,e,f(Vi,0,Oi(t)-1),t)}),Hi=Kr,ji=Z,qi=r(function(e,t){return f(Fr,e,V(t))}),Gi=z,zi=r(function(e,t){return F(f(Mr,e,t))}),Yi=function(e){return f(qi,"\n ",f(zi,"\n",e))},Wi=on,Ji=r(function(e,t){return"\n\n("+ji(e+1)+") "+Yi(Qi(t))}),Qi=function(e){return f(Xi,e,mr)},Xi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=Gi(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Pi(n)&&f(Hi,Ui,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(qa,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+ji(s)+"]",o=n,u=f(qa,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(qi,"",Ya(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+ji(Oi(l))+" ways:";return f(qi,"\n\n",f(qa,h,f(Ki,Ji,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(qi,"",Ya(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(qi,"",Ya(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Yi(f(Wi,4,g))+"\n\n")+p}}),Zi=Wr,eo=ze("txIn",Zi),to=function(e){return e},ro=qe("txOut",to),no={$:"Open"},ao=Me,io=ao(mr),oo=a(function(e,t,r,n){return L({agentAddress:t,agentRole:r,userInfo:n,viewPhase:no,web3Context:e},io)}),uo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),so={$:"None"},co=so,fo=function(e){return d(uo,e,io,co,mr)},lo=function(e){return{$:"GotoRoute",a:e}},ho=function(e){return{$:"AbiDecoder",a:e}},po=r(function(e,t){return{$:"Tape",a:e,b:t}}),go=Y,vo=Vr,yo=r(function(e,t){return e<1?t:l(vo,e,go(t),t)}),mo=yo(64),bo=n(function(e,t,r){return L(f(po,e,mo(t)),r)}),Co=r(function(e,t){return e<1?"":l(vo,0,e,t)}),So=Co(64),Eo=r(function(e,t){if("Ok"===t.$){var r=t.a;return Ii(e(r))}var n=t.a;return wi(n)}),To=function(e){return-e},wo=r(function(e,t){return e<1?"":l(vo,-e,go(t),t)}),Io=function(){var e=function(e){if(!f(Hi,di(D("0")),f(Co,63,e)))return wi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(wo,1,e)){case"0":return Ii(!1);case"1":return Ii(!0);default:return wi("Boolean decode error. "+e+" is not 1 or 0.")}};return ho(function(t){var r=t.a,n=t.b;return f(Eo,f(bo,r,n),e(So(n)))})}(),Ao=jr,Bo=function(e){return f(Ao,"0x",e)||f(Ao,"0X",e)?f(yo,2,e):e},ko=function(e){return e.b},No=r(function(e,t){var r=e.a;return f(Eo,ko,r(function(e){return f(po,e,e)}(Bo(t))))}),Ro=Zr,$o=ie,xo=Jr,_o=ae,Lo=function(e){return f(Ro,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return _o(n)}var a=r.a;return $o(a)},xo)},Po=f($a,No,Lo),Do=function(e){return{$:"Magnitude",a:e}},Uo=function(e){return{$:"Pos",a:e}},Oo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Mo=function(e){return{$:"MagnitudeNotNormalised",a:e}},Fo=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 ya(n)}return ma}},Vo=function(e){var t=Fo(e);return"Nothing"!==t.$&&t.a<0},Ko=function(e){return{$:"Neg",a:e}},Ho={$:"Zer"},jo=function(e){return!e.b},qo=r(function(e,t){var r=t.a;if(jo(r))return Ho;switch(e.$){case"Zero":return Ho;case"Positive":return Uo(t);default:return Ko(t)}}),Go=r(function(e,t){return f(Oo,e,Mo(t))}),zo=function(e){return f(Ja,r(function(t,r){return e(t)&&jo(r)?mr:f(qa,t,r)}),mr)}(di(0)),Yo=Ar,Wo=-1+f(Yo,10,7),Jo=Wo+1,Qo=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Xo=function(e){return e<0?f(Qo,Ga(-1),Xo(e+Jo)):L(e/Jo|0,e%Jo)},Zo=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Xo(r+e),i=a.a,o=a.b;return f(qa,o,f(Zo,i,n))}{if(!(_(e,Jo)>0))return F([e]);var u=F([e]);e=0,t=u}}}),eu=function(e){var t=e.a;return Do(zo(f(Zo,0,t)))},tu=r(function(e,t){return l(Ja,r(function(t,r){return f(qa,e(t),r)}),mr,t)}),ru=tu(To),nu={$:"Negative"},au={$:"Positive"},iu={$:"Zero"},ou=function(e){switch(e.$){case"Positive":return nu;case"Negative":return au;default:return iu}},uu=function(e){for(;;){var t=e.a,r=e.b,n=eu(r),a=n.a;if(!Vo(a))return f(qo,t,Do(a));e=f(Go,ou(t),ru(a))}},su=gr,cu=function(e){switch(f(su,e,0).$){case"LT":return nu;case"GT":return au;default:return iu}},fu=function(e){return e<0?-e:e},lu=function(e){return uu(f(Oo,cu(e),Mo(F([fu(e)]))))},du=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(Yo,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},hu=function(e){switch(e.$){case"Zer":return Ho;case"Neg":var t=e.a;return Uo(t);default:return e}},pu=function(e){return{$:"MagnitudePair",a:e}},gu=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(qa,L(a,u),f(gu,i,s))}var c=r.a,a=c.a,i=c.b;return f(qa,L(a,0),f(gu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(qa,L(0,u),f(gu,mr,s))}return mr}),vu=r(function(e,t){var r=e.a,n=t.a;return pu(f(gu,r,n))}),yu=function(e){switch(e.$){case"Zer":return f(Go,iu,mr);case"Neg":var t=e.a.a;return f(Go,au,ru(t));default:var t=e.a.a;return f(Go,au,t)}},mu=r(function(e,t){var r=yu(t),n=r.b,a=yu(e),i=a.b,o=f(vu,i,n),u=o.a,s=f(tu,function(e){return e.a+e.b},u);return uu(f(Oo,au,Mo(s)))}),bu=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 Fa}return a.b.b?Da:f(su,e,t)}}),Cu=function(e){switch(e.$){case"LT":return Fa;case"EQ":return Pa;default:return Da}},Su=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(bu,0,0,n,a)}return Fa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Cu(d(bu,0,0,n,a))}return Da;default:switch(r.b.$){case"Pos":r.a;return Da;case"Zer":r.a,r.b;return Pa;default:r.a;return Fa}}}),Eu=r(function(e,t){return $(f(Su,e,t),Fa)}),Tu=H,wu=r(function(e,t){return!f(Eu,e,t)}),Iu=function(e){switch(e.$){case"Zer":return Do(mr);case"Pos":default:var t=e.a;return t}},Au=r(function(e,t){var r=e.a;return eu(Mo(f(tu,yi(t),r)))}),Bu=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(Au,Do(n),a),u=f(Bu,Do(i),Do(n)),s=u.a,c=f(mu,f(qo,au,o),f(qo,au,Do(f(qa,0,s))));return Iu(c)}var a=r.a;return f(Au,Do(n),a)}return Do(mr)}),ku=function(e){switch(e.$){case"Zer":return iu;case"Pos":return au;default:return nu}},Nu=r(function(e,t){return $(e,iu)||$(t,iu)?iu:$(e,t)?au:nu}),Ru=r(function(e,t){return f(qo,f(Nu,ku(e),ku(t)),f(Bu,Iu(e),Iu(t)))}),$u=function(e){switch(e.$){case"Zer":return Ho;case"Pos":var t=e.a;return Ko(t);default:var t=e.a;return Uo(t)}},xu=r(function(e,t){return f(mu,e,$u(t))}),_u=lu(0),Lu=a(function(e,t,r,n){if(e){var a=lu(e),i=f(Ru,f(Ru,a,n),t),o=f(wu,i,r)?L(f(Ru,a,t),f(xu,r,i)):L(_u,r),u=o.a,s=o.b,c=d(Lu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(mu,u,l),h)}return L(_u,r)}),Pu=ti(f(ri,2,Wo)),Du=n(function(e,t,r){return d(Lu,f(Yo,2,Pu),e,t,r)}),Uu=lu(1),Ou=r(function(e,t){return e}),Mu=n(function(e,t,r){return l(za,Ou(e),t,f(Vi,1,r))}),Fu=function(e){return l(Mu,Ru(lu(Jo)),Uu,e)},Vu=n(function(e,t,r){if(e){var n=l(Du,Fu(e),t,r),a=n.a,i=n.b,o=l(Vu,e-1,i,r),u=o.a,s=o.b;return L(f(mu,a,u),s)}return l(Du,Fu(e),t,r)}),Ku=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},Hu=r(function(e,t){if($(t,_u))return ma;var r=Oi(Ku(e))-Oi(Ku(t))+1,n=l(Vu,f(vi,0,r),hu(e),hu(t)),a=n.a,i=n.b;return ya(L(f(qo,f(Nu,ku(e),ku(t)),Iu(a)),f(qo,ku(e),Iu(i))))}),ju=f(Ru,lu(2),lu(2147483648)),qu=Pr,Gu=function(e){return f(qu,e,"")},zu=Sn,Yu=n(function(e,t,r){return e<=0?r:l(Yu,e>>1,O(t,t),1&e?O(r,t):r)}),Wu=r(function(e,t){return l(Yu,e,t,"")}),Ju=n(function(e,t,r){return O(f(Wu,e-go(r),Gu(t)),r)}),Qu=re,Xu=Br,Zu=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}},es=r(function(e,t){for(;;){if(t<16)return f(qa,Zu(t),e);var r=f(qa,Zu(f(Xu,16,t)),e),n=t/16|0;e=r,t=n}}),ts=function(e){return Qu(e<0?f(qa,D("-"),f(es,mr,-e)):f(es,mr,e))},rs=function(e){var t=f(Hu,e,ju);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=ts(du(a));return $(n,lu(0))?i:O(rs(n),l(Ju,8,D("0"),i))},ns=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Do(mr))?"0":rs(Uo(t));default:var t=e.a;return"-"+ns(f(Ru,lu(-1),e))}},as=function(e){return l(Ju,64,D("0"),e)},is=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=as(ts(a)),c=function(e){return O(e,n)}(as(ts(u)));return P(a+32+(go(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(za,t,P(32*Oi(e),"",""),e))},os=Ur,us=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))))}),ss=n(function(e,t,n){return l(os,r(function(t,r){return l(us,e,xi(t),r)}),t,n)}),cs=function(e){return Ya(l(ss,qa,mr,e))},fs=function(e){return f(qi,"",f(tu,f($a,ts,f(Ju,2,D("0"))),cs(e)))},ls=function(e){return 64-f(Xu,64,e)},ds=function(e){return O(e,f(Wu,ls(go(e)),"0"))},hs=function(e){return L(ya(go(e)/2|0),ds(e))},ps=function(e){return L(ma,as(e))},gs=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("!")}},vs=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"}},ys=Or,ms=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(qu,D("1"),r),!0);case"1":return L(f(qu,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(qu,D("0"),r),!1);case"1":return L(f(qu,D("1"),r),!0);default:break e}return L(r,!0)});return l(ys,t,L("",!1),e).a},bs=function(e){return l(ys,qa,mr,e)},Cs=n(function(e,t,r){for(;;){if(""===t)return Ya(r);var n=e,a=f(yo,e,t),i=f(qa,l(vo,0,e,t),r);e=n,t=a,r=i}}),Ss=r(function(e,t){return e&&""!==t?l(Cs,e,t,mr):F([t])}),Es=function(e){var t=function(){var t=bs(ns(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f($a,ms,f(Ju,256,D("1"))))}var r=t;return L(r,f(Ju,256,D("0")))}(),r=t.a,n=t.b;return Qu(f(tu,gs,f(Ss,4,n(f(qi,"",f(tu,vs,r))))))},Ts=function(e){return{$:"Hex",a:e}},ws=function(e){switch(e.$){case"AddressE":var t=e.a.a;return ps(t);case"UintE":var r=e.a;return ps(ns(r));case"IntE":var n=e.a;return ps(Es(n));case"BoolE":return ps(e.a?"1":"0");case"DBytesE":var a=e.a.a;return hs(a);case"BytesE":var a=e.a.a;return ps(Bo(a));case"StringE":var i=e.a;return hs(fs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return hs(t)}(Zt()(o));default:var i=e.a;return ps(Bo(i))}};try{var Is=Zt();Zt=function(){return Is}}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 As=Dr,Bs=function(e){return 1===go(e)?f(As,"0",e):e},ks=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(qa,n,r);e=i,t=o,r=u}}}),Ns=r(function(e,t){return Ya(l(ks,e,t,mr))}),Rs=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(qa,i,f(qa,u,f(qa,h,f(qa,m,f(Ns,t-4,b))))):f(qa,i,f(qa,u,f(qa,h,f(qa,m,l(Rs,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(Rs,0,e,t)}),xs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),_s=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)}},Ls={$:"LE"},Ps=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,Ls));case"I32":var a=e.a,n=e.b;return d(In,t,r,n,$(a,Ls));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,Ls));case"U32":var a=e.a,n=e.b;return d(kn,t,r,n,$(a,Ls));case"F32":var a=e.a,n=e.b;return d(Nn,t,r,n,$(a,Ls));case"F64":var a=e.a,n=e.b;return d(Rn,t,r,n,$(a,Ls));case"Seq":var i=e.b;return l(Ds,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)}}),Ds=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ps,n,t,r);e=i,t=o,r=u}}),Us=Xe,Os=r(function(e,t){return{$:"Seq",a:e,b:t}}),Ms=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+_s(r),i=n;e=a,t=i}}),Fs=function(e){return f(Os,f(Ms,0,e),e)},Vs=function(e){return{$:"U8",a:e}},Ks=Vs,Hs=r(function(e,t){return _(e,t)<0?e:t}),js=pr,qs=function(e){return{$:"Bytes",a:e}},Gs=qs,zs=function(e){return Us(Fs(f(tu,Gs,Ya(e))))},Ys=Qe,Ws=r(function(e,t){var r=e.a;return f(_n,r,t)}),Js=function(e){return{$:"Decoder",a:e}},Qs=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}}),Xs=r(function(e,t){return Js(f(Qs,e,t))}),Zs=Js(Ln),ec=r(function(e,t){if("Just"===t.$){return t.a}return e}),tc=function(e){return{$:"Done",a:e}},rc=function(e){return{$:"Loop",a:e}},nc=r(function(e,t){var n=t.a;return Js(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),ac=function(e){return Js(r(function(t,r){return L(r,e)}))},ic=r(function(e,t){var r=t.a,n=t.b;return r<=0?ac(tc(Ya(n))):f(nc,function(e){return rc(L(r-1,f(qa,e,n)))},e)}),oc=function(e){return f(ec,mr,f(Ws,f(Xs,L(Ys(e),mr),ic(Zs)),e))},uc=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))}),sc=r(function(e,t){return l(uc,zu,e,t)}),cc=f(Vi,0,4),fc=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}}),lc=Je,dc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),hc=function(e){return f(dc,f($a,lc,zu(4294967295)),e)},pc=r(function(e,t){return 5*t+e}),gc=4294967295>>>32-ai,vc=ir,yc=n(function(e,t,r){for(;;){var n=gc&t>>>e,a=f(vc,n,r);if("SubTree"!==a.$){var i=a.a;return f(vc,gc&t,i)}var o=a.a,u=e-ai,s=t,c=o;e=u,t=s,r=c}}),mc=function(e){return e>>>5<<5},bc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ma:ya(_(e,mc(r))>-1?f(vc,gc&e,i):l(yc,n,e,a))}),Cc=r(function(e,t){var r=f(bc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Sc=n(function(e,t,r){var n=f(pc,e,t);return f(Cc,n,r)}),Ec=or,Tc=a(function(e,t,r,n){var a=gc&t>>>e,i=f(vc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Tc,e-ai,t,r,o);return l(Ec,a,si(u),n)}var s=i.a,c=l(Ec,gc&t,r,s);return l(Ec,a,ui(c),n)}),wc=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,mc(n))>-1?d(ei,n,a,i,l(Ec,gc&e,t,o)):d(ei,n,a,d(Tc,a,e,t,i),o)}),Ic=n(function(e,t,r){return l(wc,e,t,r)}),Ac=a(function(e,t,r,n){var a=f(pc,e,t);return l(Ic,a,r,n)}),Bc=En,kc=r(function(e,t){return l(uc,Bc,e,t)}),Nc=function(e){var t=l(Ja,r(function(t,n){var a={d0:l(Sc,0,t,e.state),d1:l(Sc,1,t,e.state),d2:l(Sc,2,t,e.state),d3:l(Sc,3,t,e.state),d4:l(Sc,4,t,e.state)},i=r(function(e,r){return d(Ac,e,t,f(kc,f(fc,e,a),f(sc,hc(f(fc,f(Xu,5,e+1),a)),f(fc,f(Xu,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,cc);return U(e,{state:t})},Rc=L(0,0),$c=function(e){return{current:Rc,lfsrstate:1,state:e,x:1,y:0}},xc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},_c=L(1,0),Lc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Pc=r(function(e,t){if(e){var n=f(Lc,1,t);return l(uc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Dc=r(function(e,t){var r=f(Xu,32,e/32|0),n=f(Lc,r,t),a=f(Xu,32,e);return f(Pc,a,n)}),Uc=n(function(e,t,r){var n=f(bc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(wc,e,t(a),r)}),Oc=n(function(e,t,r){return l(Uc,e,kc(t),r)}),Mc=a(function(e,t,r,n){var a=f(pc,e,t);return l(Oc,a,r,n)}),Fc=function(e){return l(za,r(function(e,t){var r=(1<>r}),Yc=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Hs,n,r),i=f(tu,function(e){return f(zc,e,g)},f(Vi,0,a)),o=Gc(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))},Xc=function(e){return{$:"KS",a:e}},Zc=function(e){var t=e.a;return Xc({config:t,inputLength:0,partial:mr,state:f(Ti,25,Ou(Rc))})},ef=function(e){return Js(Pn(e))},tf=Us(Fs(mr)),rf=r(function(e,t){var n=t.a;return Js(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),nf=r(function(e,t){return f(rf,function(e){return ef(t)},ef(e))}),af=r(function(e,t){return f(ec,tf,f(Ws,f(nf,e,Ys(t)-e),t))}),of=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Ys(e)?f(qa,e,n.partial):n.partial;if(!(_(l(za,r(function(e,t){return t+Ys(e)}),0,i),a)>-1))return Xc(U(n,{inputLength:Ys(e)+n.inputLength,partial:i}));var o=zs(i),u=f(ec,tf,f(Ws,ef(a),o)),s=oc(u),c=f(Jc,s,n.state),d=Gc(c),h=f(af,a,o),p=tf,g=Xc(U(n,{inputLength:Ys(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),uf=r(function(e,t){return Qc(f(of,Us(Fs(f(tu,Ks,t))),Zc(e)))}),sf=uf(xs),cf=function(e){return Ts(f(qi,"",f(tu,f($a,ts,Bs),f($s,4,sf(f(tu,xi,bs(e)))))))},ff=function(e){return f(Ao,"0x",e)||f(Ao,"0X",e)?e:"0x"+e},lf=function(e){var t=e.a;return ff(t)},df=r(function(e,t){var r=is(f(tu,ws,t)),n=function(e){return O(e,r)}(Bo(lf(cf(e))));return Ts(n)}),hf=function(e){return{data:ya(f(df,"poke()",mr)),decoder:Po(Io),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},pf=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),gf=r(function(e,t){return f(pf,e,t)}),vf=r(function(e,t){return{$:"AgentHistory",a:e,b:t}}),yf=function(e){return{$:"Trade",a:e}},mf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},bf=r(function(e,t){switch(e.$){case"ViewUserRoleChanged":var r=e.a;return d(uo,t,io,co,F([lo(f(vf,t.agentAddress,r))]));case"ViewPhaseChanged":var n=e.a;return d(uo,U(t,{viewPhase:n}),io,co,mr);case"Poke":var a=e.a,i=mf(hf(a)),o={onBroadcast:ma,onMined:ma,onSign:ma},u=f(gf,o,i);return d(uo,t,io,u,mr);case"TradeClicked":var s=e.a;return d(uo,t,io,co,F([lo(yf(s))]));default:return fo(t)}}),Cf=function(e){return{$:"GTag",a:e}},Sf=function(e){return{$:"UserNotice",a:e}},Ef={$:"Web3Connect"},Tf=n(function(e,t,r){return{align:r,mainParagraphs:t,noticeType:e}}),wf=n(function(e,t,r){return e(t(r))}),If=en,Af=tn,Bf=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},kf=Vn,Nf={$:"Empty"},Rf=function(e){return{$:"Styled",a:e}},$f=function(e){return{$:"Text",a:e}},xf=function(e){return{$:"Unstyled",a:e}},_f=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return Rf({html:r(function(t,r){return f(kf,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return xf(f(wf,kf(e),a));case"Text":var i=t.a;return $f(i);default:return Nf}}),Lf=_f,Pf=r(function(e,t){return l(Tf,t.noticeType,f(tu,tu(Lf(e)),t.mainParagraphs),t.align)}),Df=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return Sf(f(Pf,e,r));case"Web3Connect":return Ef;case"GotoRoute":var n=t.a;return lo(n);default:var a=t.a;return Cf(a)}}),Uf=r(function(e,t){return f(tu,Df(e),t)}),Of={$:"Seller"},Mf=function(e){return{$:"Posix",a:e}},Ff=Mf,Vf={autoabortInterval:Ff(0),autorecallInterval:Ff(0),autoreleaseInterval:Ff(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:Of},Kf=function(e){return{$:"TokenValue",a:e}},Hf=function(e){return e.a},jf=r(function(e,t){if("Just"===t.$){var r=t.a;return ya(e(r))}return ma}),qf=r(function(e,t){return f(ec,_u,f(jf,hi,f(Hu,e,t)))}),Gf=r(function(e,t){return Kf(f(qf,Hf(e),lu(t)))}),zf=function(e){return f(Gf,e,12)},Yf=function(e){return f(Gf,e,3)},Wf=Kf(lu(0)),Jf=r(function(e,t){var r=Wf;return{abortPunishment:zf(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yf(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Qf=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Dai"}switch(e.a.$){case"Eth":e.a;return"ETH";case"Kovan":e.a;return"ETH";default:e.a;return"xDai"}},Xf=function(e){if(e.b){var t=e.a;e.b;return ya(t)}return ma},Zf=Gr,el=function(e){var t=Xf(f(Zf,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=go(e)-1-r;return L(O(f(Co,r,e),f(yo,r+1,e)),n)},tl=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}}),rl=function(e){var t=e.a,r=f(tl,di(0),t);return Do(r.b?t:mr)},nl=ee,al=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}}}),il=n(function(e,t,r){var n=f(al,t,r),a=Oi(r)>0;return e>0&&t>0&&a?f(qa,f($s,e,r),l(il,e,t,n)):mr}),ol=r(function(e,t){return l(il,e,e,t)}),ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ma;var a=n.a;return f(jf,qa(a),r)});return f(Ja,t,ya(mr))}(to),sl=function(e){return f(jf,f(wf,rl,Do),ul(f(tu,f($a,Ya,f($a,Qu,nl)),f(ol,7,Ya(e)))))},cl=X,fl=function(e){var t=bs(cl(e));if(!t.b)return ma;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(jf,qo(nu),sl(r))}return ma;case"+":if(t.b.b){var r=t.b;return f(jf,qo(au),sl(r))}return ma;default:var r=t;return f(jf,qo(au),sl(r))}},ll=function(e){var t=function(e){return!f(Xu,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(ec,0,Xf(r)))}},dl=function(e){return f(Ru,e,e)},hl=lu(2),pl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Uu;case"Neg":return Ho;default:if($(r,Uu))return f(Ru,e,t);if(ll(r)){var n=e,a=dl(t),i=f(qf,r,hl);e=n,t=a,r=i;continue e}var n=f(Ru,t,e),a=dl(t),i=f(qf,f(xu,r,Uu),hl);e=n,t=a,r=i;continue e}}),gl=r(function(e,t){return l(pl,Uu,e,t)}),vl=function(e){if(""===e)return ma;var t=el(e),r=t.a,n=t.b,a=fl(r),i=18-n;if(i<0)return ma;if("Nothing"===a.$)return ma;var o=a.a,u=f(Ru,o,f(gl,lu(10),lu(i)));return ya(u)},yl=function(e){return f(jf,Kf,vl(e))},ml=qr,bl=function(e){for(;;){if(f(ml,".",e))return l(vo,0,-1,e);{if(!f(ml,"0",e))return""===e?"0":e;e=l(vo,0,-1,e)}}},Cl=f(wf,f(Ju,7,D("0")),ji),Sl=function(e){return f(qi,"",e)},El=function(e){var t=e.a,r=Ya(t);if(r.b){var n=r.a,a=r.b;return Sl(f(qa,ji(n),f(tu,Cl,a)))}return"0"},Tl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return El(t);default:var t=e.a;return"-"+El(t)}},wl=r(function(e,t){return e<1?t:l(vo,0,-e,t)}),Il=function(e){var t=l(Ju,18,D("0"),Tl(e)),r=f(wl,18,t)+"."+f(wo,18,t);return function(e){return""===e?"0":e}(bl(r))},Al=r(function(e,t){var r=Il(t),n=Xf(f(Zf,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Co,a+1+e,r):f(Co,a,r)}),Bl=r(function(e,t){if("Nothing"===e.$)return Il(Hf(t));var r=e.a;return f(Al,r,Hf(t))}),kl=dr,Nl=te,Rl=function(e){var t=Nl(f(Bl,ma,e));if("Just"===t.$){return t.a}f(kl,"Error converting tokenValue to float: string -> float failed",e);return 0},$l=r(function(e,t){if(""===t)return wi("You must specify a trade amount.");var r=yl(t);if("Nothing"===r.$)return wi("I don't understand this number.");var n=r.a;return Rl(n)<1?wi("Trade amount must be a least 1 "+Qf(e)+"."):Ii(n)}),xl=function(e){if(""===e)return wi("You must specify a fiat price.");var t=fl(e);if("Nothing"===t.$){var r=Nl(e);return wi("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 Ii(n)},_l=r(function(e,t){if("Just"===t.$){var r=t.a;return Ii(r)}return wi(e)}),Ll=function(e){return""===e},Pl=function(e){return Ll(e)?ma:ya(e)},Dl=function(e){return f(_l,"You must specify a fiat type.",Pl(e))},Ul=function(e){return""===e?wi("Must specify a payment method."):Ii(e)},Ol=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ml=g(Ol,ma,ma,ma,ma,ma,ma,ma),Fl=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 Ii(P(i,o,u))}var s=a.c.a;return wi(s)}var c=a.b.a;return wi(c)}var f=a.a.a;return wi(f)},Vl=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),Kl={$:"Custom"},Hl=r(function(e,t){return{info:t,type_:e}}),jl=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return wi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return wi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return wi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return wi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return wi(o)}var l=i.a;return Ii(h(e,u,s,c,f,l))}),ql=r(function(e,t){if("Ok"===t.$){var r=t.a;return Ii(r)}var n=t.a;return wi(e(n))}),Gl=function(e){return e.a},zl=r(function(e,t){return p(jl,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(Hl,Kl,a)]),price:{amount:r,fiatType:n},tradeAmount:e}}),f(ql,function(e){return U(Ml,{daiAmount:ya(e)})},f($l,e,t.daiAmount)),f(ql,function(e){return U(Ml,{fiatAmount:ya(e)})},xl(t.fiatAmount)),f(ql,function(e){return U(Ml,{fiatType:ya(e)})},Dl(t.fiatType)),f(ql,function(e){return U(Ml,{paymentMethod:ya(e)})},Ul(t.paymentMethod)),Fl(d(Vl,function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autorecallInterval:ya("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autoabortInterval:ya("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?Ii(e):wi(U(Ml,{autoreleaseInterval:ya("Must specify a non-zero time for this window")}))},P(t.autorecallInterval,t.autoabortInterval,t.autoreleaseInterval))))}),Yl=n(function(e,t,r){if("Nothing"===t.$)return ma;var n=t.a;if("Nothing"===r.$)return ma;var a=r.a;return ya(f(e,n,a))}),Wl=function(e){if("Ok"===e.$){var t=e.a;return ya(t)}return ma},Jl=function(e){var t=f(zl,e.web3Context.factoryType,e.inputs),r=function(){return $(e.errors,Ml)?Ml:"Ok"===t.$?Ml:t.a}();return U(e,{createParameters:l(Yl,Jf,e.userInfo,Wl(t)),errors:r})},Ql=r(function(e,t){return Jl(U(t,{inputs:e}))}),Xl=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zl=r(function(e,t){return d(Xl,f(Ql,Vf,{allowance:ma,createParameters:ma,depositAmount:ma,errors:Ml,inputs:Vf,showFiatTypeDropdown:!1,txChainStatus:ma,userInfo:t,web3Context:e}),io,co,mr)}),ed=function(e){return{$:"Address",a:e}},td=f($a,Bo,f($a,cl,ed)),rd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return td("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return td("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return td("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return td("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return td("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nd=function(e){return td("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ad=function(e){return{$:"AddressE",a:e}},id=ad,od=function(e){return{$:"UintE",a:e}},ud=od,sd=n(function(e,t,r){return{data:ya(f(df,"approve(address,uint256)",F([id(t),ud(r)]))),decoder:Po(Io),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),cd=function(e){return f(Gf,e,200)},fd=r(function(e,t){return Kf(f(mu,Hf(e),Hf(t)))}),ld=function(e){var t=f(Gf,e.tradeAmount,200);return f(fd,e.pokeReward,f(fd,cd(e.tradeAmount),f(fd,t,function(){return"Buyer"===e.initiatorRole.$?Yf(e.tradeAmount):e.tradeAmount}())))},dd=Af(li),hd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),pd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gd=Zn,vd=Xn,yd=function(e){return f(vd,{caseInsensitive:!1,multiline:!1},e)},md=Qn,bd=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Cd=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}}),Sd=r(function(e,t){return!f(Cd,f(wf,Tu,e),t)}),Ed=Sd(to),Td=G,wd=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Id=n(function(e,t,r){if("Err"===t.$){var n=t.a;return wi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return wi(n)}var i=r.a;return Ii(f(e,a,i))}),Ad=f(Ja,Id(qa),Ii(mr)),Bd=function(e){if(e.b){var t=(e.a,e.b);return ya(t)}return ma},kd=n(function(e,t,r){e:for(;;){if(!t.b)return Ii(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(Yo,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Yo,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Yo,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Yo,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Yo,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Yo,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Yo,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Yo,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Yo,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Yo,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Yo,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Yo,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Yo,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Yo,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Yo,16,e);e=i,t=o,r=u;continue e;default:var s=n;return wi(Gu(s)+" is not a valid hexadecimal character.")}}}),Nd=function(e){if(Ll(e))return wi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Ao,"-",e)){var t=f(ec,mr,Bd(bs(e)));return f(Eo,To,l(kd,Oi(t)-1,t,0))}return l(kd,go(e)-1,bs(e),0)}();return f(ql,function(t){return f(qi," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rd=function(e){var t=bs(e);return function(e){return L(t,e)}(f(wd,mr,Ad(f(tu,Nd,f(zi,"",f(qi,"",f(tu,f($a,ts,Bs),f($s,20,sf(f(tu,f($a,Td,xi),t))))))))))},$d=function(e){var t=r(function(e,t){return!(t>=8&&_i(e)||t<8&&Li(e))}),n=Rd(Bo(e)),a=n.a,i=n.b,o=l(Mi,t,a,i);return!!bd(e)&&Ed(o)},xd=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),_d=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),Ld=function(e){return'"'+e+'"'},Pd=function(e){var t=Bo(e),r=f(Co,24,t),n=f(wo,40,e);return 64===go(t)&&f(Hi,di(D("0")),r)?_d(n)||xd(n)?Ii(ed(n)):$d(n)?Ii(ed(n)):wi("Given address "+Ld(e)+" failed the EIP-55 checksum test."):40!==go(t)?wi("Given address "+Ld(e)+" is not the correct length."):bd(t)?_d(t)||xd(t)?Ii(ed(t)):$d(t)?Ii(ed(t)):wi("Given address "+Ld(e)+" failed the EIP-55 checksum test."):wi("Given address "+Ld(e)+" contains invalid hex characters.")},Dd=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),Pd(So(r)))}),Ud=r(function(e,t){var r=t.a;return ho(function(t){var n=t.a,a=t.b;return r(f(po,n,f(yo,64*e,a)))})}),Od=Qr,Md=r(function(e,t){return f(Od,"data",Po(f(Ud,e,t)))}),Fd=Xr,Vd=r(function(e,t){return f(Od,"topics",f(Fd,e,Po(t)))}),Kd=function(e){return f(jf,f($a,Ya,f(za,r(function(e,t){return f(mu,lu(e),f(Ru,t,ju))}),_u)),ul(f(tu,f($a,Ya,f($a,Qu,f($a,Nd,Wl))),f(ol,8,Ya(e)))))},Hd=function(e){var t=bs(cl(e));e:for(;;){if(!t.b)return ma;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(jf,Ru(lu(-1)),Kd(a))}var i=t.b;i.b;return ma}var a=t.b;return f(jf,Ru(lu(-1)),Kd(a))}return ma;case"+":if(t.b.b){var a=t.b;return Kd(a)}return ma;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kd(a)}t.b;return ma}break e;default:break e}}var a=t;return Kd(a)},jd=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),f(_l,"Error Decoding Uint into BigInt",Hd(ff(So(r)))))}),qd=f(dd,f(Vd,1,Dd),f(dd,f(Md,1,Dd),f(dd,f(Md,0,jd),_o(hd)))),Gd=me,zd=f($a,lf,Gd),Yd=an,Wd=r(function(e,t){return me(l(za,Ee(e),Ce(),t))}),Jd=function(e){return me(l(za,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},Qd=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(Yd,e,Jd(F([L("data",Gd(t.data)),L("topics",f(Wd,zd,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Xd=function(e){var t=e.a;return ff(t)},Zd=r(function(e,t){return l(Ja,r(function(t,r){return e(t)?f(qa,t,r):r}),mr,t)}),eh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return wi(r)}),th=r(function(e,t){return f(Eo,function(e){return e.id},f(eh,function(e){return f(ql,Qi,f(Qd,qd,e).returnData)},f(_l,"No log found from that factoryAddress in that txReceipt",Xf(f(Zd,function(t){return $(f($a,Xd,cl)(t.address),f($a,Xd,cl)(rd(e)))},t.logs)))))}),rh=n(function(e,t,r){return{data:ya(f(df,"allowance(address,address)",F([id(t),id(r)]))),decoder:Po(jd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),nh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Gd(ff(ts(t)));case"EarliestBlock":return Gd("earliest");case"LatestBlock":return Gd("latest");default:return Gd("pending")}},ah=f($a,Xd,Gd),ih=f($a,ns,f($a,ff,Gd)),oh=f($a,ts,f($a,ff,Gd)),uh=sn,sh=function(e){return Jd(f(tu,function(e){var t=e.a,r=e.b;return L(t,f(ec,uh,r))},f(Zd,function(e){e.a;return!$(e.b,ma)},e)))},ch=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return sh(F([L("to",f(jf,ah,t)),L("from",f(jf,ah,r)),L("gas",f(jf,oh,n)),L("gasPrice",f(jf,ih,a)),L("value",f(jf,ih,i)),L("data",f(jf,zd,o))]))},fh=function(e){return{$:"BadBody",a:e}},lh=function(e){return{$:"BadStatus",a:e}},dh=function(e){return{$:"BadUrl",a:e}},hh={$:"NetworkError"},ph={$:"Timeout"},gh=nn,vh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return wi(dh(r));case"Timeout_":return wi(ph);case"NetworkError_":return wi(hh);case"BadStatus_":var n=t.a,a=t.b;return wi(lh(n.statusCode));default:var n=t.a,a=t.b,i=f(gh,f(Od,"result",e),a);if("Ok"===i.$){var o=i.a;return Ii(o)}var u=i.a;return wi(fh(Qi(u)))}}),yh=me,mh=n(function(e,t,r){return Jd(F([L("id",yh(e)),L("jsonrpc",Gd("2.0")),L("method",Gd(t)),L("params",f(Wd,to,r))]))}),bh={$:"RBEmpty_elm_builtin"},Ch=bh,Sh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ma;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(su,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return ya(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Eh={$:"Black"},Th=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),wh={$:"Red"},Ih=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(Th,wh,t,r,h(Th,Eh,c,f,l,d),h(Th,Eh,i,o,u,s))}return h(Th,e,i,o,h(Th,wh,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(Th,wh,c,f,h(Th,Eh,g,v,y,m),h(Th,Eh,t,r,d,a))}return h(Th,e,t,r,n,a)}),Ah=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Th,wh,e,t,bh,bh);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(su,e,a).$){case"LT":return h(Ih,n,a,i,l(Ah,e,t,o),u);case"EQ":return h(Th,n,a,t,o,u);default:return h(Ih,n,a,i,o,l(Ah,e,t,u))}}),Bh=n(function(e,t,r){var n=l(Ah,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(Th,Eh,a,i,o,u)}return n}),kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Nh=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(Th,wh,p,g,h(Th,Eh,r,n,h(Th,wh,i,o,u,s),v),h(Th,Eh,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(Th,Eh,r,n,h(Th,wh,i,o,u,s),h(Th,wh,f,l,d,m))}return e},Rh=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(Th,wh,i,o,h(Th,Eh,s,c,f,l),h(Th,Eh,r,n,d,h(Th,wh,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(Th,Eh,r,n,h(Th,wh,i,o,C,d),h(Th,wh,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(Th,r,u,s,c,h(Th,wh,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 Rh(t)}break e}o.a,o.d;return Rh(t)}break e}return t}),xh=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(Th,t,r,n,xh(a),u)}var s=Nh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Ih,c,f,l,xh(d),p)}return bh}return h(Th,t,r,n,xh(a),u)}return bh},_h=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return bh;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(Th,r,n,a,f(_h,e,i),o)}var s=Nh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Ih,c,l,d,f(_h,e,p),v)}return bh}return h(Th,r,n,a,f(_h,e,i),o)}return f(Lh,e,g($h,e,t,r,n,a,i,o))}),Lh=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=kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Ih,r,s,c,i,xh(o))}return bh}return h(Ih,r,n,a,i,f(_h,e,o))}return bh}),Ph=r(function(e,t){var r=f(_h,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(Th,Eh,n,a,i,o)}return r}),Dh=n(function(e,t,r){var n=t(f(Sh,e,r));if("Just"===n.$){var a=n.a;return l(Bh,e,a,r)}return f(Ph,e,r)}),Uh=function(e){return"Just"===e.$},Oh=vn,Mh=yn,Fh=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Vh=function(e){return{$:"BadUrl_",a:e}},Kh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Hh={$:"NetworkError_"},jh=function(e){return{$:"Receiving",a:e}},qh=function(e){return{$:"Sending",a:e}},Gh={$:"Timeout_"},zh=function(e){return f(ra,"application/json",f(Wi,0,e))},Yh=n(function(e,t,r){return zh(l(mh,e,t,r))}),Wh=f(ta,"",to),Jh=we,Qh=Te,Xh=function(e){if("Ok"===e.$){var t=e.a;return Qh(t)}var r=e.a;return Jh(r)},Zh=function(e){return l(ea,vr,Xh,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ma,url:e.url})},ep=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Zh({body:l(Yh,1,r,n),headers:mr,method:"POST",resolver:Wh(vh(a)),timeout:ma,url:t})},tp=n(function(e,t,r){return ep({decoder:t.decoder,method:"eth_call",params:F([ch(t),nh(r)]),url:e})}),rp={$:"LatestBlock"},np=r(function(e,t){return l(tp,e,t,rp)}),ap=function(e){return{$:"Perform",a:e}},ip=cn,op=Qh(vr),up=r(function(e,t){return f(ip,function(t){return Qh(e(t))},t)}),sp=n(function(e,t,r){return f(ip,function(t){return f(ip,function(r){return Qh(f(e,t,r))},r)},t)}),cp=function(e){return l(Ja,sp(qa),Qh(mr),e)},fp=r(function(e,t){var r=t.a;return ke(f(ip,Oh(e),r))}),lp=n(function(e,t,r){return f(up,function(e){return vr},cp(f(tu,fp(e),t)))}),dp=n(function(e,t,r){return Qh(vr)}),hp=r(function(e,t){var r=t.a;return ap(f(up,e,r))});gn.Task=De(op,lp,dp,hp);var pp=Oe("Task"),gp=fn,vp=r(function(e,t){return pp(ap(f(gp,f(wf,f(wf,Qh,e),wi),f(ip,f(wf,f(wf,Qh,e),Ii),t))))}),yp=i(function(e,t,r,n,a){return f(vp,a,f(np,e.httpProvider,l(rh,nd(t),r,n)))}),mp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return td("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return td("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return td("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return td("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return td("0x092110996699c3E06e998d89F0f4586026e44F0F")}},bp=function(e){return{$:"BoolE",a:e}},Cp=bp,Sp=function(e){return{$:"StringE",a:e}},Ep=Sp,Tp=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:ya(f(df,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([id(t),id(r),Cp(n),ud(a),ud(i),ud(o),ud(u),ud(s),ud(c),ud(l),ud(d),Ep(h),Ep(p)]))),decoder:Po(Dd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}}}}}}}}}}}}}},wp=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:ya(f(df,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([id(t),id(r),Cp(n),ud(a),ud(i),ud(o),ud(u),ud(s),ud(c),ud(l),ud(d),Ep(h),Ep(p)]))),decoder:Po(Dd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}}}}}}}}}}}}}},Ip=r(function(e,t){return{paymentMethods:t,price:e}}),Ap=function(e){return Gd(Tl(e))},Bp=function(e){return f(Wd,to,F([Gd(e.fiatType),Ap(e.amount)]))},kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Np=function(e){return Jd(F([L("type",Gd(kp(e.type_))),L("info",Gd(e.info))]))},Rp=function(e){var t=Bp(e.price),r=f(Wd,Np,e.paymentMethods);return f(Wi,0,Jd(F([L("paymentmethods",r),L("price",t)])))},$p=r(function(e,t){return U(t,{value:ya(e)})}),xp=function(e){return lu(Gl(e))},_p=function(e){return f(qf,xp(e),lu(1e3))},Lp=r(function(e,t){var r=function(){return"Token"===e.$?Tp:wp}();return function(){return"Native"===e.$?$p(Hf(ld(t))):to}()(r(rd(e))(t.initiatorAddress)(mp(e))($(t.initiatorRole,Of))(Hf(t.tradeAmount))(Hf(Yf(t.tradeAmount)))(Hf(zf(t.tradeAmount)))(Hf(t.pokeReward))(_p(t.autorecallInterval))(_p(t.autoabortInterval))(_p(t.autoreleaseInterval))(Hf(cd(t.tradeAmount)))(Rp(f(Ip,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Pp=function(e){return{$:"CreateMined",a:e}},Dp={$:"CreateNeedsSig"},Up=function(e){return{$:"CreateSigned",a:e}},Op=r(function(e,t){var r=mf(f(Lp,e,t)),n={onBroadcast:ma,onMined:ya(L(Pp,ma)),onSign:ya(Up)};return L(ya(Dp),f(gf,n,r))}),Mp=function(e){return{$:"AllowanceFetched",a:e}},Fp=r(function(e,t){return{$:"ApproveMining",a:e,b:t}}),Vp={$:"ApproveNeedsSig"},Kp=r(function(e,t){return{$:"ApproveSigned",a:e,b:t}}),Hp=function(e){return{$:"Confirm",a:e}},jp=function(e){return{$:"CreateMining",a:e}},qp={$:"NoOp"},Gp=function(e){return{appCmds:mr,chainCmd:co,cmd:io,model:e}},zp=function(e){return nl(Tl(e))},Yp={$:"BottomRight"},Wp={$:"ShouldBeImpossible"},Jp=function(e){return $f(e)},Qp=r(function(e,t){f(kl,e,t);return{align:Yp,mainParagraphs:F([F([Jp(e)])]),noticeType:Wp}}),Xp={$:"Error"},Zp=r(function(e,t){f(kl,e+" fetch error",t);return{align:Yp,mainParagraphs:F([F([Jp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Xp}}),eg=r(function(e,t){return{align:Yp,mainParagraphs:F([F([Jp('Error mining "'+e+'" transaction: '+t)])]),noticeType:Xp}}),tg={$:"Caution"},rg=r(function(e,t){return{align:Yp,mainParagraphs:F([F([Jp('Error signing "'+e+'" transaction: '+t)])]),noticeType:tg}}),ng=r(function(e,t){if("Just"===t.$){return e(t.a)}return ma}),ag=r(function(e,t){return 1-e(1-t)}),ig=function(e){return f(Yo,e,5)},og=ag(ig),ug={easing:og,offset:12,speed:200},sg=function(e){return{$:"External",a:e}},cg=function(e){return{$:"Internal",a:e}},fg=function(e){return{$:"NotFound",a:e}},lg=function(e){for(;;){e=e.a}},dg=r(function(e,t){return pp(ap(f(up,e,t)))}),hg={$:"Http"},pg={$:"Https"},gg=Hr,vg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),yg=i(function(e,t,r,n,a){if(Ll(a)||f(gg,"@",a))return ma;var i=f(Zf,":",a);if(i.b){if(i.b.b)return ma;var o=i.a,u=nl(f(yo,o+1,a));if("Nothing"===u.$)return ma;var s=u;return ya(p(vg,e,f(Co,o,a),s,t,r,n))}return ya(p(vg,e,a,ma,t,r,n))}),mg=a(function(e,t,r,n){if(Ll(n))return ma;var a=f(Zf,"/",n);if(a.b){var i=a.a;return h(yg,e,f(yo,i,n),t,r,f(Co,i,n))}return h(yg,e,"/",t,r,n)}),bg=n(function(e,t,r){if(Ll(r))return ma;var n=f(Zf,"?",r);if(n.b){var a=n.a;return d(mg,e,ya(f(yo,a+1,r)),t,f(Co,a,r))}return d(mg,e,ma,t,r)}),Cg=r(function(e,t){if(Ll(t))return ma;var r=f(Zf,"#",t);if(r.b){var n=r.a;return l(bg,e,ya(f(yo,n+1,t)),f(Co,n,t))}return l(bg,e,ma,t)}),Sg=function(e){return f(Ao,"http://",e)?f(Cg,hg,f(yo,7,e)):f(Ao,"https://",e)?f(Cg,pg,f(yo,8,e)):ma},Eg=Jt,Tg=zt(Yt),wg=ca,Ig=r(function(e,t){return L(e,t)}),Ag=_r,Bg=a(function(e,t,r,n){var a=_(r,n)>0?mi:Ga,i=fu(r-n),o=f(vi,1,Ag(i)/e|0),u=o,s=f(tu,function(e){return t(e/u)},f(Vi,0,o));return e<=0||$(r,n)?mr:f(tu,function(e){return f(a,r,e*i)},s)}),kg=r(function(e,t){var n=r(function(t,r){return cp(f(tu,wg(0),d(Bg,e.speed,e.easing,t,r-e.offset)))});return f(ip,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(sp,Ig,Tg,Eg(t)))}),Ng=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(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),Mp);return d(Xl,t,i,co,mr)}return Gp(t);case"ChangeRole":var o=e.a,u=t.inputs;return Gp(U(t,{inputs:U(u,{userRole:o})}));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Gp(f(Ql,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Gp(f(Ql,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Gp(f(Ql,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Gp(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return Gp(f(Ql,U(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autorecallInterval:g}),t));case"AutoabortIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autoabortInterval:g}),t));case"AutoreleaseIntervalChanged":var g=e.a,u=t.inputs;return Gp(f(Ql,U(u,{autoreleaseInterval:g}),t));case"ShowCurrencyDropdown":var v=e.a,u=t.inputs;return Gp((v?Ql(U(u,{fiatType:""})):to)(U(t,{showFiatTypeDropdown:v})));case"CreateClicked":var n=e.a,y=f(zl,t.web3Context.factoryType,t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jf,n,m);return Gp(U(t,{depositAmount:ya(Hf(ld(b))),txChainStatus:ya(Hp(b))}))}var C=y.a;return d(Xl,U(t,{errors:C}),f(vp,Ou(qp),function(){return f(kg,U(ug,{offset:60}),"inputError")}()),co,mr);case"AbortCreate":return Gp(U(t,{txChainStatus:ma}));case"ConfirmCreate":var b=e.a,S=e.b,E=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return f(Op,t.web3Context.factoryType,b);var r=e.a,n=function(){var e=mf(l(sd,nd(r),rd(t.web3Context.factoryType),S)),n={onBroadcast:ma,onMined:ma,onSign:ya(Kp(b))};return f(gf,n,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Su,i,S),Da)?L(ya(Vp),n):f(Op,t.web3Context.factoryType,b)}return L(ya(Vp),n)}(),T=E.a,w=E.b;return d(Xl,U(t,{txChainStatus:T}),io,w,mr);case"ApproveSigned":var b=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Gp(U(t,{txChainStatus:ya(f(Fp,b,A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"appove",B))]));case"AllowanceFetched":var k=e.a;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ya(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(Su,N,P),Da))return Gp(R);var D=f(Op,R.web3Context.factoryType,b),T=D.a,w=D.b;return d(Xl,U(R,{txChainStatus:T}),io,w,mr)}return Gp(R)}var O=k.a;return d(Xl,t,io,co,F([Sf(f(Zp,"allowance",O))]));case"CreateSigned":var I=e.a;if("Ok"===I.$){var A=I.a;return Gp(U(t,{txChainStatus:ya(jp(A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(Xl,t,io,co,F([Sf(f(eg,"create",B))]))}var M=e.a.a,V=f(ng,zp,Wl(f(th,t.web3Context.factoryType,M)));if("Just"===V.$){var K=V.a;return d(Xl,t,io,co,F([lo(yf(K))]))}return d(Xl,t,io,co,F([Sf(f(Qp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',M))]));case"Web3Connect":return d(Xl,t,io,co,F([Ef]));default:return Gp(t)}}),Rg=function(e){return sh(F([L("to",f(jf,ah,e.to)),L("from",f(jf,ah,e.from)),L("gas",f(jf,oh,e.gas)),L("gasPrice",f(jf,ih,e.gasPrice)),L("value",f(jf,ih,e.value)),L("data",f(jf,zd,e.data)),L("nonce",f(jf,oh,e.nonce))]))},$g=function(e){return{$:"TxSentry",a:e}},xg=r(function(e,t){return Jd(F([L("ref",yh(e)),L("txParams",t)]))}),_g=function(e){return{$:"Signing",a:e}},Lg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:_g(e)}}),Pg=mn,Dg=n(function(e,t,r){var n=e.a,a=Rg(r),i=l(Bh,n.ref,f(Lg,r,t),n.txs);return L($g(U(n,{ref:n.ref+1,txs:i})),f(Pg,n.tagger,n.outPort(f(xg,n.ref,a))))}),Ug=Dg,Og=r(function(e,t){if("None"===t.$)return L(e,io);var r=t.a,n=t.b;return l(Ug,e,r,n)}),Mg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Fg=r(function(e,t){if("None"===t.$)return so;var r=t.a,n=t.b,a=l(Mg,f(jf,wf(e),r.onSign),f(jf,wf(e),r.onBroadcast),f(jf,function(t){var r=t.a,n=t.b;return L(f($a,r,e),f(jf,function(t){return{confirmations:t.confirmations,toMsg:f($a,t.toMsg,e)}},n))},r.onMined));return f(pf,a,n)}),Vg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return wa}e.a;return Ta}switch(e.a.$){case"Eth":e.a;return wa;case"Kovan":e.a;return Ta;default:e.a;return Ia(100)}},Kg=r(function(e,t){return f(su,Gl(e),Gl(t))}),Hg=r(function(e,t){return $(t.state.phase,no)&&$(f(Kg,t.derived.phaseEndTime,e),Fa)}),jg=function(e){if(""===e)return Ii(ma);var t=yl(e);if("Nothing"===t.$)return wi("I can't interpret this number");var r=t.a;return Ii(ya(r))},qg=function(e){if(""===e)return Ii(ma);var t=fl(e);if("Nothing"===t.$)return wi("I don't understand this number.");var r=t.a;return Ii(ya(r))},Gg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),zg=d(Gg,ma,ma,ma,ma),Yg=i(function(e,t,r,n,a){if("Err"===t.$){var i=t.a;return wi(i)}var o=t.a;if("Err"===r.$){var i=r.a;return wi(i)}var u=r.a;if("Err"===n.$){var i=n.a;return wi(i)}var s=n.a;if("Err"===a.$){var i=a.a;return wi(i)}var c=a.a;return Ii(d(e,o,u,s,c))}),Wg=function(e){return h(Yg,a(function(t,r,n,a){return{dai:{max:r,min:t},fiat:f(jf,function(e){return{max:a,min:n,type_:e}},Pl(e.fiatType)),paymentMethodTerms:e.paymentMethodTerms}}),f(ql,function(e){return U(zg,{minDai:ya(e)})},jg(e.minDai)),f(ql,function(e){return U(zg,{maxDai:ya(e)})},jg(e.maxDai)),f(ql,function(e){return U(zg,{minFiat:ya(e)})},qg(e.minFiat)),f(ql,function(e){return U(zg,{maxFiat:ya(e)})},qg(e.maxFiat)))},Jg=r(function(e,t){var r=function(t){return f(Sd,function(e){return f(gg,cl(e),cl(t))},e)};return f(Cd,function(e){return r(e.info)},t)}),Qg=r(function(e,t){return U(t,{paymentMethod:e})}),Xg=r(function(e,t){return U(t,{paymentMethodTerms:e})}),Zg=r(function(e,t){return f(Su,Hf(e),Hf(t))}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(Qa,e.inputs.paymentMethodTerms,F([t]));return tv(U(e,{inputs:f(Xg,r,f(Qg,"",e.inputs))}))},tv=function(e){var t=ev(e),n=Wg(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(Jg,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(Su,e.terms.price.amount,n),Da)}()&&function(){var t=r.max;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Su,e.terms.price.amount,n),Fa)}()},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Zg,e.parameters.tradeAmount,r),Da)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(Zg,e.parameters.tradeAmount,r),Fa)}()},s=r(function(e,r){return f(Hg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},rv={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},nv=r(function(e,t){return f(su,e.creationInfo.blocknum,t.creationInfo.blocknum)}),av=n(function(e,t,r){return L(tv({browsingRole:t,errors:zg,filterFunc:Hg,inputs:rv,showCurrencyDropdown:!1,sortFunc:nv,userInfo:r,web3Context:e}),io)}),iv=r(function(e,t){return f(Su,e.amount,t.amount)}),ov=r(function(e,t){var r=f(Zd,js(e),t.inputs.paymentMethodTerms);return tv(U(t,{inputs:f(Xg,r,t.inputs)}))}),uv=function(e){return U(e,{filterFunc:Hg,inputs:rv,sortFunc:nv})},sv={$:"Ascending"},cv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),fv=function(e){return l(cv,e,io,mr)},lv=r(function(e,t){return U(t,{fiatType:e})}),dv=r(function(e,t){return U(t,{maxDai:e})}),hv=r(function(e,t){return U(t,{maxFiat:e})}),pv=r(function(e,t){return U(t,{minDai:e})}),gv=r(function(e,t){return U(t,{minFiat:e})}),vv=n(function(e,t,r){return f(e,r,t)}),yv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(cv,U(t,{inputs:f(pv,n,t.inputs)}),io,mr);case"MaxDaiChanged":var n=e.a;return l(cv,U(t,{inputs:f(dv,n,t.inputs)}),io,mr);case"MinFiatChanged":var n=e.a;return l(cv,U(t,{inputs:f(gv,n,t.inputs)}),io,mr);case"MaxFiatChanged":var n=e.a;return l(cv,U(t,{inputs:f(hv,n,t.inputs)}),io,mr);case"FiatTypeInputChanged":var n=e.a;return l(cv,U(t,{inputs:f(lv,n,t.inputs)}),io,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(cv,U(t,{inputs:(a?lv(""):to)(t.inputs),showCurrencyDropdown:a}),io,mr);case"FiatTypeLostFocus":return l(cv,U(t,{showCurrencyDropdown:!1}),io,mr);case"PaymentMethodInputChanged":var n=e.a;return l(cv,U(t,{inputs:f(Qg,n,t.inputs)}),io,mr);case"AddSearchTerm":return l(cv,ev(t),io,mr);case"RemoveTerm":var i=e.a;return l(cv,f(ov,i,t),io,mr);case"ApplyInputs":return l(cv,tv(t),io,mr);case"ResetSearch":return l(cv,uv(t),io,mr);case"TradeClicked":var o=e.a;return l(cv,t,io,F([lo(yf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,sv)?vv:to)(r(function(e,t){switch(u.$){case"Expiring":return f(Kg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(Zg,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(iv,e.terms.price,t.terms.price);case"Margin":return f(ec,Pa,l(Yl,r(function(e,t){return f(su,e,t)}),e.derived.margin,t.derived.margin));case"PaymentMethods":return f(nv,e,t);case"AutoabortWindow":return f(Kg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(Kg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(cv,U(t,{sortFunc:c}),io,mr);default:return fv(t)}}),mv=n(function(e,t,r){var n=e.factoryType;if("Token"===n.$){var a=n.a;return h(yp,e,a,t.address,rd(e.factoryType),r)}return io}),bv=function(e){return{$:"AllowanceFetched",a:e}},Cv=function(e){return{$:"Menu",a:e}},Sv={$:"NoneStarted"},Ev=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Tv=r(function(e,t){var r={state:Cv(Sv),textInput:"",tokenAllowance:ma,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(mv,r.web3Context,e,bv)}return io}();return d(Ev,r,n,co,mr)}),wv=function(e){return{$:"ApproveSigned",a:e}},Iv=r(function(e,t){var r=mf(l(sd,nd(e),rd(ga(e)),Hf(t))),n={onBroadcast:ma,onMined:ma,onSign:ya(wv)};return f(gf,n,r)}),Av=function(e){return{$:"OpenMined",a:e}},Bv=function(e){return{$:"OpenSigned",a:e}},kv=r(function(e,t){var r=mf(f(Lp,e,t)),n={onBroadcast:ma,onMined:ya(L(Av,ma)),onSign:ya(Bv)};return f(gf,n,r)}),Nv=function(e){return{$:"ApproveMining",a:e}},Rv=function(e){return{$:"ApproveNeedsSig",a:e}},$v={$:"OpenMining"},xv={$:"OpenNeedsSig"},_v={$:"ReadyToOpen"},Lv=r(function(e,t){return{$:"Spec",a:e,b:t}}),Pv=function(e){return{$:"StartPrompt",a:e}},Dv=r(function(e,t){return Kf(f(Ru,Hf(e),lu(t)))}),Uv=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Gf,f(Dv,e.daiAmountIn,100*t),100+t)},Ov=n(function(e,t,r){var n=t.intervals,a=n.a,i=n.b,o=n.c;return f(Jf,e,{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,initiatorRole:t.initiatorRole,paymentMethods:F([f(Hl,Kl,r)]),price:t.fiatValue,tradeAmount:Uv(t)})}),Mv=function(e){return{appCmds:mr,chainCmd:co,cmd:io,model:e}},Fv=function(e){return Kf(e)},Vv=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(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),bv);return d(Ev,t,i,co,mr)}return Mv(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(Zg,r,o.daiAmountIn),Da)?Cv(Pv(o)):f(Lv,o,_v)}return Cv(Pv(o))}();return Mv(U(t,{state:u}))}return Mv(U(t,{state:f(Lv,o,_v)}));case"ApproveClicked":var o=e.a,s=t.web3Context.factoryType;if("Token"===s.$){var a=s.a,c=f(Iv,a,o.daiAmountIn);return d(Ev,U(t,{state:Cv(Rv(o))}),io,c,mr)}return d(Ev,t,io,co,F([Sf(f(Qp,"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 Mv(U(t,{state:f(Lv,o,Nv(v))}))}return d(Ev,t,io,co,F([Sf(f(Qp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(Ev,t,io,co,F([Sf(f(rg,"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 Mv($(f(Su,C,Hf(o.daiAmountIn)),Da)?U(t,{tokenAllowance:ya(Fv(C))}):U(t,{state:f(Lv,o,_v),tokenAllowance:ya(Fv(C))}))}return Mv(t)}var E=b.a.a;return d(Ev,t,io,co,F([Sf(f(Zp,"token allowance",E))]));case"OpenClicked":var n=e.a,T=e.b,w=l(Ov,n,T,t.textInput),c=f(kv,t.web3Context.factoryType,w);return d(Ev,U(t,{state:f(Lv,T,xv)}),io,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 Mv(U(t,{state:f(Lv,w,$v)}))}return d(Ev,t,io,co,F([Sf(f(Qp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(Ev,t,io,co,F([Sf(f(rg,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ng,zp,Wl(f(th,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(Ev,t,io,co,F([lo(yf(R))]))}return d(Ev,t,io,co,F([Sf(f(Qp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',k))]))}var y=B.a;return d(Ev,t,io,co,F([Sf(f(eg,"Open trade",y))]));case"TextInputChanged":var x=e.a;return Mv(U(t,{textInput:x}));case"ChangeState":var u=e.a;return Mv(U(t,{state:u}));case"AbortCreate":return Mv(U(t,{state:Cv(Sv)}));case"NoOp":return Mv(t);default:return d(Ev,t,io,co,F([Ef]))}}),Kv=function(e){return"Buyer"===e.$?"buyer":"seller"},Hv=function(e){return e.a+"="+e.b},jv=function(e){return e.b?"?"+f(qi,"&",f(tu,Hv,e)):""},qv=r(function(e,t){return"/"+(f(qi,"/",e)+jv(t))}),Gv=function(e){switch(e.$){case"Home":return f(qv,F(["DAIHard"]),mr);case"QuickCreate":return f(qv,F(["DAIHard","quickcreate"]),mr);case"Create":return f(qv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a;return f(qv,F(["DAIHard","trade",ji(t)]),mr);case"Marketplace":var r=e.a;return f(qv,F(["DAIHard","marketplace",Kv(r)]),mr);case"AgentHistory":var n=e.a,r=e.b;return f(qv,F(["DAIHard","history",Xd(n),function(){return"Buyer"===r.$?"buyer":"seller"}()]),mr);default:return f(qv,mr,mr)}},zv={$:"NotFound"},Yv={$:"Create"},Wv={$:"Home"},Jv=function(e){return{$:"Marketplace",a:e}},Qv={$:"QuickCreate"},Xv=function(e){return{$:"Parser",a:e}},Zv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),ey=r(function(e,t){return Xv(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(Zv,f(qa,u,r),s,a,i,o(l))])}return mr}return mr})}),ty=f(ey,"ADDRESS",f($a,Pd,Wl)),ry={$:"Buyer"},ny=f(ey,"BUYERORSELLER",function(e){switch(e){case"buyer":return ya(ry);case"seller":return ya(Of);default:return ma}}),ay=f(ey,"NUMBER",nl),iy=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Zv,r,n,a,i,e(o))}),oy=r(function(e,t){var r=t.a;return Xv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(tu,iy(u),r(h(Zv,n,a,i,o,e)))})}),uy=function(e){return l(Ja,Qa,mr,e)},sy=r(function(e,t){return uy(f(tu,e,t))}),cy=function(e){return Xv(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(Zv,f(qa,u,r),s,a,i,o)]):mr}return mr})},fy=r(function(e,t){var r=e.a,n=t.a;return Xv(function(e){return f(sy,n,r(e))})}),ly=Xv(function(e){return F([e])}),dy=f(fy,cy("DAIHard"),function(e){return Xv(function(t){return f(sy,function(e){return(0,e.a)(t)},e)})}(F([f(oy,Wv,ly),f(oy,Qv,cy("quickcreate")),f(oy,Yv,cy("create")),f(oy,yf,f(fy,cy("trade"),ay)),f(oy,Jv,f(fy,cy("marketplace"),ny)),f(oy,vf,f(fy,cy("history"),f(fy,ty,ny))),f(oy,function(e){return f(vf,e,Of)},f(fy,cy("history"),ty))]))),hy=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 ya(t.value)}return ya(t.value)}return ma}},py=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(qa,t,py(r))}return mr}return mr},gy=function(e){var t=f(zi,"/",e);if(t.b&&""===t.a){var r=t.b;return py(r)}var r=t;return py(r)},vy=Xt,yy=r(function(e,t){if("Nothing"===t.$)return ya(F([e]));var r=t.a;return ya(f(qa,e,r))}),my=r(function(e,t){var r=f(zi,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=vy(n);if("Nothing"===o.$)return t;var u=o.a,s=vy(i);if("Nothing"===s.$)return t;var c=s.a;return l(Dh,u,yy(c),t)}return t}),by=function(e){if("Nothing"===e.$)return Ch;var t=e.a;return l(Ja,my,Ch,f(zi,"&",t))},Cy=r(function(e,t){var r=e.a;return hy(r(h(Zv,mr,gy(t.path),by(t.query),t.fragment,to)))}),Sy=function(e){return f(ec,zv,f(Cy,dy,e))},Ey=ia,Ty=r(function(e,t){return f(Ey,e,Gv(t))}),wy=qe("connectToWeb3",function(e){return uh}),Iy=function(e){return Jd(F([L("event",Gd(e.event)),L("category",Gd(e.category)),L("label",Gd(e.label)),L("value",yh(e.value))]))},Ay=r(function(e,t){return Jd(F([L("address",Gd(Xd(e))),L("signSeedMsg",Gd(t))]))}),By=qe("gTagOut",to),ky=qe("genPrivkey",to),Ny=r(function(e,t){return U(t,{userInfo:e})}),Ry=r(function(e,t){return L(f(Ql,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(yp,t.web3Context,a,n.address,rd(t.web3Context.factoryType),Mp)}return io}())}),$y=r(function(e,t){return U(t,{userInfo:e})}),xy=r(function(e,t){return L(U(t,{userInfo:e}),function(){if("Just"===e.$){var r=e.a;return l(mv,t.web3Context,r,bv)}return io}())}),_y=function(e){return{$:"AllowanceFetched",a:e}},Ly=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(yp,t.web3Context,i,n.address,a.creationInfo.address,_y)}return io}())}),Py=function(e){return{$:"AgentHistoryModel",a:e}},Dy=function(e){return{$:"CreateModel",a:e}},Uy=function(e){return{$:"CreateMsg",a:e}},Oy=function(e){return{$:"MarketplaceModel",a:e}},My=function(e){return{$:"QuickCreateModel",a:e}},Fy=function(e){return{$:"QuickCreateMsg",a:e}},Vy=function(e){return{$:"TradeModel",a:e}},Ky=function(e){return{$:"TradeMsg",a:e}},Hy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,io);case"CreateModel":var r=t.a,n=f(Ry,e,r),a=n.a,i=n.b;return L(Dy(a),f(Pg,Uy,i));case"QuickCreateModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(Pg,Fy,c));case"TradeModel":var l=t.a,d=f(Ly,e,l),h=d.a,p=d.b;return L(Vy(h),f(Pg,Ky,p));case"MarketplaceModel":var g=t.a;return L(Oy(f($y,e,g)),io);default:var v=t.a;return L(Py(f(Ny,e,v)),io)}}),jy=r(function(e,t){return U(t,{web3Context:e})}),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){switch(t.$){case"BetaLandingPage":return P(t,io,ma);case"CreateModel":var r=t.a;return P(Dy(f(qy,e,r)),io,ma);case"QuickCreateModel":var n=t.a;return P(My(f(zy,e,n)),io,ma);case"TradeModel":t.a;return P(t,io,ya(Jv(ry)));case"MarketplaceModel":var a=t.a;return P(Oy(f(Gy,e,a)),io,ma);default:var i=t.a;return P(Py(f(jy,e,i)),io,ma)}}),Wy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Jy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Qy=function(e){return Jy(p(Wy,e,ma,ma,ma,ma,ma))},Xy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Zy=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},em=Zy(f(Xy,ma,ma)),tm=r(function(e,t){return{address_:e,blocknum:t}}),rm=function(e){return ho(function(t){return Ii(L(t,e))})},nm=r(function(e,t){return L(t.a,e(t.b))}),am=n(function(e,t,r){var n=t.a,a=r.a;return ho(function(t){return f(eh,function(t){var r=t.a,n=t.b;return f(Eo,nm(e(n)),a(r))},n(t))})}),im=r(function(e,t){return l(am,r(function(e,t){return e(t)}),t,e)}),om=Po(f(im,jd,f(im,Dd,rm(tm)))),um=r(function(e,t){return{data:ya(f(df,"createdTrades(uint256)",F([ud(t)]))),decoder:om,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),sm=n(function(e,t,r){return f(vp,r,f(np,e.httpProvider,f(um,rd(e.factoryType),t)))}),cm=function(e){return{$:"CreationInfoFetched",a:e}},fm=r(function(e,t){return l(sm,e,lu(t),cm)}),lm=function(e){return{$:"EventSentryMsg",a:e}},dm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),hm=Lo(f($a,Bo,Nd)),pm=function(e){return ep({decoder:hm,method:"eth_blockNumber",params:mr,url:e})},gm=function(e){return{$:"BlockNumber",a:e}},vm=function(e){return{$:"EventSentry",a:e}},ym=function(e){return{$:"Set_elm_builtin",a:e}},mm=ym(Ch),bm=r(function(e,t){return L(vm({blockNumber:ma,errors:mr,nodePath:t,pending:mm,ref:1,requests:Ch,tagger:e,watching:mm}),f(vp,f($a,gm,e),pm(t)))}),Cm=n(function(e,t,r){var n=f(fm,e,r),a=f(bm,lm,e.httpProvider),i=a.a,o=a.b;return d(dm,{allowance:ma,chatHistoryModel:ma,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:no,secureCommInfo:em,showChatHistory:!1,showStatsModal:!1,trade:Qy(r),txChainStatus:ma,userInfo:t,web3Context:e},ao(F([n,o])),co,mr)}),Sm=function(e){return{data:ya(f(df,"abort()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Em=function(e){return{data:ya(f(df,"burn()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Tm=function(e){return{data:ya(f(df,"claim()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},wm=r(function(e,t){return{data:ya(f(df,"initiatorStatement(string)",F([Ep(t)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),Im=function(e){return{data:ya(f(df,"recall()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Am=function(e){return{data:ya(f(df,"release()",mr)),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Bm=r(function(e,t){return{data:ya(f(df,"responderStatement(string)",F([Ep(t)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),km=r(function(e,t){return{amount:t,fiatType:e}}),Nm=f(Ro,function(e){var t=fl(e);if("Just"===t.$){var r=t.a;return _o(r)}return $o("Can't convert that to a BigInt")},xo),Rm=l(Af,km,f(Fd,0,xo),f(Fd,1,Nm)),$m={$:"Bank"},xm={$:"Cash"},_m=function(e){switch(e){case"cash":return ya(xm);case"bank":return ya($m);case"custom":return ya(Kl);default:return ma}},Lm=f(Ro,function(e){var t=_m(e);if("Just"===t.$){var r=t.a;return _o(r)}return $o("")},xo),Pm=l(Af,Hl,f(Od,"type",Lm),f(Od,"info",xo)),Dm=ue,Um=function(e){var t=l(Af,Ip,f(Od,"price",Rm),f(Od,"paymentmethods",Dm(Pm)));return f(gh,t,e)},Om=r(function(e,t){return{commPubkey:t,responder:e}}),Mm=r(function(e,t){var n=r(function(t,r){return l(vo,t,t+2*r,e)}),a=f($a,Nd,Eo(yi(2)));return f(eh,function(t){return f(Eo,function(e){return f(n,t+64,e)},Nd(l(vo,t,t+64,e)))},a(t))}),Fm=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))}),Vm=n(function(e,t,r){var n=l(za,Fm(e),P(0,0,t),r);if(n.b)return wi("invalid UTF-8 sequence");var a=n.c;return Ii(a)}),Km=q,Hm=function(e){return Gu(Km(e))},jm=function(e){return l(Vm,r(function(e,t){return O(t,Hm(e))}),"",e)},qm=ho(function(e){var t=e.a,r=e.b;return f(Eo,f(bo,t,r),f(eh,jm,f(eh,f($a,tu(Nd),Ad),f(Eo,Zd(f($a,Ll,Tu)),f(Eo,Ss(2),f(Mm,t,So(r)))))))}),Gm=f(dd,f(Md,1,qm),f(dd,f(Md,0,Dd),_o(Om))),zm=r(function(e,t){return{commPubkey:t,terms:e}}),Ym=f(dd,f(Md,1,qm),f(dd,f(Md,0,qm),_o(zm))),Wm=function(e){return{statement:e}},Jm=f(dd,f(Md,0,qm),_o(Wm)),Qm=function(e){return{statement:e}},Xm=f(dd,f(Md,0,qm),_o(Qm)),Zm={$:"AbortedEvent"},eb={$:"BurnedEvent"},tb={$:"ClaimedEvent"},rb=function(e){return{$:"CommittedEvent",a:e}},nb=function(e){return{$:"InitiatedEvent",a:e}},ab=function(e){return{$:"InitiatorStatementLogEvent",a:e}},ib={$:"PokeEvent"},ob={$:"RecalledEvent"},ub={$:"ReleasedEvent"},sb=function(e){return{$:"ResponderStatementLogEvent",a:e}},cb=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),fb=function(e){return cb(e)?Ii(Ts(Bo(e))):wi("Something in here is not very hexy: "+Ld(e))},lb=Lo(fb),db=f(Od,"topics",f(Fd,0,lb)),hb=function(e){return Ts(f(qi,"",f(tu,f($a,ts,Bs),sf(f(tu,xi,bs(e))))))},pb=f(Ro,function(e){return $(e,hb("Initiated(string,string)"))?f(If,nb,Ym):$(e,hb("Committed(address,string)"))?f(If,rb,Gm):$(e,hb("Recalled()"))?_o(ob):$(e,hb("Claimed()"))?_o(tb):$(e,hb("Aborted()"))?_o(Zm):$(e,hb("Released()"))?_o(ub):$(e,hb("Burned()"))?_o(eb):$(e,hb("InitiatorStatementLog(string)"))?f(If,ab,Jm):$(e,hb("ResponderStatementLog(string)"))?f(If,sb,Xm):$(e,hb("Poke()"))?_o(ib):$o("Unrecognized topic hash")},db),gb={$:"Initiator"},vb={$:"Responder"},yb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ya(gb):f(ng,function(e){return $(t,e)?ya(vb):ma},e.state.responder)}),mb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},bb=function(e){return $(e.buyerDeposit,Yf(e.tradeAmount))&&$(e.abortPunishment,zf(e.tradeAmount))},Cb={$:"Invalid"},Sb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),Eb=function(e){return{$:"LoadedTrade",a:e}},Tb=r(function(e,t){return Ff(Gl(t)+Gl(e))}),wb=function(e){var t=Nl(Tl(e.amount));if("Just"===t.$){return t.a}f(kl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Ib=r(function(e,t){return(t-e)/e}),Ab=r(function(e,t){var r=wb(t),n=Rl(e);return"USD"===t.fiatType?ya(f(Ib,n,r)):ma}),Bb=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 Ff(0)}}();return{margin:f(Ab,e.tradeAmount,r.price),phaseEndTime:f(Tb,t.phaseStartTime,n)}}),kb=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 Eb(g(Sb,e.id,n,a,o,u,s,l(Bb,a,o,u)))}return Jy(e)},Nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{creationInfo:ya(e)}));case"LoadedTrade":f(kl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Cb}}),Rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{parameters:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Cb}}),$b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{phaseStartInfo:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Cb}}),xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{state:ya(e)}));case"LoadedTrade":var n=t.a;return Eb(U(n,{state:e}));default:return Cb}}),_b=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return kb(U(r,{terms:ya(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Cb}}),Lb=c(function(e,t,r,n,a,i,o,u,s){return{abortPunishment:a,autoabortInterval:o,autorecallInterval:i,autoreleaseInterval:u,beneficiaryDeposit:n,initiatedByCustodian:t,initiator:e,pokeReward:s,tradeAmount:r}}),Pb=Po(f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,Io,f(im,Dd,rm(Lb))))))))))),Db=function(e){return{data:ya(f(df,"getParameters()",mr)),decoder:Pb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Ub=function(e){return f(jf,function(e){return Ff(1e3*e)},nl(Tl(e)))},Ob=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return wi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return wi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return wi(a)}var u=n.a;return Ii(l(e,i,o,u))}),Mb=function(e){var t=f(_l,"error converting BigInt to Time.Posix",Ub(e.autoabortInterval)),r=f(_l,"error converting BigInt to Time.Posix",Ub(e.autoreleaseInterval)),a=f(_l,"error converting BigInt to Time.Posix",Ub(e.autorecallInterval));return d(Ob,n(function(t,r,n){return{abortPunishment:Fv(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Fv(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?Of:ry,pokeReward:Fv(e.pokeReward),tradeAmount:Fv(e.tradeAmount)}}),a,t,r)},Fb=n(function(e,t,r){return f(vp,r,f(up,Mb,f(np,e.httpProvider,Db(t))))}),Vb=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}}}}}}}}}}},Kb=Po(f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,f(im,jd,rm(Vb)))))))))))),Hb=function(e){return{data:ya(f(df,"getPhaseStartInfo()",mr)),decoder:Kb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},jb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ma;var i=t.a;if("Nothing"===r.$)return ma;var o=r.a;if("Nothing"===n.$)return ma;var u=n.a;if("Nothing"===a.$)return ma;var s=a.a;return ya(d(e,i,o,u,s))}),qb=function(e){return h(jb,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}}),Ub(e.v6),Ub(e.v7),Ub(e.v8),Ub(e.v9))},Gb=n(function(e,t,r){return f(vp,r,f(up,qb,f(np,e.httpProvider,Hb(t))))}),zb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Yb=Po(f(im,jd,f(im,Dd,f(im,jd,f(im,jd,f(im,jd,rm(zb))))))),Wb=function(e){return{data:ya(f(df,"getState()",mr)),decoder:Yb,from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},Jb={$:"Aborted"},Qb={$:"Burned"},Xb={$:"NotClosed"},Zb={$:"Recalled"},eC={$:"Released"},tC=function(e){switch(f(ec,99,nl(Tl(e)))){case 0:return ya(Xb);case 1:return ya(Zb);case 2:return ya(Jb);case 3:return ya(eC);case 4:return ya(Qb);default:return ma}},rC={$:"Closed"},nC={$:"Committed"},aC={$:"Judgment"},iC=function(e){switch(f(ec,99,nl(Tl(e)))){case 1:return ya(no);case 2:return ya(nC);case 3:return ya(aC);case 4:return ya(rC);default:return ma}},oC=function(e){return $(e,td("0x0000000000000000000000000000000000000000"))?ma:ya(e)},uC=a(function(e,t,r,n){if("Nothing"===t.$)return ma;var a=t.a;if("Nothing"===r.$)return ma;var i=r.a;if("Nothing"===n.$)return ma;var o=n.a;return ya(l(e,a,i,o))}),sC=function(e){var t=Ub(e.phaseStartTimestamp),r=iC(e.phase),a=tC(e.closedReason);return d(uC,n(function(t,r,n){return{balance:Fv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:oC(e.responder)}}),r,t,a)},cC=n(function(e,t,r){return f(vp,r,f(up,sC,f(np,e.httpProvider,Wb(t))))}),fC=i(function(e,t,r,n,a){return ao(F([l(Fb,e,t,r),l(cC,e,t,n),l(Gb,e,t,a)]))}),lC=function(e){var t=zp(e);if("Just"===t.$){return t.a}f(kl,"Warning! BigInt to Int conversion failed!",Tl(e));return 0},dC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),hC=n(function(e,t,r){for(;;){var n=f(ci,32,e),a=n.a,i=n.b;if(_(bi(a),32)<0)return f(Ci,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(qa,ui(a),t),s=r+1;e=o,t=u,r=s}}),pC=function(e){return e.b?l(hC,e,mr,0):oi},gC=rn,vC=function(e){var t=h(gC,dC,f(Od,"encapsulation",xo),f(Od,"iv",xo),f(Od,"tag",xo),f(Od,"encrypted",xo)),r=Dm(t),n=f(Yd,r,e);if("Err"===n.$){var a=n.a;return wi(Qi(a))}var i=n.a;return function(e){var t=L(f(bc,0,e),f(bc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Ii(L(r,n))}return wi("Decoded list has less than 2 items.")}(pC(i))},yC=function(e){var t=function(e){var t=go(e);return t>1114111?wi("string is too long"):Ii(f(qu,Km(t),e))};return f(Eo,qi(""),Ad(f(tu,t,e)))},mC=function(e){var t=e.a,r=e.b;return yC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},bC=r(function(e,t){return Jd(F([L("message",Gd(e)),L("pubkeyHexStrings",f(Wd,Gd,F([t.initiatorPubkey,t.responderPubkey])))]))}),CC=function(e){return{$:"LoadedCommInfo",a:e}},SC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),EC=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 CC(f(SC,r,n))}return Zy(e)},TC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return EC(U(r,{initiatorPubkey:ya(e)}))}var n=t.a;return CC(U(n,{initiatorPubkey:e}))}),wC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return EC(U(r,{responderPubkey:ya(e)}))}var n=t.a;return CC(U(n,{responderPubkey:e}))}),IC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return ry}r.a,r.b;return Of}if("Buyer"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ry}),AC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=xi(r),i=f(al,a,n),o=Qu(f($s,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),BC=function(e){var t=pC(f(AC,bs(e),mr));return l(Yl,Ig,h(jb,dC,f(bc,0,t),f(bc,1,t),f(bc,2,t),f(bc,3,t)),h(jb,dC,f(bc,4,t),f(bc,5,t),f(bc,6,t),f(bc,7,t)))},kC={$:"Aborted"},NC={$:"Burned"},RC={$:"Claimed"},$C=function(e){return{$:"Committed",a:e}},xC=function(e){return{$:"Encrypted",a:e}},_C={$:"FailedDecode"},LC={$:"Initiated"},PC={$:"Recalled"},DC={$:"Released"},UC=function(e){return{$:"StateChange",a:e}},OC=function(e){return{$:"Statement",a:e}},MC=lr,FC=fr,VC=r(function(e,t){var r=bi(e),n=32-bi(t.tail)-r,a=l(MC,32,t.tail,e);return n<0?{nodeList:f(qa,ui(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(FC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(qa,ui(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ii}}),KC=ur,HC=y,jC=a(function(e,t,r,n){var a=gc&t>>>e;if(_(a,bi(n))>-1){if(5===e)return f(KC,ui(r),n);var i=si(d(jC,e-ai,t,r,ii));return f(KC,i,n)}var o=f(vc,a,n);if("SubTree"===o.$){var u=o.a,i=si(d(jC,e-ai,t,r,u));return l(Ec,a,i,n)}var i=si(d(jC,e-ai,t,r,HC(o)));return l(Ec,a,i,n)}),qC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=bi(i),u=bi(e),s=r+(u-o);if($(u,32)){if(_(s>>>ai,1<0){var c=n+ai,f=d(jC,c,r,e,HC(si(a)));return d(ei,s,c,f,ii)}return d(ei,s,n,d(jC,n,r,e,a),ii)}return d(ei,s,n,a,e)}),GC=r(function(e,t){var r=(t.a,t.c,t.d),n=bi(e),a=32-bi(r)-n,i=l(MC,32,r,e),o=f(qC,i,t);if(a<0){var u=l(FC,a,n,e);return f(qC,u,o)}return o}),zC=sr,YC=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(zC,i,t,r)}return f(qa,e,t)});return{nodeList:l(zC,i,mr,n),nodeListSize:t/32|0,tail:a}},WC=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(zC,o,t,r)}var n=e.a;return f(GC,n,t)});return f(GC,i,l(zC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(zC,o,t,r)}var n=e.a;return f(VC,n,t)});return f(Ci,!0,f(VC,i,l(zC,o,YC(e),a)))}),JC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(qa,r,t)}),QC=f(Ja,JC,mr),XC=n(function(e,t,r){var n=IC(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ya(UC(LC));case"CommittedEvent":var r=t.a;return ya(UC($C(r.responder)));case"RecalledEvent":return ya(UC(PC));case"ClaimedEvent":return ya(UC(RC));case"AbortedEvent":return ya(UC(kC));case"ReleasedEvent":return ya(UC(DC));case"BurnedEvent":return ya(UC(NC));case"InitiatorStatementLogEvent":var r=t.a;return ya(OC({blocknum:e,message:function(){var e=BC(r.statement);if("Just"===e.$){var t=e.a;return xC(t)}return _C}(),who:n(gb)}));case"ResponderStatementLogEvent":var r=t.a;return ya(OC({blocknum:e,message:function(){var e=BC(r.statement);if("Just"===e.$){var t=e.a;return xC(t)}return _C}(),who:n(vb)}));default:return ma}}(),i=f(jf,function(t){return{blocknum:e,eventInfo:t,time:ma}},a);return L(U(r,{history:f(WC,r.history,pC(QC(F([i]))))}),function(){return"Just"===a.$&&"Statement"===a.a.$}())}),ZC=zr,eS=function(e){var t=l(Af,Ig,f(Od,"id",ZC),f(Od,"message",xo));return f(ql,Qi,f(Yd,t,e))},tS=function(e){return{$:"Decrypted",a:e}},rS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),nS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(XC,n,a,t),o=i.a,u=i.b;return d(rS,o,u,ma,mr);case"MessageInputChanged":var s=e.a;return d(rS,U(t,{messageInput:s}),!1,ma,mr);case"MessageSubmit":return d(rS,U(t,{messageInput:""}),!1,ya(t.messageInput),mr);default:var c=e.a,h=eS(c);if("Ok"===h.$){var p=h.a,g=p.a,v=p.b,y=f(bc,g,t.history);if("Just"===y.$){var m=y.a,b=m.eventInfo;if("Statement"===b.$){var C=b.a,S=U(C,{message:tS(v)}),E=U(m,{eventInfo:OC(S)}),T=l(wc,g,E,t.history);return d(rS,U(t,{history:T}),!1,ma,mr)}return d(rS,t,!1,ma,F([Sf(f(Qp,"got a decryption result, but for an event that is not a message!",m))]))}return d(rS,t,!1,ma,F([Sf(f(Qp,"got a decryption result, but for an id out of bounds!",L(g,t.history)))]))}var w=h.a;return d(rS,t,!1,ma,F([Sf(f(Qp,"Error decoding decryption result",w))]))}}),aS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),iS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),oS=function(e){return{onBroadcast:ma,onMined:ya(L(aS(e),ma)),onSign:ya(iS(e))}},uS=qe("encryptToPubkeys",to),sS=n(function(e,t,r){return{data:ya(f(df,"commit(address,string)",F([id(t),Ep(r)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),cS=n(function(e,t,r){return{data:ya(f(df,"commit(address,string)",F([id(t),Ep(r)]))),decoder:_o(vr),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}}),fS=function(e){return{$:"CommitMined",a:e}},lS={$:"CommitNeedsSig"},dS=function(e){return{$:"CommitSigned",a:e}},hS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?cS:sS}(),i=mf(function(){return"Token"===e.factoryType.$?to:$p(Hf(mb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ya(lS),f(gf,{onBroadcast:ma,onMined:ya(L(fS,ma)),onSign:ya(dS)},i))}),pS=r(function(e,t){return Jd(F([L("id",yh(e)),L("encapsulation",Gd(t.encapsulatedKey)),L("iv",Gd(t.iv)),L("tag",Gd(t.tag)),L("encrypted",Gd(t.message))]))}),gS=qe("decryptMessage",to),vS=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(qa,L(r,e),n))});return l(Oa,n,L(t-1,mr),e).b},yS=r(function(e,t){return ao(f(tu,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 gS(f(pS,r,s))}return io}return io},vS(e.history)))}),mS=function(e){if("Just"===e.$){return e.a}return ma},bS=function(e){var t=mS(l(Yl,yb,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ya(r)}return ma}(),f(jf,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(yS,n,a)}return io},CS=r(function(e,t){return f(jf,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ry}if("Seller"===r.b.$){r.a,r.b;return ry}r.a,r.b;return Of},f(yb,e,t))}),SS=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(XC,i,o,r),c=s.a,f=s.b,d=u,h=L(c,n||f);e=d,t=h}}),e,L(t,!1))}),ES=o(function(e,t,r,n,a,i){return{history:a,initiatorRole:n,messageInput:i,userInfo:t,userRole:r,web3Context:e}}),TS=i(function(e,t,r,n,a){return f(SS,a,p(ES,e,t,r,n,oi,""))}),wS=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(CS,i,o.address);if("Just"===u.$){var s=u.a;return f(Qo,ya,h(TS,e,o,s,i.parameters.initiatorRole,n))}return L(ma,!1)}return L(ma,!1)}),IS={$:"Abort"},AS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),BS=function(e){return{$:"ActionNeedsSig",a:e}},kS=function(e){return{$:"ApproveMining",a:e}},NS={$:"ApproveNeedsSig"},RS=function(e){return{$:"ApproveSigned",a:e}},$S={$:"Burn"},xS=function(e){return{$:"ChatHistoryMsg",a:e}},_S={$:"Claim"},LS=function(e){return{$:"CommitMining",a:e}},PS=function(e){return{$:"ConfirmingAction",a:e}},DS=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),US=function(e){return{$:"EventLogFetched",a:e}},OS=function(e){return{$:"ParametersFetched",a:e}},MS=function(e){return{$:"PhaseInfoFetched",a:e}},FS={$:"Poke"},VS={$:"Recall"},KS={$:"Release"},HS=function(e){return{$:"StartContractAction",a:e}},jS=function(e){return{$:"StateFetched",a:e}},qS=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"}},GS=function(e){return d(dm,e,io,co,mr)},zS={align:Yp,mainParagraphs:F([F([Jp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Xp},YS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Zp,e,r)}if("Nothing"===t.a.$){t.a;return f(Qp,"Couldn't decode the fetched \""+e+'" result.',ma)}return f(Qp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),WS={align:Yp,mainParagraphs:F([F([Jp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Xp},JS=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),QS=n(function(e,t,r){return l(Dh,e,jf(function(e){return U(e,{logCount:Oi(t)+e.logCount})}),r)}),XS=r(function(e,t){var r=t.a;return ym(f(Ph,e,r))}),ZS=n(function(e,t,r){var n=e.a,a=f(Sh,t,n.requests);if("Nothing"===a.$)return L(vm(n),io);var i=a.a,o=L(i.watchOnce,Xf(r));if("Nothing"===o.b.$){o.b;return L(vm(U(n,{requests:l(QS,t,r,n.requests)})),io)}if(o.a){var u=o.b.a;return L(vm(U(n,{requests:l(QS,t,r,n.requests),watching:f(XS,t,n.watching)})),f(dg,i.tagger,Qh(u)))}return L(vm(U(n,{requests:l(QS,t,r,n.requests)})),ao(f(tu,function(e){return f(dg,i.tagger,Qh(e))},r)))}),eE=_e,tE=r(function(e,t){return f(vp,f($a,gm,t),f(ip,function(t){return pm(e)},eE(2e3)))}),rE=se,nE=fe,aE=n(function(e,t,r){var n=function(e){return nE(F([e,rE(r)]))};return f(Ro,function(a){var i=f(Yd,e,a);if("Ok"===i.$){var o=i.a,u=f(Yd,n(t),o);if("Ok"===u.$){var s=u.a;return _o(s)}var c=u.a;return $o(Qi(c))}return _o(r)},Zi)}),iE=a(function(e,t,r,n){return f(dd,l(aE,f(Od,e,Zi),t,r),n)}),oE=n(function(e,t,r){return f(dd,f(Od,e,t),r)}),uE=Lo(Pd),sE=gd(f(ec,md,yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),cE=function(e){return{$:"BlockHash",a:e}},fE=function(e){return sE(e)?Ii(cE(Bo(e))):wi("Given blockHash "+Ld(e)+" is not valid.")},lE=Lo(fE),dE=function(e){return{$:"TxHash",a:e}},hE=function(e){return sE(e)?Ii(dE(Bo(e))):wi("Given txHash "+Ld(e)+" is not valid.")},pE=Lo(hE),gE=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}}),vE=Yr,yE=l(oE,"blockNumber",hm,l(oE,"blockHash",lE,l(oE,"transactionHash",pE,l(oE,"transactionIndex",hm,l(oE,"logIndex",hm,d(iE,"removed",vE,!1,l(oE,"topics",Dm(lb),l(oE,"data",xo,l(oE,"address",uE,_o(gE)))))))))),mE=function(e){return f(Wd,function(e){if("Just"===e.$){var t=e.a;return Gd(lf(t))}return uh},e)},bE=function(e){return Jd(F([L("fromBlock",nh(e.fromBlock)),L("toBlock",nh(e.toBlock)),L("address",ah(e.address)),L("topics",mE(e.topics))]))},CE=r(function(e,t){return ep({decoder:Dm(yE),method:"eth_getLogs",params:F([bE(t)]),url:e})}),SE=function(e){return{$:"BlockNum",a:e}},EE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(ip,function(r){return f(up,$i(r),f(CE,e,U(t,{fromBlock:SE(n),toBlock:SE(a)})))},f(CE,e,t)):f(CE,e,t)}),TE=n(function(e,t,r){var n=r.a,a=r.b;return f(CE,e,U(t,{fromBlock:SE(n),toBlock:SE(a)}))}),wE=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(wE,e,t,i)),c=o;e=u,t=s,r=c}}),IE=r(function(e,t){return l(wE,Bh,t,e)}),AE=r(function(e,t){var r=e.a,n=t.a;return ym(f(IE,r,n))}),BE=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 ao(f(tu,function(t){return f(vp,f($a,JS(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},QC(f(tu,function(e){return f(Sh,e,r.requests)},ja(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(vm(U(r,{blockNumber:ya(a)})),ao(F([f(tE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,TE)]))):L(t,f(tE,r.nodePath,r.tagger))}return L(vm(U(r,{blockNumber:ya(a),pending:mm,watching:f(AE,r.watching,r.pending)})),ao(F([f(tE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,EE),l(i,L(a,a),r.watching,TE)])))}var s=e.a.a;return L(vm(U(r,{errors:f(qa,s,r.errors)})),f(tE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(ZS,t,c,d)}var s=e.b.a;return L(vm(U(r,{errors:f(qa,s,r.errors)})),io)}),kE=r(function(e,t){var r=t.a;return ym(l(Bh,e,vr,r))}),NE=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=U(a,{ref:a.ref+1,requests:l(Bh,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(vm(U(o,{watching:f(kE,a.ref,o.watching)})),f(vp,f($a,JS(a.ref),a.tagger),e),a.ref)}(l(EE,a.nodePath,n,L(s,s)))}return P(vm(U(o,{pending:f(kE,a.ref,o.pending)})),io,a.ref)}),RE=NE(!1),$E=function(e){return F([e])},xE=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(fm,t.web3Context,r.id):io}return io}()),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(yp,t.web3Context,a,r.address,n.creationInfo.address,_y)}return io}(),a=function(){return"Nothing"===t.chatHistoryModel.$?d(wS,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?bS(t):io,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(dm,u,ao(F([l(cC,t.web3Context,p.creationInfo.address,jS),s,r,n])),co,mr)}return GS(u);case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var v=g.a,u=U(t,{allowance:ya(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(Su,v,Hf(mb(m.parameters))),Da))return GS(u);var C=d(hS,t.web3Context,m,b.address,b.commPubkey),S=C.a,E=C.b;return d(dm,U(u,{txChainStatus:S}),io,E,mr)}return GS(u)}var T=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"allowance",T))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var w=g.a,I={address:w.address_,blocknum:lC(w.blocknum)},A=l(RE,US,t.eventSentry,{address:I.address,fromBlock:SE(I.blocknum),toBlock:rp,topics:mr}),B=A.a,k=A.b,u=U(t,{eventSentry:B,trade:f(Nb,I,t.trade)}),N=ao(F([k,h(fC,u.web3Context,I.address,OS,jS,MS)]));return d(dm,u,N,co,mr)}if("BadBody"===g.a.$){g.a.a;return d(dm,t,io,co,F([Sf(zS)]))}var T=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"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(xb,R,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(f(YS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var _=g.a.a;if(bb(_)){var u=U(t,{trade:f(Rb,_,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(WS)]))}var D=g.a.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error decoding fetched trade parameters",D))]))}var M=g.a;return d(dm,t,io,co,F([Sf(f(Zp,"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($b,V,t.trade)});return d(dm,u,bS(u),co,mr)}return d(dm,t,io,co,F([Sf(f(YS,"trade state",g))]));case"EventLogFetched":var K=e.a,H=f(Qd,pb,K),j=H.returnData;if("Err"===j.$){var q=j.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error decoding contract event",q))]))}var G=j.a,z=function(){switch(G.$){case"InitiatedEvent":var e=G.a;return f(TC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=G.a;return f(wC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),Y=function(){if("InitiatedEvent"===G.$){var e=G.a,r=Um(e.terms);if("Ok"===r.$){var n=r.a;return L(f(_b,n,t.trade),ma)}var a=r.a;return L(t.trade,ya(f(Qp,"Couldn't decode payment methods!",a)))}return L(t.trade,ma)}(),W=Y.a,J=Y.b,Q=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return f(Qo,ya,l(XC,H.blockNumber,G,r))}return d(wS,t.web3Context,W,t.userInfo,t.eventsWaitingForChatHistory)}(),i=Q.a,o=Q.b,X=function(){return"Nothing"===i.$?f(Qa,t.eventsWaitingForChatHistory,F([L(H.blockNumber,G)])):mr}(),u=U(t,{chatHistoryModel:i,eventsWaitingForChatHistory:X,secureCommInfo:z,trade:W}),N=o?bS(u):io;return d(dm,u,N,co,f(tu,Sf,QC(F([J]))));case"ExpandPhase":var Z=e.a;return GS(U(t,{expandedPhase:Z}));case"ToggleChat":var ee=!t.showChatHistory;return GS(U(t,{showChatHistory:ee}));case"ToggleStatsModal":var te=!t.showStatsModal;return GS(U(t,{showStatsModal:te}));case"ViewUserHistory":var re=e.a,ne=t.trade;if("LoadedTrade"===ne.$){var m=ne.a;return d(dm,t,io,co,F([lo(f(vf,m.parameters.initiatorAddress,re))]))}return d(dm,t,io,co,F([Sf(f(Qp,"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 GS(U(t,{txChainStatus:ya(l(DS,m,b,ae))}));case"AbortAction":return GS(U(t,{txChainStatus:ma}));case"ConfirmCommit":var m=e.a,b=e.b,ae=e.c,ie=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return d(hS,t.web3Context,m,b.address,b.commPubkey);var r=e.a,n=function(){var e=mf(l(sd,nd(r),m.creationInfo.address,ae)),t={onBroadcast:ma,onMined:ma,onSign:ya(RS)};return f(gf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Su,i,Hf(mb(m.parameters))),Da)?L(ya(NS),n):d(hS,t.web3Context,m,b.address,b.commPubkey)}return L(ya(NS),n)}(),S=ie.a,E=ie.b;return d(dm,U(t,{txChainStatus:S}),io,E,mr);case"ContractActionClicked":var oe=e.a;if($(oe,FS)||$(oe,VS)){var ue=HS(oe),se=t;e=ue,t=se;continue e}return GS(U(t,{txChainStatus:ya(PS(oe))}));case"StartContractAction":var ce=e.a,fe=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,co,F([Sf(f(Qp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(ce.$){case"Recall":var a=mf(Im(n.creationInfo.address));return P(ya(BS(VS)),f(gf,oS(VS),a),mr);case"Claim":var a=mf(Tm(n.creationInfo.address));return P(ya(BS(_S)),f(gf,oS(_S),a),mr);case"Abort":var a=mf(Sm(n.creationInfo.address));return P(ya(BS(IS)),f(gf,oS(IS),a),mr);case"Release":var a=mf(Am(n.creationInfo.address));return P(ya(BS(KS)),f(gf,oS(KS),a),mr);case"Burn":var a=mf(Em(n.creationInfo.address));return P(ya(BS($S)),f(gf,oS($S),a),mr);default:var a=mf(hf(n.creationInfo.address));return P(ya(BS(FS)),f(gf,oS(FS),a),mr)}}(),S=fe.a,E=fe.b,le=fe.c;return d(dm,U(t,{txChainStatus:S}),io,E,le);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(kS(he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"approve",D))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(LS(he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,"commit",D))]));case"CommitMined":return GS(U(t,{txChainStatus:ma}));case"ActionSigned":var oe=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return GS(U(t,{txChainStatus:ya(f(AS,oe,he))}))}var D=de.a;return d(dm,U(t,{txChainStatus:ma}),io,co,F([Sf(f(rg,qS(oe),D))]));case"ActionMined":var oe=e.a;return GS(U(t,{txChainStatus:ma}));case"EventSentryMsg":var pe=e.a,ge=f(BE,pe,t.eventSentry),ve=ge.a,N=ge.b;return d(dm,U(t,{eventSentry:ve}),N,co,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(nS,ye,be),Se=U(t,{chatHistoryModel:ya(Ce.model)}),s=Ce.shouldCallDecrypt?bS(t):io,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(uS(f(bC,r,a)),ma)}return L(io,ya(f(Qp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(io,ma)}(),Te=Ee.a,we=Ee.b;return d(dm,Se,ao(F([s,Te])),co,O(f(Uf,xS,Ce.appCmds),f(ec,mr,f(jf,$E,f(jf,Sf,we)))))}return d(dm,t,io,co,F([Sf(f(Qp,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(eh,mC,vC(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(yb,p,b.address);if("Nothing"===Ne.$)return d(dm,t,io,co,F([Sf(f(Qp,"Trying to encrypt, but the user is not involved in this trade.",ma))]));var Re=Ne.a,$e=function(){return mf("Initiator"===Re.$?f(wm,p.creationInfo.address,ke):f(Bm,p.creationInfo.address,ke))}();return d(dm,t,io,f(gf,{onBroadcast:ma,onMined:ma,onSign:ma},$e),mr)}var xe=Be.a,_e=Be.b;return d(dm,t,io,co,F([Sf(f(Qp,"Encryption successful, but the user or trade is no longer valid.",L(xe,_e)))]))}var Le=Be.c.a;return d(dm,t,io,co,F([Sf(f(Qp,"Error translating JS encryption result into Elm.",Le))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return GS(t)}var D=e.a.a;return d(dm,t,io,co,F([Sf(f(eg,"message",D))]));default:return d(dm,t,io,co,F([Ef]))}}),_E=function(e){return{$:"EventSentryMsg",a:e}},LE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),PE=function(e){var t=f(bm,_E,e.httpProvider),r=t.a,n=t.b;return L({dataFetchStatus:l(LE,ma,0,0),eventSentry:r,trades:oi,web3Context:e},n)},DE=function(e){return{data:ya(f(df,"numTrades()",mr)),decoder:Po(jd),from:ma,gas:ma,gasPrice:ma,nonce:ma,to:ya(e),value:ma}},UE=r(function(e,t){return f(vp,t,f(np,e.httpProvider,DE(rd(e.factoryType))))}),OE=function(e){return{$:"InitialNumTradesFetched",a:e}},ME=function(e){return f(UE,e.web3Context,OE)},FE=function(e){var t=PE(e),r=t.a,n=t.b;return L(r,ao(F([n,ME(r)])))},VE=r(function(e,t){return{address:e,blocknum:t}}),KE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(NE,!0,e,t,r))}),HE=n(function(e,t,r){var n=function(e){return r(f(Qd,Ym,e).returnData)},a={address:t.address,fromBlock:SE(t.blocknum),toBlock:SE(t.blocknum),topics:F([ya(hb("Initiated(string,string)"))])};return l(KE,n,e,a)}),jE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(qa,a,r)}return r}),qE=r(function(e,t){return l(Ja,jE(e),mr,t)}),GE=function(e){return f(qE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ya(t)}return ma},Ma(e.trades))},zE=function(e){return f(za,r(function(t,r){return e(t)?r+1:r}),0)},YE=function(e){return f(zE,di(Cb),Ma(e.trades))},WE=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:YE(e),loaded:Oi(GE(e))})})},JE=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),QE=r(function(e,t){var r=f(bc,e,t.trades);if("Just"===r.$){var n=(r.a,l(wc,e,Cb,t.trades));return l(JE,WE(U(t,{trades:n})),io,mr)}return l(JE,t,io,F([Sf(f(Qp,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),XE=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Nb,t,a),o=l(wc,e,i,r.trades);return L(WE(U(r,{trades:o})),mr)}return L(r,F([f(Qp,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),ZE=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Rb,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),eT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f($b,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),tT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(xb,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),rT=n(function(e,t,r){var n=f(bc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(_b,t,a),o=l(wc,e,i,r.trades);return l(JE,WE(U(r,{trades:o})),io,mr)}return l(JE,r,io,F([Sf(f(Qp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),nT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),aT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),iT=function(e){return{$:"NumTradesFetchedAgain",a:e}},oT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),uT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),sT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),cT=function(e){return l(JE,e,io,mr)},fT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=lC(n),i=pC(f(tu,Qy,f(Vi,0,a-1))),o=ao(f(tu,function(e){return l(sm,t.web3Context,lu(e),nT(e))},f(Vi,0,a-1)));return l(JE,U(t,{dataFetchStatus:l(LE,ya(a),0,0),trades:i}),o,mr)}var u=r.a;return l(JE,t,io,F([Sf(f(Zp,"Factory numTrades",u))]));case"CheckForNewTrades":return l(JE,t,f(UE,t.web3Context,iT),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=lC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=ao(f(tu,function(e){return l(sm,t.web3Context,lu(e),nT(e))},f(Vi,c,d-1))),g=pC(f(tu,Qy,f(Vi,c,d-1)));return l(JE,U(t,{dataFetchStatus:U(p,{total:ya(d)}),trades:f(WC,t.trades,g)}),o,mr)}return cT(t)}s.b;return l(JE,t,io,F([Sf(f(Qp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(JE,t,io,F([Sf(f(Zp,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(VE,y.address_,lC(y.blocknum)),b=l(HE,t.eventSentry,m,aT(v)),C=b.a,S=b.b,E=ao(F([h(fC,t.web3Context,m.address,oT(v),sT(v),uT(v)),S])),T=l(XE,v,m,t),w=T.a,I=T.b;return l(JE,WE(U(w,{eventSentry:C})),E,f(tu,Sf,I))}var u=r.a;return l(JE,t,io,F([Sf(f(Zp,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(JE,t,io,F([Sf(f(Zp,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(ZE,v,B,t)}var k=r.a.a;return l(JE,t,io,F([Sf(f(Qp,"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(tT,v,N,t)}return l(JE,t,io,F([Sf(f(YS,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(eT,v,R,t)}return l(JE,t,io,F([Sf(f(YS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Um($.terms);if("Ok"===x.$){var P=x.a;return l(rT,v,P,t)}var D=x.a;return f(QE,v,t)}var D=r.a;return l(JE,t,io,F([Sf(f(Qp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(BE,O,t.eventSentry),V=M.a,E=M.b;return l(JE,U(t,{eventSentry:V}),E,mr)}}),lT=function(e){return{$:"AgentHistoryMsg",a:e}},dT=function(e){return{$:"AppCmd",a:e}},hT={$:"BetaLandingPage"},pT={$:"ConnectToWeb3"},gT=function(e){return{$:"MarketplaceMsg",a:e}},vT=function(e){return{$:"TradeCacheMsg",a:e}},yT=r(function(e,t){return f(jn,e,Gd(t))}),mT=function(e){return f(yT,"href",it(e))},bT=qn("rel"),CT=yT("target"),ST=function(e){return{$:"Height",a:e}},ET=ST,TT={$:"Content"},wT=TT,IT=function(e){return{$:"Width",a:e}},AT=IT,BT=function(e){return{$:"Attr",a:e}},kT=function(e){return{$:"NodeName",a:e}},NT=function(e){return{$:"Unkeyed",a:e}},RT={$:"AsEl"},$T=RT,xT=r(function(e,t){return{$:"Field",a:e,b:t}}),_T=f(xT,0,0),LT={$:"NoNearbyChildren"},PT={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"},DT=PT.any+" "+PT.column,UT=PT.any+" "+PT.grid,OT=PT.any+" "+PT.page,MT=PT.any+" "+PT.paragraph,FT=PT.any+" "+PT.row,VT=PT.any+" "+PT.single,KT=function(e){switch(e.$){case"AsRow":return FT;case"AsColumn":return DT;case"AsEl":return VT;case"AsGrid":return UT;case"AsParagraph":return MT;default:return OT}},HT=function(e){return{$:"Keyed",a:e}},jT={$:"NoStyleSheet"},qT=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))}}),GT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(tu,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(tu,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return O(f(tu,function(t){return L(e,t)},n),O(t,f(tu,function(t){return L(e,t)},a)))}}),zT={$:"AsParagraph"},YT=zT,WT=On("div"),JT=On("p"),QT=On("s"),XT=On("u"),ZT=yT("className"),ew=function(e){return Fn(rt(e))},tw=function(e){return On(rt(e))},rw=function(e){return{$:"Flag",a:e}},nw=function(e){return{$:"Second",a:e}},aw=function(e){return e>31?nw(1< .ctr > ."+PT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",iI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Aw(PT.any)+Aw(PT.row)+" > "+Aw(PT.any)+" { flex-basis: auto !important; } "+Aw(PT.any)+Aw(PT.row)+" > "+Aw(PT.any)+Aw(PT.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"+aI,oI=function(e){return{$:"Intermediate",a:e}},uI=r(function(e,t){return oI({closing:t,others:mr,props:mr,selector:e})}),sI=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(qa,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(qa,oI({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(qa,f(sI,f(uI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(qa,f(sI,f(uI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(qa,f(sI,f(uI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(qa,f(sI,f(uI,n.selector,""),v),t.others)})}});return oI(l(Ja,a,n,t))}),cI=O(iI,function(e){var t=function(e){return Sl(f(tu,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),Sl(f(tu,a,t.others)))};return Sl(f(tu,a,l(Ja,r(function(e,t){var r=e.a,n=e.b;return f(qa,f(sI,f(uI,r,""),n),t)}),mr,e)))}(O(tI,nI))),fI=l(tw,"style",mr,F([kw(cI)])),lI=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+'"'}},dI=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}},hI=function(e){if("FontWith"===e.$){var t=e.a;return f(Cd,dI,t.variants)}return!1},pI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),gI=r(function(e,t){return e+" {"+f(qi,"",f(tu,function(e){return e.a+": "+e.b+";"},t))+"}"}),vI=n(function(e,t,r){var n=r.a,a=r.b;return F([f(gI,"."+e+"."+t+", ."+e+" ."+t,n),f(gI,"."+e+"."+t+"> ."+PT.text+", ."+e+" ."+t+" > ."+PT.text,a)])}),yI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f(qi," ",O(l(vI,i,PT.sizeByCapital,a),l(vI,i,PT.fullSize,n)))}),mI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f(qi," ",F([f(gI,"."+r+"."+PT.sizeByCapital+", ."+r+" ."+PT.sizeByCapital,F([L("line-height","1")])),f(gI,"."+r+"."+PT.sizeByCapital+"> ."+PT.text+", ."+r+" ."+PT.sizeByCapital+" > ."+PT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),bI=function(e){if(e.b){var t=e.a,r=e.b;return ya(l(za,vi,t,r))}return ma},CI=function(e){if(e.b){var t=e.a,r=e.b;return ya(l(za,Hs,t,r))}return ma},SI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),EI=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(ec,e.descender,CI(t)),n=f(ec,e.baseline,CI(f(Zd,function(e){return!$(e,r)},t))),a=f(ec,e.capital,bI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(SI,i,a-n,o),full:l(SI,u,a-r,s)}},TI=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",Tw(e.height)),L("vertical-align",Tw(e.vertical)+"em"),L("font-size",Tw(e.size)+"em")]))},wI=function(e){return l(za,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 ya(L(TI(function(e){return e.full}(EI(a))),TI(function(e){return e.capital}(EI(a)))))}return t}return t}),ma,e)},II=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ya("@import url('"+t+"');")}return ma},r=function(e){var r=(e.a,e.b);return f(qi,"\n",f(qE,t,r))},n=f(tu,hi,e),a=function(e){var t=e.a,r=e.b,a=wI(r);if("Nothing"===a.$)return f(qi,"",f(tu,mI(t),n));var i=a.a;return f(qi,"",f(tu,f(yI,t,i),n))};return O(f(qi,"\n",f(tu,r,e)),f(qi,"\n",f(tu,a,e)))},AI=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+'" '+ji(r)}},BI=function(e){if("FontWith"===e.$){var t=e.a;return ya(f(qi,", ",f(tu,AI,t.variants)))}return ma},kI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ya(L(t,r))}return ma},NI=function(e){switch(e.$){case"Untransformed":return ma;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ya("translate3d("+Tw(r)+"px, "+Tw(n)+"px, "+Tw(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("+Tw(o)+"px, "+Tw(u)+"px, "+Tw(s)+"px)",b="scale3d("+Tw(f)+", "+Tw(l)+", "+Tw(d)+")",C="rotate3d("+Tw(p)+", "+Tw(g)+", "+Tw(v)+", "+Tw(y)+"rad)";return ya(m+" "+b+" "+C)}},RI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(za,pI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(za,pI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(za,pI(!1),"",n)+"\n}"}case"Focus":var a=l(za,pI(!1),"",n);return f(qi,"\n",F([r+"-fs:focus {"+a+"\n}","."+PT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+PT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+PT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(za,pI(!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(Sw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(vi,0,f(Hs,1,1-c));return l(a,t,"."+u,F([f(Sw,"opacity",Tw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+ji(h),F([f(Sw,"font-size",ji(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(qi,", ",f(qE,BI,p)),v=F([f(Sw,"font-family",f(qi,", ",f(tu,lI,p))),f(Sw,"font-feature-settings",g),f(Sw,"font-variant",f(Cd,hI,p)?"small-caps":"normal")]);return f(qi," ",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(Sw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Sw,s,ww(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=ji(E)+"px",w=ji(S)+"px",I="."+PT.row,A="."+(PT.wrapped+I),B="."+PT.alignRight,k="."+PT.paragraph,N="."+PT.page,R="."+PT.alignLeft,$=Tw(E/2)+"px",x=Tw(S/2)+"px",_="."+PT.column,y="."+C,P="."+PT.any;return Sl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Sw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Sw,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Sw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Sw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Sw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Sw,"margin-left",w)])),l(a,t,O(y,k),F([f(Sw,"line-height","calc(1em + "+ji(E)+"px)")])),l(a,t,"textarea"+y,F([f(Sw,"line-height","calc(1em + "+ji(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Sw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Sw,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Sw,"content","''"),f(Sw,"display","block"),f(Sw,"height","0"),f(Sw,"width","0"),f(Sw,"margin-top",ji(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Sw,"content","''"),f(Sw,"display","block"),f(Sw,"height","0"),f(Sw,"width","0"),f(Sw,"margin-bottom",ji(-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(Sw,"padding",ji(D)+"px "+ji(B)+"px "+ji(U)+"px "+ji(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(Sw,"border-width",ji(D)+"px "+ji(B)+"px "+ji(U)+"px "+ji(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 ji(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, "+ji(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+ji(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+ji(o)+"px, "+ji(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 ji(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+ji(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+ji(o)+"px, "+ji(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+ji(o)+"px, "+ji(i)+"px)";case"Min":var c=r.a,f=r.b,l=ya(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ya(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ma,ma,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(qi," ",f(tu,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(qi,H,f(tu,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(qi,H,f(tu,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(qi," ",f(tu,K,M.columns))),y=".grid-rows-"+f(qi,"-",f(tu,vw,M.rows))+"-cols-"+f(qi,"-",f(tu,vw,M.columns))+"-space-x-"+vw(M.spacing.a)+"-space-y-"+vw(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(qi," ",F(["-ms-grid-row: "+ji(Z.row)+";","-ms-grid-row-span: "+ji(Z.height)+";","-ms-grid-column: "+ji(Z.col)+";","-ms-grid-column-span: "+ji(Z.width)+";"])),te=f(qi," ",F(["grid-row: "+ji(Z.row)+" / "+ji(Z.row+Z.height)+";","grid-column: "+ji(Z.col)+" / "+ji(Z.col+Z.width)+";"])),y=".grid-pos-"+ji(Z.row)+"-"+ji(Z.col)+"-"+ji(Z.width)+"-"+ji(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(qi," ",f(tu,function(e){return f(i,e,ya(y))},re));default:var ne=e.a,m=NI(ne),y=mw(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(Sw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,ma)),topLevel:function(){var r=kI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(qa,n,t.topLevel)}()}}),u=l(za,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(II(s),c)}),$I=r(function(e,t){return l(tw,"style",mr,F([kw(f(RI,e,t))]))}),xI=a(function(e,t,r,n){return e?f(qa,L("static-stylesheet",fI),f(qa,L("dynamic-stylesheet",f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b)),n)):f(qa,L("dynamic-stylesheet",f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b)),n)}),_I=a(function(e,t,r,n){return e?f(qa,fI,f(qa,f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b),n)):f(qa,f($I,t,l(za,Cw,L(mm,F([Bw(t.focus)])),r).b),n)}),LI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(ew,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(xI,!1,e,t,r);default:var e=i.a,t=i.b;return d(xI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return WT;case"p":return JT;default:return tw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(_I,!1,e,t,n);default:var e=i.a,t=i.b;return d(_I,!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(tw,e,n,F([f(u,r,F([ZT(PT.any+" "+PT.single)]))]))}}();switch(o.$){case"AsRow":return f(lw,hw,e)&&!f(lw,dw,e)?s:f(lw,ow,e)?f(XT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.contentCenterY,PT.alignContainerRight])))]),F([s])):f(lw,uw,e)?f(QT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.contentCenterY,PT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(lw,fw,e)&&!f(lw,cw,e)?s:f(lw,sw,e)?f(QT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.alignContainerCenterY])))]),F([s])):f(lw,iw,e)?f(XT,F([ZT(f(qi," ",F([PT.any,PT.single,PT.container,PT.alignContainerBottom])))]),F([s])):s;default:return s}}),PI=kw,DI=function(e){return f(WT,F([ZT(f(qi," ",F([PT.any,PT.text,PT.widthContent,PT.heightContent])))]),F([PI(e)]))},UI=function(e){return l(tw,"div",F([ZT(f(qi," ",F([PT.any,PT.text,PT.widthFill,PT.heightFill])))]),F([kw(e)]))},OI=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,YT),L(f(qa,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,YT),L(f(qa,L(n,f(s.html,jT,e)),i),jo(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(qa,L(n,$(e,$T)?UI(c):DI(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,YT),L(f(qa,i(e),n),a);case"Styled":var o=t.a;return $(e,YT),L(f(qa,f(o.html,jT,e),n),jo(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(qa,$(e,$T)?UI(u):DI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(Ja,a,L(mr,mr),o),s=u.a,c=u.b,p=jo(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return Rf({html:d(LI,n.has,n.node,n.attributes,HT(l(GT,"nearby-element-pls",s,n.children))),styles:g})}return xf(h(LI,n.has,n.node,n.attributes,HT(l(GT,"nearby-element-pls",s,n.children)),jT))}var v=t.a,y=l(Ja,i,L(mr,mr),v),m=y.a,c=y.b,p=jo(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return Rf({html:d(LI,n.has,n.node,n.attributes,NT(f(qT,m,n.children))),styles:g})}return xf(h(LI,n.has,n.node,n.attributes,NT(f(qT,m,n.children)),jT))}),MI=r(function(e,t){return f(qn,nt(e),ot(t))}),FI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(xT,a|r,n)}var i=e.a;return f(xT,r,i|n)}),VI=aw(7),KI=aw(36),HI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(xT,r|a,n|i)}),jI=aw(6),qI=aw(38),GI=aw(30),zI=aw(29),YI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),WI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),JI=function(e){return{$:"Transform",a:e}},QI=function(e){return{$:"ChildrenBehind",a:e}},XI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),ZI=function(e){return{$:"ChildrenInFront",a:e}},eA=r(function(e,t){return f(WT,F([ZT(function(){switch(e.$){case"Above":return f(qi," ",F([PT.nearby,PT.single,PT.above]));case"Below":return f(qi," ",F([PT.nearby,PT.single,PT.below]));case"OnRight":return f(qi," ",F([PT.nearby,PT.single,PT.onRight]));case"OnLeft":return f(qi," ",F([PT.nearby,PT.single,PT.onLeft]));case"InFront":return f(qi," ",F([PT.nearby,PT.single,PT.inFront]));default:return f(qi," ",F([PT.nearby,PT.single,PT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return kw("");case"Text":var e=t.a;return DI(e);case"Unstyled":return(0,t.a)($T);default:return f(t.a.html,jT,$T)}}()]))}),tA=n(function(e,t,r){var n=f(eA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?QI(F([n])):ZI(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?QI(f(qa,n,a)):f(XI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(XI,F([n]),i):ZI(f(qa,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(XI,f(qa,n,a),i):f(XI,a,f(qa,n,i))}}),rA=r(function(e,t){switch(t.$){case"Generic":return kT(e);case"NodeName":var r=t.a;return f(YI,r,e);default:var n=t.a,a=t.b;return f(YI,n,a)}}),nA=function(e){switch(e.$){case"Left":return PT.alignedHorizontally+" "+PT.alignLeft;case"Right":return PT.alignedHorizontally+" "+PT.alignRight;default:return PT.alignedHorizontally+" "+PT.alignCenterX}},aA=function(e){switch(e.$){case"Top":return PT.alignedVertically+" "+PT.alignTop;case"Bottom":return PT.alignedVertically+" "+PT.alignBottom;default:return PT.alignedVertically+" "+PT.alignCenterY}},iA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),oA=function(e){return{$:"Moved",a:e}},uA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return oA(P(r,0,0));case"MoveY":var n=t.a;return oA(P(0,n,0));case"MoveZ":var a=t.a;return oA(P(0,0,a));case"MoveXYZ":var i=t.a;return oA(i);case"Rotate":var i=t.a,o=t.b;return d(iA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(iA,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 oA(P(s,n,a));case"MoveY":var c=t.a;return oA(P(r,c,a));case"MoveZ":var f=t.a;return oA(P(r,n,f));case"MoveXYZ":var i=t.a;return oA(i);case"Rotate":var i=t.a,o=t.b;return d(iA,u,P(1,1,1),i,o);default:var l=t.a;return d(iA,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(iA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(iA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(iA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(iA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(iA,u,h,v,y);default:var m=t.a;return d(iA,u,m,p,o)}}}),sA=function(e){switch(e.$){case"Px":var t=e.a,r=ji(t),n="height-px-"+r;return P(_T,n,F([l(WI,n,"height",r+"px")]));case"Content":return P(f(FI,KI,_T),PT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(FI,fw,_T),PT.heightFill,mr):P(f(FI,fw,_T),PT.heightFillPortion+" height-fill-"+ji(a),F([l(WI,PT.any+"."+PT.row+" > "+Aw("height-fill-"+ji(a)),"flex-grow",ji(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+ji(i),s=l(WI,u,"min-height",ji(i)+"px"),c=sA(o),d=c.a,h=c.b,p=c.c;return P(f(FI,cw,d),u+" "+h,f(qa,s,p));default:var g=e.a,o=e.b,u="max-height-"+ji(g),s=l(WI,u,"max-height",ji(g)+"px"),v=sA(o),d=v.a,h=v.b,p=v.c;return P(f(FI,cw,d),u+" "+h,f(qa,s,p))}},cA=function(e){switch(e.$){case"Px":var t=e.a;return P(_T,PT.widthExact+" width-px-"+ji(t),F([l(WI,"width-px-"+ji(t),"width",ji(t)+"px")]));case"Content":return P(f(FI,qI,_T),PT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(FI,hw,_T),PT.widthFill,mr):P(f(FI,hw,_T),PT.widthFillPortion+" width-fill-"+ji(r),F([l(WI,PT.any+"."+PT.row+" > "+Aw("width-fill-"+ji(r)),"flex-grow",ji(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+ji(n),o=l(WI,i,"min-width",ji(n)+"px"),u=cA(a),s=u.a,c=u.b,d=u.c;return P(f(FI,dw,s),i+" "+c,f(qa,o,d));default:var h=e.a,a=e.b,i="max-width-"+ji(h),o=l(WI,i,"max-width",ji(h)+"px"),p=cA(a),s=p.a,c=p.b,d=p.c;return P(f(FI,dw,s),i+" "+c,f(qa,o,d))}},fA=aw(27),lA=r(function(e,t){if($(e,fA)){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}}),dA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=mw(n);if("Nothing"===s.$)return{attributes:f(qa,ZT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(qa,ZT(e+" "+c),i),children:o,has:r,node:t,styles:f(qa,JI(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(lw,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(FI,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(qa,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(lw,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(lA,E,I)){var p=bw(I)+" "+e,g=t,v=f(FI,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=bw(I)+" "+e,g=t,v=f(FI,E,r),y=n,m=f(qa,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(FI,E,r),y=f(uA,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(lw,jI,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=PT.widthExact+" width-px-"+ji(k)+" "+e,g=t,v=f(FI,jI,r),y=n,m=f(qa,l(WI,"width-px-"+ji(k),"width",ji(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+" "+PT.widthContent,g=t,v=f(FI,qI,f(FI,jI,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+" "+PT.widthFill,g=t,v=f(FI,hw,f(FI,jI,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+" "+PT.widthFillPortion+" width-fill-"+ji(N),g=t,v=f(FI,hw,f(FI,jI,r)),y=n,m=f(qa,l(WI,PT.any+"."+PT.row+" > "+Aw("width-fill-"+ji(N)),"flex-grow",ji(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=cA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(HI,$,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(lw,VI,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=ji(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(FI,VI,r),y=n,m=f(qa,l(WI,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=PT.heightContent+" "+e,g=t,v=f(FI,KI,f(FI,VI,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=PT.heightFill+" "+e,g=t,v=f(FI,fw,f(FI,VI,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+" "+PT.heightFillPortion+" height-fill-"+ji(N),g=t,v=f(FI,fw,f(FI,VI,r)),y=n,m=f(qa,l(WI,PT.any+"."+PT.column+" > "+Aw("height-fill-"+ji(N)),"flex-grow",ji(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=sA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(HI,$,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(rA,"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(rA,"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(rA,"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(rA,"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(rA,"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(rA,"h"+ji(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(rA,"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 kT("p");case"NodeName":var e=t.a;return kT(e);default:var r=t.a,n=t.b;return f(YI,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(qa,f(MI,"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(qa,f(MI,"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(qa,f(MI,"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(qa,f(MI,"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(tA,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(lw,GI,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=nA(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(FI,uw,e);case"Right":return f(FI,ow,e);default:return e}}(f(FI,GI,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(lw,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(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(FI,sw,e);case"Bottom":return f(FI,iw,e);default:return e}}(f(FI,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}}}),hA={$:"Untransformed"},pA=hA,gA=a(function(e,t,r,n){return l(OI,e,n,v(dA,KT(e),t,_T,pA,mr,mr,LT,Ya(r)))}),vA=function(e){return BT(ZT(e))},yA=r(function(e,t){var r=t.url,n=t.label;return d(gA,$T,kT("a"),f(qa,BT(mT(r)),f(qa,BT(bT("noopener noreferrer")),f(qa,BT(CT("_blank")),f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY),e)))))),NT(F([n])))}),mA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),bA=n(function(e,t,r){return d(mA,e,t,r,1)}),CA=aw(14),SA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),EA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),TA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return yw(t)+"-"+yw(r)+"-"+yw(n)+"-"+yw(a)},wA=function(e){return f(EA,CA,l(SA,"fc-"+TA(e),"color",e))},IA={align:Yp,mainParagraphs:F([F([Jp("You need a web3 provider (such as "),f(yA,F([wA(l(bA,0,0,1))]),{label:Jp("Metamask"),url:"https://metamask.io/"}),Jp(") to Connect.")]),F([Jp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:tg},AA={align:Yp,mainParagraphs:F([F([Jp("I don't understand that URL...")]),F([Jp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Xp},BA={align:Yp,mainParagraphs:F([F([Jp("Your wallet is set to an incorrect network.")]),F([Jp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Xp},kA=Lo(f($a,ff,f($a,Hd,_l("Error decoding hex to BigInt")))),NA=function(){return Lo(function(e){switch(e){case"0x0":return Ii(!1);case"0x1":return Ii(!0);default:return wi("Error decoding "+e+"as bool.")}})}(),RA=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}}}}}}}}}}}},$A=function(e){return nE(F([f(If,ya,e),_o(ma)]))},xA=f(dd,$A(f(Od,"status",NA)),f(dd,$A(f(Od,"root",xo)),l(oE,"logsBloom",xo,l(oE,"logs",Dm(yE),f(dd,$A(f(Od,"contractAddress",uE)),l(oE,"cumulativeGasUsed",kA,l(oE,"gasUsed",kA,l(oE,"blockNumber",hm,l(oE,"blockHash",lE,l(oE,"transactionIndex",hm,l(oE,"transactionHash",pE,_o(RA)))))))))))),_A=function(e){var t=e.a;return ff(t)},LA=f($a,_A,Gd),PA=r(function(e,t){return ep({decoder:xA,method:"eth_getTransactionReceipt",params:F([LA(t)]),url:e})}),DA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),UA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),OA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),MA=r(function(e,t){return f(jf,function(e){return e.toMsg},f(ng,function(e){return e.b},f(ng,function(e){return e.onMinedTagger},f(Sh,t,e))))}),FA=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}}}}}}}}}}}},VA=function(e){return nE(F([rE(ma),f(If,ya,e)]))},KA=l(oE,"input",xo,l(oE,"gas",hm,l(oE,"gasPrice",kA,l(oE,"value",kA,l(oE,"to",VA(uE),l(oE,"from",uE,l(oE,"transactionIndex",hm,l(oE,"blockNumber",VA(hm),l(oE,"blockHash",function(e){return f(Ro,function(t){return"0x"===t||"0x0"===t?_o(ma):f(Hi,function(e){return $(e,D("0"))},Bo(t))?_o(ma):f(If,ya,e)},xo)}(lE),l(oE,"nonce",hm,l(oE,"hash",pE,_o(FA)))))))))))),HA=r(function(e,t){return ep({decoder:KA,method:"eth_getTransactionByHash",params:F([LA(t)]),url:e})}),jA=r(function(e,t){return{attempts:e,sleep:t}}),qA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(gp,function(e){return a>0?f(ip,function(e){return f(qA,f(jA,a,n),t)},eE(1e3*n)):Jh(e)},t)}),GA=r(function(e,t){return f(ip,function(r){return f(qA,{attempts:30,sleep:1},f(HA,e,t))},eE(250))}),zA=r(function(e,t){return f(qA,{attempts:60,sleep:5},f(PA,e,t))}),YA=function(e){return{$:"Mined",a:e}},WA=function(e){return jf(function(t){return U(t,{status:YA(e)})})},JA=function(e){return{$:"Sent",a:e}},QA=function(e){return jf(function(t){return U(t,{status:JA(e)})})},XA=function(e){return{$:"Signed",a:e}},ZA=function(e){return jf(function(t){return U(t,{status:XA(e)})})},eB=function(e){return"Nothing"!==e.$},tB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L($g(r),io);case"TxSigned":var n=e.a,a=e.b,i=f(Sh,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(dg,t,Qh(a))}return io}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return io;if("Just"===t.b.$){var r=t.b.a;return f(dg,r,Qh(wi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(dg,a,Qh(wi(e)))}t.a,t.b,t.c;return io};if("Ok"===a.$){var c=a.a,d=eB(o.onBroadcastTagger)||eB(o.onMinedTagger)?f(Pg,r.tagger,f(vp,OA(n),f(GA,r.nodePath,c))):io;return L($g(U(r,{txs:l(Dh,n,ZA(c),r.txs)})),ao(F([u,d])))}var h=a.a;return L($g(r),ao(F([u,s(h)])))}return L($g(r),io);case"TxSent":var n=e.a,p=e.b,g=f(Sh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pg,r.tagger,f(vp,UA(n),f(zA,r.nodePath,v.hash))):io}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(dg,t,Qh(Ii(v)))}return io}();return L($g(U(r,{txs:l(Dh,n,QA(v),r.txs)})),ao(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(dg,t,Qh(wi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(dg,n,Qh(wi("Error with TxSent stuff")))}e.a,e.b;return io}();return L($g(r),s)}return L($g(r),io);case"TxMined":var n=e.a,m=e.b,b=f(Sh,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(dg,a,Qh(Ii(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 ao(F([f(Pg,r.tagger,f(vp,f(DA,n,s),pm(r.nodePath))),f(dg,a,Qh(Ii(C))),f(dg,u.toMsg,Qh(s))]))}return io}();return L($g(U(r,{txs:l(Dh,n,WA(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(dg,r,Qh(wi("TxReceipt decoding failure")))}return io}();return L($g(r),E)}return L($g(r),io);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(MA,r.txs,n);if("Just"===A.$){var B=A.a;return L($g(r),f(dg,B,f(gp,function(e){return Qh(U(I,{doneWatching:!0,reOrg:!0}))},f(ip,function(e){return Qh(U(I,{doneWatching:!0}))},f(PA,r.nodePath,T.txHash)))))}return L($g(r),io)}if($(w,T.lastCheckedBlock))return L($g(r),f(Pg,r.tagger,f(vp,f(DA,n,T),f(ip,function(e){return pm(r.nodePath)},eE(2e3)))));var k=f(MA,r.txs,n);if("Just"===k.$){var B=k.a;return L($g(r),ao(F([f(Pg,r.tagger,f(vp,f(DA,n,I),f(ip,function(e){return pm(r.nodePath)},eE(2e3)))),f(dg,B,Qh(I))])))}return L($g(r),io)}var n=e.a,h=e.c.a;return L($g(r),io);default:var h=e.a;return L($g(r),io)}}),rB=Qt,nB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+ji(r)}),aB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),iB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(aB,"#",e.fragment,l(aB,"?",e.query,O(f(nB,e.port_,O(t,e.host)),e.path)))},oB=r(function(e,t){if(e<0)return t;var r=Bd(f(al,e,t)),n=f($s,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(Qa,n,a)}),uB=r(function(e,t){Gv(t);switch(t.$){case"Home":return L(U(e,{submodel:hT}),io);case"Create":var r=f(Zl,e.web3Context,e.userInfo),n=f(Og,e.txSentry,f(Fg,Uy,r.chainCmd)),a=n.a,i=n.b;return f(cB,f(Uf,Uy,r.appCmds),L(U(e,{submodel:Dy(r.model),txSentry:a}),ao(F([f(Pg,Uy,r.cmd),i]))));case"QuickCreate":var r=f(Tv,e.web3Context,e.userInfo),o=f(Og,e.txSentry,f(Fg,Fy,r.chainCmd)),a=o.a,i=o.b;return f(cB,f(Uf,Fy,r.appCmds),L(U(e,{submodel:My(r.model),txSentry:a}),ao(F([f(Pg,Fy,r.cmd),i]))));case"Trade":var u=t.a,r=l(Cm,e.web3Context,e.userInfo,u),s=f(Og,e.txSentry,f(Fg,Ky,r.chainCmd)),a=s.a,i=s.b;return f(cB,f(Uf,Ky,r.appCmds),L(U(e,{submodel:Vy(r.model),txSentry:a}),ao(F([f(Pg,Ky,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(av,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:Oy(p)}),ao(F([f(Pg,gT,g)])));case"AgentHistory":var v=t.a,y=t.b,m=d(oo,e.web3Context,v,y,e.userInfo),b=m.a,C=m.b;return L(U(e,{submodel:Py(b)}),ao(F([f(Pg,lT,C)])));default:return L(f(Xa,AA,e),io)}}),sB=r(function(e,t){var r=t.a,n=t.b,a=f(fB,dT(e),r),i=a.a,o=a.b;return L(i,ao(F([n,o])))}),cB=r(function(e,t){var r=t.a,n=t.b;return l(za,sB,L(r,n),e)}),fB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(fB,pT,t);case"GotoRoute":var n=r.a;return L(t,f(Ty,t.key,n));case"GTag":var a=r.a;return L(t,By(Iy(a)));default:var i=r.a;return L(f(Xa,i,t),io)}case"DismissNotice":var o=e.a;return L(U(t,{userNotices:f(oB,o,t.userNotices)}),io);case"LinkClicked":var u=e.a,s=function(){if("Internal"===u.$){var e=u.a;return f(Ey,t.key,iB(e))}var r=u.a;return rB(r)}();return L(t,s);case"UrlChanged":var c=e.a;return f(lB,c,t);case"GotoRoute":var d=e.a;return L(t,f(Ty,t.key,d));case"Tick":var h=e.a;return L(U(t,{time:h}),io);case"NetworkUpdate":var p=e.a,g=f(Eo,Ra,f(Yd,ZC,p)),v=f(ng,ba,Wl(g)),y=L(g,v);if("Ok"===y.a.$){if("Just"===y.b.$){var m=y.a.a,b=y.b.a;if($(m,Vg(t.web3Context.factoryType)))return L(t,io);var C=La(b),S=FE(C),E=S.a,T=S.b,w=f(Yy,C,t.submodel),I=w.a,A=w.b,B=w.c;return L(U(t,{submodel:I,tradeCache:E,web3Context:C}),ao(F([f(Pg,vT,T),function(){if("Just"===B.$){var e=B.a;return f(Ty,t.key,e)}return A}()])))}y.b;return L(f(Xa,BA,t),io)}var k=y.a.a;return L(l(va,Xa,f(Qp,"Can't decode networkID from Javascript",k),t),io);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(Xa,IA,t),io):L(t,wy(vr));case"WalletStatus":var N=e.a,R=function(){var e=N.account;if("Nothing"===e.$)return io;var t=e.a;return ky(f(Ay,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(Yd,xo,x);if("Ok"===_.$){var P=_.a,D=t.userAddress;if("Just"===D.$){var O=D.a,M=ya({address:O,commPubkey:P}),V=f(Hy,M,t.submodel),I=V.a,s=V.b;return L(U(t,{submodel:I,userInfo:M}),s)}return L(f(Xa,f(Qp,"User pubkey set, but I can no longer find the user address!",ma),t),io)}var K=_.a;return L(l(va,Xa,f(Qp,"error decoding commPubkey from JS",K),t),io);case"CreateMsg":var H=e.a,j=t.submodel;if("CreateModel"===j.$){var q=j.a,G=f(Ng,H,q),z=f(Og,t.txSentry,f(Fg,Uy,G.chainCmd)),Y=z.a,W=z.b;return f(cB,f(Uf,Uy,G.appCmds),L(U(t,{submodel:Dy(G.model),txSentry:Y}),ao(F([f(Pg,Uy,G.cmd),W]))))}return L(t,io);case"QuickCreateMsg":var J=e.a,Q=t.submodel;if("QuickCreateModel"===Q.$){var X=Q.a,G=f(Vv,J,X),Z=f(Og,t.txSentry,f(Fg,Fy,G.chainCmd)),Y=Z.a,W=Z.b;return f(cB,f(Uf,Fy,G.appCmds),L(U(t,{submodel:My(G.model),txSentry:Y}),ao(F([f(Pg,Fy,G.cmd),W]))))}return L(t,io);case"TradeMsg":var ee=e.a,te=t.submodel;if("TradeModel"===te.$){var re=te.a,G=f(xE,ee,re),ne=f(Og,t.txSentry,f(Fg,Ky,G.chainCmd)),Y=ne.a,W=ne.b;return f(cB,f(Uf,Ky,G.appCmds),L(U(t,{submodel:Vy(G.model),txSentry:Y}),ao(F([f(Pg,Ky,G.cmd),W]))))}return L(t,io);case"MarketplaceMsg":var ae=e.a,ie=t.submodel;if("MarketplaceModel"===ie.$){var oe=ie.a,G=f(yv,ae,oe);return f(cB,f(Uf,gT,G.appCmds),L(U(t,{submodel:Oy(G.model)}),f(Pg,gT,G.cmd)))}return L(t,io);case"AgentHistoryMsg":var ue=e.a,se=t.submodel;if("AgentHistoryModel"===se.$){var ce=se.a,G=f(bf,ue,ce),fe=f(Og,t.txSentry,f(Fg,lT,G.chainCmd)),Y=fe.a,W=fe.b;return f(cB,f(Uf,lT,G.appCmds),L(U(t,{submodel:Py(G.model),txSentry:Y}),ao(F([f(Pg,lT,G.cmd),W]))))}return L(t,io);case"TxSentryMsg":var le=e.a,de=f(tB,le,t.txSentry),I=de.a,he=de.b;return L(U(t,{txSentry:I}),he);case"TradeCacheMsg":var pe=e.a,G=f(fT,pe,t.tradeCache);return L(U(t,{tradeCache:G.tradeCache}),f(Pg,vT,G.cmd));case"NoOp":return L(t,io);default:var K=e.a;f(kl,"test",K);return L(t,io)}}),lB=r(function(e,t){return f(uB,t,Sy(e))}),dB={$:"AllGood"},hB={$:"NoWeb3"},pB=function(e){return{$:"TxSentryMsg",a:e}},gB={$:"WrongNetwork"},vB={align:Yp,mainParagraphs:F([F([Jp("No web3 provider detected. Is "),f(yA,F([wA(l(bA,0,0,1))]),{label:Jp("Metamask"),url:"https://metamask.io/"}),Jp(" or some other web3 provider installed and unlocked?")])]),noticeType:tg},yB={$:"TopLeft"},mB={align:yB,mainParagraphs:F([F([Jp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:tg},bB=n(function(e,t,r){var n=e.a,a=e.b;return $g({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Ch})}),CB=n(function(e,t,r){var n=e.width<1024?ya(mB):ma,a=function(){if(e.networkId){var t=xa(e.networkId);if("Nothing"===t.$)return L(la(da),gB);return L(t.a,dB)}return L(la(da),hB)}(),i=a.a,o=a.b,u=La(i),s=FE(u),c=s.a,d=s.b,h=l(bB,L(ro,eo),pB,u.httpProvider),p=function(){switch(o.$){case"NoWeb3":return ya(vB);case"WrongNetwork":return ya(BA);default:return ma}}(),g=QC(F([n,p])),v=f(lB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:hT,time:Ff(0),tradeCache:c,txSentry:h,userAddress:ma,userInfo:ma,userNotices:mr,web3Context:u}),y=v.a,m=v.b;return L(f(Za,g,y),ao(F([f(Pg,vT,d),m])))}),SB=ze("networkSentryPort",Zi),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=Qh(f(BB,Ch,Ch)),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(wE,s,L(Ka(i),u),o),f=c.a,h=c.b;return l(za,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(Sh,r,t);if("Nothing"===a.$)return l(Bh,r,F([n]),t);var i=a.a;return l(Bh,r,f(qa,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(Mh,e,n)));return f(ip,function(t){return l(PB,e,a,l(Bh,n,t,r))},i)}return Qh(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(ip,function(e){return i},RB(t)))}),u=l(za,$B,Ch,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(qa,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(Bh,e,r,i),o)}),d=p(NB,s,c,o,u,i,P(mr,Ch,Qh(vr))),h=d.a,g=d.b,v=d.c;return f(ip,function(e){return Qh(f(BB,u,e))},f(ip,function(t){return l(PB,e,h,g)},v))}),UB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Ff),OB=n(function(e,t,r){var n=f(Sh,t,r.taggers);if("Nothing"===n.$)return Qh(r);var a=n.a,i=function(t){return cp(f(tu,function(r){return f(Oh,e,r(t))},a))};return f(ip,function(e){return Qh(r)},f(ip,i,UB))}),MB=r(function(e,t){var r=t.a,n=t.b;return f(AB,r,f(wf,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",Zi),YB=ze("encryptionFinished",Zi),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 xS(GB(e))})]))},XB=mn,ZB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return TB;case"CreateModel":t.a;return f(XB,Uy,KB());case"QuickCreateModel":t.a;return f(XB,Fy,qB());case"TradeModel":t.a;return f(XB,Ky,QB());case"MarketplaceModel":t.a;return f(XB,gT,HB());default:t.a;return f(XB,lT,wB())}},ek=ze("userPubkeyResult",Zi),tk=ze("walletSentryPort",Zi),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(Qp,"Error decoding JS walletSentry: "+e,ma)},ck=function(e){return{$:"ErrorDecoding",a:e}},fk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),lk=l(Af,r(function(e,t){return{ref:e,txHash:t}}),f(Od,"ref",ZC),f(Od,"txHash",$A(pE))),dk=function(e){var t=f(Yd,lk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(fk,r.ref,Ii(a))}return f(fk,r.ref,wi("Problem signing/broadcasting Tx. Ref #"+ji(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(If,Ra,ZC),gk=Lo(f($a,nl,f($a,_l("Failure decoding stringy int"),Eo(Ra)))),vk=nE(F([gk,pk])),yk=r(function(e,t){return{account:e,networkId:t}}),mk=l(Af,yk,f(Od,"account",$A(uE)),f(Od,"networkId",vk)),bk=n(function(e,t,r){var n=f(Yd,mk,r);if("Err"===n.$){var a=n.a;return e(Qi(a))}return t(n.a)}),Ck=function(e){var t=f($a,sk,f($a,Sf,dT));return EB(O(F([f(VB,1e3,ik),tk(f(bk,t,uk)),hk(e.txSentry),ek(ok),f(XB,vT,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(mA,e/255,t/255,r/255,1)}),wk=l(Tk,10,33,108),Ik={$:"Generic"},Ak=Ik,Bk=r(function(e,t){return d(gA,$T,Ak,f(qa,AT(wT),f(qa,ET(wT),e)),NT(F([t])))}),kk=function(e){return{$:"Fill",a:e}},Nk=kk(1),Rk=Nf,$k=function(e){return{$:"Px",a:e}},xk=$k,_k=aw(8),Lk=function(e){return f(EA,_k,l(SA,"bg-"+TA(e),"background-color",e))},Pk=f(Bk,F([AT(Nk),ET(xk(150)),Lk(wk)]),Rk),Dk=function(e){return{$:"GotoRoute",a:e}},Uk={$:"Active"},Ok={$:"Important"},Mk={$:"Normal"},Fk=l(bA,1,1,1),Vk=aw(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(EA,Vk,h(Kk,"p-"+ji(e),e,e,e,e)):f(EA,Vk,h(Kk,"p-"+ji(e)+"-"+ji(t),t,e,t,e))}),jk=aw(21),qk=r(function(e,t){return{$:"Class",a:e,b:t}}),Gk=f(qk,jk,PT.cursorPointer),zk=aw(17),Yk=function(e){return f(EA,zk,l(WI,"br-"+ji(e),"border-radius",ji(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",_o(e))},Zk=f(wf,BT,Xk),eN=aw(13),tN=f(qk,eN,PT.textSemiBold),rN=aw(4),nN=function(e){return{$:"FontSize",a:e}},aN=function(e){return f(EA,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(bA,0,0,1))]);default:return F([Yk(4),Lk(l(bA,.9,0,0))])}}();return f(Bk,O(F([f(Hk,23,12),aN(22),tN,wA(Fk),Gk,Zk(t)]),n),Jp(e))}),oN=l(Tk,244,0,103),uN=function(e){return{$:"AlignX",a:e}},sN={$:"CenterX"},cN=uN(sN),fN=aw(3),lN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),dN=r(function(e,t){return"spacing-"+ji(e)+"-"+ji(t)}),hN=function(e){return f(EA,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(gA,YT,Ak,f(qa,pN(gN),f(qa,AT(Nk),f(qa,hN(5),e))),NT(t))}),yN=f(qk,eN,PT.bold),mN=f(Bk,F([aN(29),wA(Fk),yN,cN,Gk,Zk(Dk(Wv))]),f(vN,mr,F([Jp("DAI"),f(Bk,F([wA(oN)]),Jp("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";default:t.a;return"xDai"}},CN=vA(PT.italic),SN=function(e){return f(Bk,F([aN(18),wA(l(bA,.8,.8,1)),tN,CN,cN]),Jp(bN(e)))},EN={$:"Right"},TN=uN(EN),wN={$:"AsColumn"},IN=wN,AN=r(function(e,t){return d(gA,IN,Ak,f(qa,vA(PT.contentTop+" "+PT.contentLeft),f(qa,ET(wT),f(qa,AT(wT),e))),NT(t))}),BN={$:"AsRow"},kN=BN,NN=r(function(e,t){return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY),f(qa,AT(wT),f(qa,ET(wT),e))),NT(t))}),RN=function(e){return f(NN,F([AT(Nk),hN(30),f(Hk,30,17)]),F([l(iN,"Create a New Offer",Dk(Yv),function(){return"CreateModel"===e.submodel.$?Uk:Mk}()),l(iN,"Sell Offers",Dk(Jv(ry)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ry)?Uk:Mk}return Mk}()),l(iN,"Buy Offers",Dk(Jv(Of)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Of)?Uk:Mk}return Mk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(iN,"My Trades",Dk(f(vf,r.address,Of)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Uk:Mk}return Mk}())}return l(iN,"Connect to Wallet",pT,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,ya(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(su,xN(e.state.phase),xN(t.state.phase));return $(r,Pa)?r:f(Kg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},LN=Er,PN=r(function(e,t){return f($a,Zd(e),LN(t))}),DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=aw(20),FN=f(qk,MN,PT.clip),VN=kk,KN=function(e){return f(EA,Vk,h(Kk,"p-"+ji(e),e,e,e,e))},HN=function(e){var t=e.a,r=e.b;return f(Bk,F([AT(VN(t)),ET(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,AT(Nk)]),r))},jN=f(qk,eN,PT.textMedium),qN=function(e){return f(Bk,F([jN,aN(17)]),Jp(e))},GN=function(e){return{$:"Poke",a:e}},zN=aw(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 IT(n);case"Height":var n=t.a;return ST(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(EA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QN,u,f(_f,e,s));case"Attr":var c=t.a;return BT(f(JN,e,c));default:var l=t.a,d=t.b;return f(ZN,l,d)}}),tR=function(e){return f(eR,lg,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(qa,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(uA,n,o));default:return L(r,n)}}),nR=function(e){var t=l(za,rR,L(mr,hA),e),r=t.a,n=t.b;return f(qa,JI(n),r)},aR=function(e){return f(EA,zN,f(WN,YN,nR(e)))},iR=a(function(e,t,r,n){return d(mA,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",ji(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(Cd,fR,e)?XN:vA("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)?_o(t):$o("Not the enter key")},n=f(Ro,r,f(Od,"key",xo));return BT(f(hR,"keyup",f(If,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(gA,$T,Ak,f(qa,AT(wT),f(qa,ET(wT),f(qa,vA(PT.contentCenterX+" "+PT.contentCenterY+" "+PT.seButton+" "+PT.noTextSelection),f(qa,Gk,f(qa,lR(e),f(qa,pN(vR),f(qa,BT(cR(0)),function(){if("Nothing"===r.$)return f(qa,BT(sR(!0)),e);var t=r.a;return f(qa,Zk(t),f(qa,gR(t),e))}()))))))),NT(F([n])))}),mR=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(5),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN,aN(14)]),Jp("Poke")),onPress:ya(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 Ff(0)}}),ER=r(function(e,t){return Ff(Gl(e)-Gl(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 Gl(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(bA,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=Ag(200*e),n=200-r,a=f(Bk,F([AT(VN(n))]),Rk),i=F([ET(xk(3)),Yk(20)]),o=f(Bk,O(i,F([AT(VN(r)),Lk(t)])),Rk),u=f(Bk,O(i,F([AT(Nk),Lk(AR)])),Rk);return f(NN,F([AT(Nk),kR(u)]),F([o,a]))}),RR=l(Tk,51,183,2),$R=function(e){return Gl(e)<0},xR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),_R=function(e){var t=_p(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,lC(t),lC(r),lC(n),lC(a))}(f(ec,L(lu(0),lu(0)),f(Hu,n,lu(60))))}(f(ec,L(lu(0),lu(0)),f(Hu,r,lu(3600))))}(f(ec,L(lu(0),lu(0)),f(Hu,t,lu(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(Ju,2,D("0"),ji(e)),t)}),s=Gl(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([wA(h)]),t),Jp(f(u,c.days,"d"))),f(Bk,O(F([wA(d)]),t),Jp(f(u,c.hours,"h"))),f(Bk,O(F([wA(s)]),t),Jp(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Ff(0);e=p,t=g,n=v,a=y}}),PR=l(bA,1,1,0),DR=r(function(e,t){return Gl(e)/Gl(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([AT(Nk)]),F([aN(16)]),L(o,AR),i)}return f(AN,F([hN(4),AT(Nk)]),O(F([f(Bk,F([cN,aN(14)]),Jp(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(za,r(function(e,t){var r=e.a,n=e.b;return l(Bh,r,n,t)}),Ch,e)}(f(tu,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(ec,"",f(jf,hi,f(Sh,e,VR)))},HR=function(e){return go(e)<=3?e:HR(f(wl,3,e))+","+f(wo,3,e)},jR=function(e){return HR(Tl(e))},qR=function(e){return O(KR(e.fiatType),jR(e.amount))},GR=yT("alt"),zR=function(e){return f(yT,"src",ot(e))},YR=r(function(e,t){var r=t.src,n=t.description,a=f(Zd,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(gA,$T,Ak,f(qa,vA(PT.imageContainer),e),NT(F([d(gA,$T,kT("img"),O(F([BT(zR(r)),BT(GR(n))]),a),NT(mr))])))}),WR=r(function(e,t){if("None"===t.$)return Rk;var r=t.a;return f(YR,e,r)}),JR=mA,QR=function(e){var t=function(){var t=f(Sh,e.fiatType,VR);if("Nothing"===t.$)return Rk;var r=t.a,n=(r.a,r.b);return f(WR,F([ET(xk(26))]),n)}();return f(NN,F([hN(4)]),F([t,f(Bk,F([wA(d(JR,0,0,0,.5)),jN,AT(xk(50))]),Jp(e.fiatType)),Jp(qR(e))]))},XR=function(e){return QR(e)},ZR=function(e){return f(Bk,F([AT(Nk),ET(Nk),FN]),f(vN,F([aN(12)]),F([Jp(e.info)])))},e$=function(e){return f(ec,Rk,f(jf,ZR,Xf(e)))},t$=MR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),r$=function(e){return f(WR,f(qa,ET(xk(26)),e),t$)},n$=function(e){var t=Il(Hf(e)),r=f(Zf,".",t);if(!r.b)return t;if(r.b.b){kl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Co,3,t);case 1:return f(Co,4,f(ec,t,f(jf,Tw,f(jf,function(e){return e/100},f(jf,ni,f(jf,Ag,f(jf,yi(100),Nl(t))))))));default:var n=r.a;return f(ec,f(Co,n,t),f(jf,ji,f(jf,Ag,Nl(t))))}},a$=function(e){var t=n$(e);return f(NN,F([hN(4)]),F([r$(mr),f(Bk,F([aN(16)]),Jp(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),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN]),Jp("View Offer")),onPress:ya(o$(e))})},s$=i(function(e,t,r,n,a){return f(NN,F([AT(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,ry),t)));case"Judgment":return HN(L(2,d(OR,e,a,$(r,Of),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$=aw(28),f$=function(e){return f(EA,c$,l(SA,"bc-"+TA(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(EA,fA,h(l$,"b-"+ji(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([AT(Nk),ET(Nk),f(Hk,30,10),hN(5)]),F([f(NN,F([AT(Nk)]),F([$(r.viewPhase,rC)?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([AT(Nk),d$(1),Yk(8),f$(AR),hN(1),Lk(AR),FN]),f(tu,d(s$,e,!$(r.userInfo,ma),r.agentRole,r.viewPhase),t))]))}),p$=n(function(e,t,r){return $(f(CS,e,r),ya(t))}),g$=l(Tk,150,150,150),v$=function(e){return f(Zd,function(e){return bb(e.parameters)},GE(e))},y$=n(function(e,t,r){var n=l(PN,$N(r),_N(),v$(t)),a=f(Zd,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,wA(g$),cN,KN(20)]),Jp(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)),wA(l(Tk,16,7,234)),aN(e),tN,f(Hk,15,13)]),Jp(Xd(t)))}),b$=a(function(e,t,r,n){return"pad-"+ji(e)+"-"+ji(t)+"-"+ji(r)+"-"+ji(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(EA,Vk,h(Kk,"p-"+ji(t),t,t,t,t)):f(EA,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]),Jp("Your Trades")):f(NN,F([hN(10),C$({bottom:30,left:30,right:30,top:10})]),F([f(Bk,F([aN(24),tN]),Jp("Trade History for User")),f(m$,18,e.agentAddress)]))},E$=function(e){return{$:"ViewPhaseChanged",a:e}},T$=l(bA,0,0,1),w$=function(e){var t=F([aN(20),yN,Gk]),r=function(e){return e?O(t,F([wA(T$)])):t};return f(NN,F([hN(30)]),F([f(Bk,O(F([Zk(E$(no))]),r($(e,no))),Jp("Open")),f(Bk,O(F([Zk(E$(nC))]),r($(e,nC))),Jp("Payment Due")),f(Bk,O(F([Zk(E$(aC))]),r($(e,aC))),Jp("Release Due")),f(Bk,O(F([Zk(E$(rC))]),r($(e,rC))),Jp("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([wA(B$)]))):L(O(t,F([wA(B$)])),t)}(),n=r.a,a=r.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(A$(Of))]),a),Jp("As the Seller")),f(Bk,O(F([Zk(A$(ry))]),n),Jp("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),AT(Nk),ET(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(tu,function(e){return F([f(Bk,F([wA(oN)]),Jp("Caution! ")),Jp(e)])},QC(F([$(f(Kg,e.autoreleaseInterval,Ff(12e5)),Da)?ya(function(){return"Buyer"===e.initiatorRole.$?"That Burn/Release Window time is quite small! It might take a while to find a committed Seller.":"That Burn/Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing."}()):ma,$(f(Kg,e.autoabortInterval,Ff(36e5)),Da)?ya(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.'}()):ma])))},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([wA(d(JR,0,0,0,.7))]),Jp("x")))},D$=Hn,U$=D$,O$=BT,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)),AT(Nk),ET(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(va,M$,d(JR,0,0,.3,.6),f(Bk,O(F([cN,ON,AT(f(q$,500,wT)),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(bA,.9,0,0)),d$(1),Lk(l(bA,1,.4,.4)),KN(5),cN,ON,AT(f(q$,200,wT)),aN(14)]),e),f(vN,mr,F([Jp(r)])))}),Y$={$:"Above"},W$=function(e){return f(QN,Y$,e)},J$=aw(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))]),Jp(e))}),ex=d(iR,1,31,52,.64),tx=aw(32),rx={$:"Active"},nx=function(e){return f(EA,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),wA(t),aN(18),tN,Lk(a),nx(F([Lk(o)])),aR(F([Lk(i)]))]),Jp(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=aw(12),ux=f(qk,ox,PT.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(tu,function(e){return f(vN,F([cN,ON,aN(20),tN,wA(Fk),ux]),F([e]))},e)))},cx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+_A(t)}e.a;return"https://kovan.etherscan.io/tx/"+_A(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+_A(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+_A(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+_A(t)}}),fx={$:"Bottom"},lx=DN(fx),dx=vA(PT.underline),hx=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=Qf(t.web3Context.factoryType),a=function(){var e=t.depositAmount;if("Just"===e.$){var n=e.a;return L(Jp(n$(Fv(n))),f(ix,"Yes, I definitely want to open this trade.",f(_$,r,n)))}return L(Jp("??"),f(Z$,"(loading exact fees...)",ma))}(),i=a.a,o=a.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),O(L$(r),O(F([F([Jp("You will deposit "),i,Jp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Jp("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([Jp("Waiting for user signature for the approve call."),Jp("(check Metamask!)"),Jp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var r=e.a,u=e.b;return sx(F([Jp("Mining the initial approve transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Jp("Funds will not leave your wallet until you sign the next transaction.")]));case"CreateNeedsSig":return sx(F([Jp("Waiting for user signature for the create call."),Jp("(check Metamask!)")]));default:var u=e.a;return sx(F([Jp("Mining the final create call..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,t.web3Context.factoryType,u)}),Jp("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=yT("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,wA(mx)]),Jp(Qf(e)))]))},Cx={$:"Left"},Sx=uN(Cx),Ex=function(e){return{$:"HiddenLabel",a:e}},Tx=Ex,wx=yT("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(Ja,Od,t,e)}),Nx=f(kx,F(["target","value"]),xo),Rx=function(e){return f(Bx,"input",f(If,Ix,f(If,e,Nx)))},$x=aw(0),xx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),_x=function(e){var t=function(e){return 1-e}(f(Hs,1,f(vi,0,e)));return f(EA,$x,f(xx,"transparency-"+yw(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(gA,IN,kT("label"),e,NT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(gA,$T,Ak,a,NT(F([i])));switch(n.$){case"Above":return d(gA,IN,kT("label"),e,NT(F([o,r])));case"Below":return d(gA,IN,kT("label"),e,NT(F([r,o])));case"OnRight":return d(gA,kN,kT("label"),e,NT(F([r,o])));default:return d(gA,kN,kT("label"),e,NT(F([o,r])))}}),Dx=MI,Ux=f(wf,BT,Dx("autocomplete")),Ox=l(bA,136/255,138/255,133/255),Mx=l(bA,186/255,189/255,182/255),Fx=f(Hk,12,12),Vx=l(bA,1,1,1),Kx=F([Fx,Yk(3),f$(Mx),Lk(Vx),d$(1),hN(3),AT(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(wf,BT,zx),Wx=J,Jx=aw(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}(Oi(Wx(e))),o=(i-1)*t+f(ec,0,f(jf,a,r))+f(ec,0,f(jf,a,n));return f(EA,Jx,l(WI,"textarea-height-"+ji(i),"height",function(e){return"calc("+ji(e)+"em + "+ji(o)+"px) !important"}(i)))}),Xx=yT("value"),Zx=f(wf,BT,Xx),e_={$:"LivePolite"},t_=pN(e_),r_=function(e){return l(Ja,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(qa,e,r),n);case"Attr":e.a;return L(f(qa,e,r),n);case"StyleClass":e.b;return L(f(qa,e,r),n);case"Width":e.a;return f(gw,"width",n)?L(r,n):L(f(qa,e,r),f(kE,"width",n));case"Height":e.a;return f(gw,"height",n)?L(r,n):L(f(qa,e,r),f(kE,"height",n));case"Describe":e.a;return f(gw,"described",n)?L(r,n):L(f(qa,e,r),f(kE,"described",n));case"Nearby":e.a,e.b;return L(f(qa,e,r),n);case"AlignX":return f(gw,"align-x",n)?L(r,n):L(f(qa,e,r),f(kE,"align-x",n));case"AlignY":return f(gw,"align-y",n)?L(r,n):L(f(qa,e,r),f(kE,"align-y",n));default:return f(gw,"transform",n)?L(r,n):L(f(qa,e,r),f(kE,"transform",n))}}),L(mr,mm),e).a},n_=r(function(e,t){return l(Ja,r(function(e,r){return t(e)?f(qa,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(wf,xf,Ou),o_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([BT(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(Zd,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(Zd,f(wf,Tu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([Zx(n.text),BT(wx(a)),Yx(e.spellchecked),vA(PT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return XN;var r=t.a;return Ux(r)}()]),p),mr)}var i=l(Ja,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(qa,e,t.adjustedAttributes),heightContent:ya(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(qa,e,t.adjustedAttributes),maybeBorder:ya(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:ya(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(qa,e,t.adjustedAttributes),maybeSpacing:ya(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(qa,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:ma,maybeBorder:ma,maybePadding:ma,maybeSpacing:ma},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(ec,5,c);return P("textarea",O(F([Yx(e.spellchecked),vA(PT.inputMultiline),f(ec,XN,f(jf,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(vi,0,n-(v/2|0)),left:a,right:r,top:f(vi,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?XN:s.a?d(Qx,n.text,v,u,g):XN}()]),h),F([i_(PI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(gA,$T,Ak,f(qa,AT(Nk),uy(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(qa,Fx,O(s,O(F([wA(Ox),vA(PT.noTextSelection+" "+PT.passPointerEvents),f$(d(JR,0,0,0,0)),Lk(d(JR,0,0,0,0)),ET(Nk),AT(Nk),_x(""===n.text?1:0)]),r))),a))])}()]))),NT(F([d(gA,$T,kT(v),uy(F([F([lR(t),jx(n.label)]),y,i])),NT(m))])));return l(Px,f(qa,f(qk,jk,PT.cursorText),f(qa,Gx(n.label)?XN:hN(5),f(qa,t_,u))),n.label,b)}),u_=o_({autofill:ma,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([AT(Nk),ET(xk(40)),d$(0)]),{label:Tx(r),onChange:i,placeholder:n,text:a});return f(NN,O(F([hN(5)]),e),QC(F([f(jf,Bk(F([Sx])),o),ya(s),f(jf,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([AT(xk(150)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),r))]),L(ma,ya(bx(e))),"dai input",ma,t,gx)}),h_=r(function(e,t){return f(EA,fA,h(l$,"b-"+ji(e)+"-"+ji(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(EA,fA,h(l$,"b-"+ji(r)+"-"+ji(a)+"-"+ji(t)+"-"+ji(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]),Jp(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=yl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Gf,r,100))+" "+Qf(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),wA(l(Tk,0,226,255)),tN]),Jp(t)),f(Bk,F([aN(17),wA(Fk),jN]),Jp("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(wE,n(function(t,r,n){return f(e,t,r)?l(Bh,t,r,n):n}),Ch,t)}),E_=function(e){return f(S_,r(function(t,r){return f(gg,e,t)}),VR)},T_=MR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),w_=function(e){return f(WR,F([ET(xk(26))]),f(ec,T_,f(jf,ko,f(Sh,e,VR))))},I_=function(e){return O$(f(Bx,"click",_o(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&xi(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(qi,"",f(qa,t,f(tu,tP,r)));case"UniversalSelectorSequence":var r=e.a;return jo(r)?"*":f(qi,"",f(tu,tP,r));default:var t=e.a,r=e.b;return f(qi,"",f(qa,t,f(tu,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(qi," ",F([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(qa,rP(t),f(tu,nP,r)),i=f(qi,"",F([f(ec,"",f(jf,ZL,n))]));return f(As,f(qi," ",f(Zd,f(wf,Tu,Ll),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(qi,", ",f(tu,aP,f(qa,r,n)));return f(qi,"",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(qi,",\n",f(tu,GL,r))+" {\n"+f(qi,"\n\n",f(tu,f(wf,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(qi,"\n\n",f(Zd,f(wf,Tu,Ll),F([HL(t),f(qi,"\n",f(tu,YL,r)),f(qi,"\n",f(tu,WL,n)),f(qi,"\n\n",f(tu,oP,a))])))},sP=function(e){return uP(KL(ML(e)))},cP=function(e){return f(qi,"\n\n",f(tu,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,ma);return fP(F([dP(l(lP,r,mr,e))]))}),pP=function(e){return jo(e)?"unstyled":f(qu,D("_"),ts(f(Y_,15739,cP($E(W_($E(f(hP,e,wL(mr)))))))))},gP=function(e){var t=pP(e),r=f(F_,"className",Gd(t));return l(V_,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(qa,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(kw(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 jo(r)?t:l(Bh,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(qa,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(za,EP,i,s),p=l(za,IP,L(mr,h),c),g=p.a,v=p.b,o=l(tw,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(za,EP,i,s),m=l(za,IP,L(mr,h),c),g=m.a,v=m.b,o=d(SP,y,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(za,EP,i,s),b=l(za,wP,L(mr,h),c),g=b.a,v=b.b,o=l(ew,u,f(tu,TP,s),Ya(g));return L(f(qa,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(za,EP,i,s),C=l(za,wP,L(mr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(tu,TP,s),Ya(g));return L(f(qa,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(qa,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(za,EP,n,o),c=l(za,IP,L(mr,s),u),h=c.a,p=c.b,a=l(tw,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(za,EP,n,o),v=l(za,IP,L(mr,s),u),h=v.a,p=v.b,a=d(SP,g,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(za,EP,n,o),y=l(za,wP,L(mr,s),u),h=y.a,p=y.b,a=l(ew,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(za,EP,n,o),m=l(za,wP,L(mr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(tu,TP,o),Ya(h));return L(f(qa,a,r),p)}}),AP=r(function(e,t){return h(Th,Eh,e,t,bh,bh)}),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(Ll(a)){var o=e,u=i;e=o,t=u}else{var o=ya(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,ma,e);if("Nothing"===t.$)return Ch;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($E(W_(f(tu,RP,Ka(e)))))},xP=function(e){return l(tw,"style",mr,$E(kw($P(e))))},_P=n(function(e,t,r){var n=f(tu,TP,t),a=kP(t),i=l(za,IP,L(mr,a),r),o=i.a,u=i.b,s=xP(u);return l(tw,e,n,f(qa,s,Ya(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(tu,TP,t),a=kP(t),i=l(za,wP,L(mr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(ew,e,n,f(qa,s,Ya(o)))}),OP=a(function(e,t,r,n){var a=f(tu,TP,r),i=kP(r),o=l(za,wP,L(mr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(qa,c,Ya(u)))}),MP=a(function(e,t,r,n){var a=f(tu,TP,r),i=kP(r),o=l(za,IP,L(mr,i),n),u=o.a,s=o.b,c=xP(s);return d(SP,e,t,a,f(qa,c,Ya(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(Ja,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 ya(h(jP,n,a,i,o,u))}return ma}(),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 ya(l(qP,a,t,i))}return ma}())}),L(ma,ma),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,AT(wT),f(qa,ET(wT),e))),NT(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?ya(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ma}return ma}();if("Just"===c.$){var h=c.a;return d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,AT(wT),f(qa,ET(wT),O(e,F([h]))))),NT(t))}var p=-s/2,g=-u/2;return d(gA,$T,Ak,e,NT(F([d(gA,kN,Ak,f(qa,vA(PT.contentLeft+" "+PT.contentCenterY+" "+PT.wrapped),f(qa,BT(f(U$,"margin",Tw(p)+"px "+Tw(g)+"px")),f(qa,BT(f(U$,"width","calc(100% + "+ji(u)+"px)")),f(qa,BT(f(U$,"height","calc(100% + "+ji(s)+"px)")),f(qa,f(EA,fN,l(lN,o,u,s)),mr))))),NT(t))])))}),YP=a(function(e,t,r,n){var a=f(u_,F([AT(xk(80)),ET(xk(40)),aN(24),jN,f$(AR),I_(r)]),{label:Tx("currency type"),onChange:f($a,HP,n),placeholder:ma,text:t}),i=f(Sh,t,VR),o=function(){var r=L(e,i);if(r.a){if("Just"===r.b.$)return Rk;r.b;return f(zP,F([AT(xk(350)),f$(IR),d$(1),Lk(Fk),KN(10),cN]),f(tu,function(e){var t=e.a,r=e.b,a=r.b;return f(NN,F([AT(xk(80)),hN(9),f(Hk,0,5),I_(n(t)),aR(F([Lk(l(bA,.8,.8,1))]))]),F([f(WR,F([ET(xk(26))]),a),f(Bk,F([aN(16),tN]),KP(t))]))},Ka(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=Jp(KR(e)),o=f(Bk,F([f_(f(z$,F([yx,l_(5)]),a))]),d(YP,r,e,$$(!0),C_));return p(s_,F([AT(xk(250)),jN,aN(24),f_(f(z$,F([yx,l_(5)]),n))]),L(ya(i),ya(o)),"fiat input",ma,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([wA(B$)]))):L(O(r,F([wA(B$)])),r)}(),a=n.a,i=n.b;return f(NN,F([hN(20)]),F([f(Bk,O(F([Zk(QP(Of))]),i),Jp("Sell "+Qf(e))),f(Bk,O(F([Zk(QP(ry))]),a),Jp("Buy "+Qf(e)))]))}),ZP=function(e){return f(v_,"Trade Type",f(XP,e.web3Context.factoryType,e.inputs.userRole))},eD=aw(19),tD=function(e){return Sl(F([e.inset?"box-inset":"box-",Tw(e.offset.a)+"px",Tw(e.offset.b)+"px",Tw(e.blur)+"px",Tw(e.size)+"px",TA(e.color)]))},rD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(EA,eD,l(WI,tD(t),"box-shadow",Iw(t)))},nD=rD({blur:20,color:d(iR,0,0,0,.04),offset:L(0,3),size:0}),aD=f(qk,fN,PT.spaceEvenly),iD=function(e){return f(AN,F([AT(Nk),hN(20),Lk(Fk),Yk(5),KN(20),nD]),F([f(NN,F([AT(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,F([wA(d(JR,0,0,0,.2))]),function(){return Jp("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:ma,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]),Jp("Payment Method")),a=f(gD,F([AT(Nk),ET(xk(150)),Lk(d(iR,155,203,255,.2)),d$(0)]),{label:Tx("payment method"),onChange:fD,placeholder:""===r?ya(hD(t)):ma,spellcheck:!0,text:r});return f(AN,F([hN(20),C$({bottom:15,left:45,right:45,top:0}),AT(Nk),W$(f(z$,F([yx,l_(30),KN(10),aN(20),AT(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 to 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(Ju,e,D("0"),ji(n));return f(Bk,F([aN(22),wA(t)]),Jp(O(a,r)))}),bD=function(e){return Gl(e)<0?Ff(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(Tb,t,e)))]),f(WR,F([ET(xk(10))]),SD)),r,f(Bk,F([KN(4),Gk,Zk(n(function(e){return Gl(e)?e:Ff(3e5)}(bD(f(ER,t,e)))))]),f(WR,F([ET(xk(10))]),CD))]))}),i=_R(t);return f(NN,F([aD,hN(10)]),F([f(a,Ff(864e5),d(mD,3,e," days",i.days)),f(a,Ff(36e5),d(mD,2,e," hours",i.hours)),f(a,Ff(3e5),d(mD,2,e," min",i.min))]))}),TD=o(function(e,t,r,n,a,i){var o=f(Bk,F([Lk(d(iR,155,203,255,.2)),Yk(5),KN(15),W$(f(z$,F([yx]),a))]),l(ED,IR,n,i)),u=f(NN,F([hN(30)]),F([f(WR,F([ET(xk(40))]),e),f(Bk,F([aN(22),tN]),Jp(t))])),s=f(vN,F([aN(17),jN,wA(ex)]),F([Jp(r)]));return f(AN,F([AT(Nk),Yk(10),Lk(l(Tk,237,237,237)),hN(2)]),f(tu,Bk(F([Lk(Fk),f(Hk,45,18),AT(Nk)])),F([u,f(NN,F([AT(Nk),hN(25),Lk(Fk)]),F([o,s]))])))}),wD=MR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),ID=f(qk,MN,PT.clipX),AD=f(qk,MN,PT.clipY),BD=i(function(e,t,r,n,a){return f(AN,F([hN(15),Yk(8),ID,AD,Lk(Fk)]),F([p(TD,wD,"Payment Window",yD(a),r,n,cD),l(vD,t,a,e)]))}),kD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},ND=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."},RD=MR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),$D=n(function(e,t,r){return f(Bk,F([Yk(8),ID,AD,Lk(Fk)]),p(TD,RD,"Burn/Release Window",ND(r),e,t,kD))}),xD=function(e){return{$:"AutorecallIntervalChanged",a:e}},_D=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."},LD=MR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),PD=n(function(e,t,r){return f(Bk,F([Yk(8),Lk(Fk),ID,AD]),p(TD,LD,"Open Window",_D(r),e,t,xD))}),DD=function(e){return f(AN,F([AT(Nk),hN(20)]),F([l(PD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(BD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l($D,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},UD=function(e){return f(AN,F([AT(f(q$,1e3,Nk)),cN,hN(20),C$({bottom:30,left:40,right:40,top:0}),Zk($$(!1)),H$(px(e))]),F([iD(e),DD(e),sD(e.userInfo)]))},OD=Gu(Km(8226)),MD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(qa,e,f(qa,t,r))}),o=l(Ja,i,mr,a);return f(qa,n,o)}return mr}),FD=r(function(e,t){return l(za,qa,t,e)}),VD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(FD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KD=r(function(e,t){var r=Oi(t);return!r||$(r,e)?t:_(r,e)<0?Ya(f(FD,f($s,e%r,t),l(VD,mr,e/r|0,t))):f($s,e,t)}),HD=a(function(e,t,r,n){for(;;){if(!r.b)return Ya(n);var a=r.a,i=r.b,o=e(a);if(f(gw,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(kE,o,t),c=i,l=f(qa,a,n);e=u,t=s,r=c,n=l}}}),jD=function(e){return d(HD,to,mm,e,mr)},qD=r(function(e,t){return f(Bk,F([AT(Nk),H$(f(NN,F([hN(3),AT(VN(100)),AT(t),FN]),f(MD,f(Bk,F([wA(d(JR,0,0,0,.1)),aN(14)]),Jp(OD)),f(tu,f(wf,Bk(F([wA(d(JR,0,0,0,.2))])),Jp),f(KD,100,(e?Ya:to)(jD(f(tu,f($a,ko,hi),Ka(VR)))))))))]),Jp(" "))}),GD=function(e){return f(AN,F([AT(Nk),ET(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(qD,!1,Nk),f(AN,F([cN,hN(15),AT(f(q$,700,Nk))]),f(tu,vN(F([AT(Nk),aN(17),jN,wA(ex),ux])),F([F([f(Bk,F([aN(22),wA(IR)]),Jp("Hold on a second!"))]),F([Jp("This version of DAIHard is live and functional, but a Factory upgrade is coming soon.")]),F([Jp("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([Jp("If you'd like to keep up to date with our upgrades and progress, join our "),f(yA,F([wA(T$),dx]),{label:Jp("Telegram group"),url:"https://t.me/daihardexchange_group"}),Jp(".")])]))),f(Bk,F([cN,Zk(dT(Cf({category:"landing-page",event:"lets-go-clicked",label:'"Let\'s Go" clicked',value:0})))]),f(ix,"Okay, got it. let's go!",e)),f(qD,!0,Nk)]))},zD=function(e){return{$:"ShowCurrencyDropdown",a:e}},YD=n(function(e,t,r){return f($a,Zd(t(e)),LN(r))}),WD={$:"AutoabortWindow"},JD={$:"AutoreleaseWindow"},QD={$:"Expiring"},XD={$:"Fiat"},ZD={$:"Margin"},eU={$:"TradeAmount"},tU=function(e){var t=e.a,r=e.b;return f(Bk,F([AT(VN(t)),ET(xk(60)),FN,Lk(Fk)]),f(Bk,F([KN(12),ON,AT(Nk)]),r))},rU={$:"Descending"},nU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),aU=function(e){return f(Bk,F([jN,aN(17)]),Jp(e))},iU=n(function(e,t,r){return f(NN,F([hN(8)]),F([aU(e),f(AN,F([hN(2)]),F([f(Bk,F([KN(4),Gk,Zk(f(nU,t,sv))]),f(WR,F([AT(xk(8)),cN,ON]),SD)),f(Bk,F([KN(4),Gk,Zk(f(nU,t,rU))]),f(WR,F([AT(xk(8)),cN,ON]),CD))]))]))}),oU=r(function(e,t){var r=function(){return"Buyer"===e.$?oN:RR}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoabortInterval)}),uU=r(function(e,t){var r=function(){return"Buyer"===e.$?RR:oN}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:IR;return d(LR,mr,mr,L(n,AR),t.parameters.autoreleaseInterval)}),sU=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([AT(Nk)]),F([aN(16)]),L(a,AR),n)}var i=r.a;return d(UR,F([AT(Nk)]),F([aN(16)]),L(oN,AR),L(Ff(0),i))}),cU=function(e){return QR(e.terms.price)},fU=function(e){var t=fu(100*e),r=t-gi(t),n=ji(gi(t)),a=f(vi,0,3-go(n));return n+(function(){if(a){return f(Co,a+1,f(yo,1,Tw(r)))}return""}()+"%")},lU=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"}()})}),dU=n(function(e,t,r){return f(WR,f(qa,ET(xk(34)),e),f(lU,t,r))}),hU=r(function(e,t){var r=fU(t);if("0%"===r)return f(Bk,F([aN(16)]),Jp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?RR:oN;return f(NN,F([hN(4)]),F([l(dU,mr,a,ya(i)),f(Bk,F([wA(o),aN(16)]),Jp(n))]))}),pU=r(function(e,t){return f(ec,Rk,f(jf,hU(t),e.derived.margin))}),gU=function(e){return f(ec,Rk,f(jf,ZR,Xf(e)))},vU=function(e){return a$(e.parameters.tradeAmount)},yU=function(e){return{$:"TradeClicked",a:e}},mU=function(e){return f(yR,F([Lk(d(iR,16,7,234,.2)),KN(11),Yk(4),AT(Nk),aR(F([Lk(d(iR,16,7,234,.4))]))]),{label:f(Bk,F([cN,wA(l(Tk,16,7,234)),jN]),Jp("View Offer")),onPress:ya(yU(e))})},bU=n(function(e,t,r){return f(NN,F([AT(Nk),hN(1),Lk(AR)]),F([f(AN,F([AT(Nk),hN(1),AT(VN(7))]),F([f(NN,F([AT(VN(6)),hN(1)]),f(tu,tU,F([L(2,f(sU,e,r)),L(1,vU(r)),L(2,cU(r)),L(1,f(pU,r,!$(t,ry))),L(2,f(oU,t,r)),L(2,f(uU,t,r))]))),tU(L(1,gU(r.terms.paymentMethods)))])),f(Bk,F([AT(VN(1)),ET(Nk),FN,Lk(Fk)]),f(Bk,F([cN,ON]),mU(r.id)))]))}),CU=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(AN,F([AT(Nk),ET(Nk),KN(30),hN(5)]),F([f(NN,F([AT(Nk)]),F([f(NN,F([AT(VN(7))]),F([tU(L(2,l(iU,"Expires",QD,ma))),tU(L(1,l(iU,n,eU,ma))),tU(L(2,l(iU,"For Fiat",XD,ma))),tU(L(1,l(iU,"Margin",ZD,ma))),tU(L(2,l(iU,"Payment Window",WD,ma))),tU(L(2,l(iU,"Auto-Release",JD,ma)))])),f(Bk,F([AT(VN(1))]),Rk)])),f(AN,F([AT(Nk),d$(2),Yk(8),f$(g$),hN(1),Lk(g$),FN]),f(tu,f(bU,e,r.browsingRole),t))]))}),SU=n(function(e,t,r){var n=d(YD,e,r.filterFunc,r.sortFunc,v$(t)),a=function(e){return f(Bk,F([aN(24),tN,wA(g$),cN,KN(20)]),Jp(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(CU,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.")}),EU={$:"ApplyInputs"},TU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([wA(Fk),cN,ON]),Jp("Apply")),onPress:ya(EU)}),wU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(EA,zk,l(WI,"br-"+ji(t)+"-"+ji(r)+ji(n)+"-"+ji(a),"border-radius",ji(t)+"px "+ji(r)+"px "+ji(a)+"px "+ji(n)+"px"))},IU=function(e){return f(Qk,"focus",_o(e))},AU=f(wf,BT,IU),BU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([AU(e(!0)),I_(e(!0))])}();return f(NN,O(e,F([ET(xk(40)),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Bk,F([Lk(AR),ET(xk(40)),wU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Bk,F([ON,f(Hk,10,0)]),r)),f(u_,O(s,O(t,F([AT(xk(100)),ET(xk(40)),f$(AR),wU({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})]))}),kU=function(e){return{$:"MaxDaiChanged",a:e}},NU=function(e){return{$:"MinDaiChanged",a:e}},RU=r(function(e,t){return f(AN,F([AT(Nk),hN(8)]),F([f(Bk,F([aN(17),jN]),Jp(e)),t]))}),$U=aw(25),xU=function(e){return{$:"MoveX",a:e}},_U=function(e){return f(ZN,$U,xU(-e))},LU={$:"OnLeft"},PU=function(e){return f(QN,LU,e)},DU=a(function(e,t,r,n){var a=r$(F([ON])),i=f(NN,F([hN(8),ON,AT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Jp("max"))])),o=f(NN,F([hN(8),ON,AT(xk(60))]),F([a,f(Bk,F([aN(16),ON]),Jp("min"))]));return f(RU,Qf(e)+" Range",f(AN,F([hN(5),AT(xk(200))]),F([v(BU,F([PU(f(z$,F([_U(5),AT(xk(200))]),n.minDai))]),F([AU(zD(!1))]),o,"min "+Qf(e),t,ma,ma,NU),v(BU,F([PU(f(z$,F([_U(5),AT(xk(200))]),n.maxDai))]),F([AU(zD(!1))]),i,"max "+Qf(e),r,ma,ma,kU)])))}),UU=function(e){var t=f(Sh,e,VR);if("Nothing"===t.$)return Jp("*");var r=t.a,n=r.b;return f(WR,F([ET(xk(26))]),n)},OU=function(e){return{$:"FiatTypeInputChanged",a:e}},MU=function(e){return{$:"MaxFiatChanged",a:e}},FU=function(e){return{$:"MinFiatChanged",a:e}},VU=i(function(e,t,r,n,a){var i=UU(t),o=f(NN,F([hN(8),ON,AT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Jp("max"))])),u=f(NN,F([hN(8),ON,AT(xk(60))]),F([i,f(Bk,F([aN(16),ON]),Jp("min"))]));return f(RU,"Fiat Type",f(NN,F([hN(5),AT(wT)]),F([f(Bk,F([V$,AT(xk(120))]),d(YP,e,t,zD(!0),OU)),f(AN,F([hN(5),V$,AT(xk(200))]),F([v(BU,F([W$(f(z$,F([X$(5),AT(f(q$,200,wT))]),a.minFiat))]),F([AU(zD(!1))]),u,"min",r,ma,ma,FU),v(BU,F([f_(f(z$,F([l_(5),AT(f(q$,200,wT))]),a.maxFiat))]),F([AU(zD(!1))]),o,"max",n,ma,ma,MU)]))])))}),KU={$:"AddSearchTerm"},HU=function(e){return{$:"PaymentMethodInputChanged",a:e}},jU=f(Od,"keyCode",ZC),qU=function(e){return f(Qk,"keyup",f(Ro,function(t){return 13===t?_o(e):$o(ji(t))},jU))},GU=function(e){return f(RU,"Search Payment Methods",f(u_,F([V$,AT(xk(250)),ET(xk(40)),f$(AR),rD({blur:20,color:d(iR,233,237,242,.05),offset:L(0,3),size:0}),O$(qU(KU))]),{label:Tx("payment methods search"),onChange:HU,placeholder:ma,text:e}))},zU={$:"ResetSearch"},YU=f(yR,F([Lk(T$),KN(10),Yk(5)]),{label:f(Bk,F([wA(Fk),cN,ON]),Jp("Reset")),onPress:ya(zU)}),WU=function(e){return{$:"RemoveTerm",a:e}},JU=function(e){return f(Bk,F([KN(3),V$,Gk,Zk(WU(e)),aN(10),wA(oN)]),Jp("x"))},QU=function(e){if(e.b){var t=e;return f(NN,F([AT(Nk),KN(10),hN(10)]),f(tu,function(e){return f(NN,F([Lk(d(iR,16,7,234,.2)),Yk(5),KN(4),hN(3)]),F([Jp(e),JU(e)]))},t))}return Rk},XU=a(function(e,t,r,n){return f(AN,F([hN(10),AT(wT),cN]),F([f(NN,F([AT(wT),hN(10)]),F([f(Bk,F([AT(wT),V$]),d(DU,e,t.minDai,t.maxDai,r)),f(Bk,F([AT(wT),V$]),h(VU,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(AN,F([AT(wT),V$,hN(5)]),F([GU(t.paymentMethod),QU(t.paymentMethodTerms)])),f(RU," ",f(AN,F([hN(5),AT(wT)]),F([TU,YU])))]))]))}),ZU=n(function(e,t,r){return f(AN,F([Yk(5),Lk(Fk),AT(Nk),ET(Nk),Zk(zD(!1))]),F([f(NN,F([AT(Nk),hN(10),KN(30)]),F([d(XU,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(SU,e,t,r)]))}),eO=f($a,lu,km("USD")),tO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),rO=function(e){return Fv(f(Ru,f(gl,lu(10),lu(18)),lu(e)))},nO=F([d(tO,Of,rO(5),eO(4),P(Ff(1728e5),Ff(1728e5),Ff(2592e5))),d(tO,ry,rO(2),eO(7),P(Ff(1728e5),Ff(1728e5),Ff(2592e5)))]),aO=function(e){return f(Gf,Uv(e),3)},iO=PR,oO=r(function(e,t){return n$(t)+" "+Qf(e)}),uO=r(function(e,t){return f(Bk,F([wA(iO),aN(20)]),Jp(f(oO,e,t)))}),sO=RR,cO=function(e){return"$"+Tl(e.amount)+" USD"},fO=function(e){return f(Bk,F([wA(sO),aN(20)]),Jp(cO(e)))},lO=function(e){return $(e,Ff(6048e5))?Jp("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!!")},dO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(uO,e,f(fd,Uv(t),aO(t))):fO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(AN,F([hN(5)]),F([f(uO,e,t.daiAmountIn),fO(t.fiatValue)])):f(uO,e,t.daiAmountIn)}(),a=lO(function(e){var t=e.a,r=e.b,n=e.c;return f(Tb,n,f(Tb,r,t))}(t.intervals)),i=Jp("---\x3e");return f(AN,F([hN(8)]),F([f(NN,F([hN(4)]),F([n,i,r])),a]))}),hO=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)}),pO=function(e){return{$:"StartClicked",a:e}},gO=function(e){return f(hO,"Start",pO(e))},vO=n(function(e,t,r){return f(NN,F([hN(40)]),F([f(dO,e,r),t?gO(r):Rk]))}),yO=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),mO=r(function(e,t){if("Just"!==e.$)return f(Z$,"Can't find userInfo...",ya("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...",ma);case"ReadyToOpen":return f(ix,"Open Trade",f(yO,r,n));case"OpenNeedsSig":default:return Rk}}),bO=function(e){return{$:"TextInputChanged",a:e}},CO=function(e){return f(dD,mr,f(AN,F([hN(5)]),f(tu,f(wf,vN(mr),$E),function(){return F("Buyer"===e.$?[Jp("Some ideas:"),f(Bk,F([CN]),Jp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Bk,F([CN]),Jp("I'll send you $7 in Steam credit.")),f(Bk,F([CN]),Jp("TransferWise")),f(Bk,F([CN]),Jp("Cash drop in Hume Park, Bulawayo"))]:[Jp("Some ideas:"),f(Bk,F([CN]),Jp("I accept money orders or cashier checks into my Schwab bank account.")),f(Bk,F([CN]),Jp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Bk,F([CN]),Jp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Bk,F([CN]),Jp("Ship me a potato."))])}())))},SO=r(function(e,t){return f(gD,F([AT(Nk),ET(xk(200))]),{label:Tx("payment details"),onChange:bO,placeholder:""===t?ya(CO(e)):ma,spellcheck:!0,text:t})}),EO=r(function(e,t){return f(AN,F([hN(10)]),f(tu,vN(mr),F([function(){return F("Seller"===e.$?[Jp("How must the "),fO(t),Jp(" be paid?")]:[Jp("How can you deliver the "),fO(t),Jp("?")])}(),F([Jp("You will be able to chat with the "),Jp(function(){return"Seller"===e.$?"buyer":"seller"}()),Jp(" to coordinate further once the trade is in progress.")])])))}),TO=function(e){return{$:"ApproveClicked",a:e}},wO=function(e){return{$:"ChangeState",a:e}},IO={$:"Web3Connect"},AO=n(function(e,t,r){return f(ec,Rk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ya(l(G$,mr,f(AN,F([hN(15),cN,KN(20)]),F([Jp("Text about approving"),function(){if("Just"===t.$){t.a;return f(hO,"Prepare "+n$(n.daiAmountIn)+" "+Qf(e)+" for deposit",TO(n))}return f(ix,"Connect to Wallet",IO)}()])),wO(Cv(Sv))));case"ApproveNeedsSig":var n=r.a.a;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Waiting for sig text")])),wO(Cv(Sv))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Text about opening")])),wO(f(Lv,n,_v))));case"OpenMining":var n=r.a;r.b;return ya(l(G$,mr,f(AN,F([hN(15),KN(20),cN]),F([Jp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Jp("You will be redirected when the trade is finished opening.")])),wO(Cv(Sv))));default:break e}return ma}())}),BO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(AN,F([hN(10),cN]),f(tu,f(vO,e.web3Context.factoryType,!0),nO))}var r=t.a;t.b;return f(AN,F([hN(20),cN]),F([l(vO,e.web3Context.factoryType,!1,r),f(AN,F([hN(10),cN]),F([f(EO,r.initiatorRole,r.fiatValue),f(SO,r.initiatorRole,e.textInput),f(mO,e.userInfo,e.state)]))]))}(),F([l(AO,e.web3Context.factoryType,e.userInfo,e.state)]))},kO=function(e){return{$:"MessageInputChanged",a:e}},NO={$:"MessageSubmit"},RO=function(e){return f(AN,F([AT(Nk),hN(10)]),F([f(gD,F([AT(Nk),ET(xk(100))]),{label:Tx("messageInput"),onChange:kO,placeholder:ma,spellcheck:!1,text:e.messageInput}),f(yR,F([cN,aN(24)]),{label:Jp("Submit"),onPress:ya(NO)})]))},$O=f(qk,MN,PT.scrollbarsY),xO=r(function(e,t){return f(Bk,F([ET(Nk),AT(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")),$O]),e),t))}),_O=l(Tk,200,205,210),LO=n(function(e,t,r){var n=F([TN,Lk(T$),wA(Fk),wU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([Sx,Lk(_O),wA(IR),wU({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([Jp(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 ya(P(l(bA,0,0,1),Fk,"Initiator opened the trade"));case"Recalled":return ya(P(l(bA,0,0,1),Fk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Co,8,Xd(t))+"..";return ya(P(l(bA,1,0,1),Fk,r+" committed to the trade"));case"Aborted":return ya(P(l(bA,1,0,0),Fk,"Buyer aborted the trade"));case"Claimed":return ya(P(l(bA,0,1,0),Fk,"Buyer marked the fiat transfer complete"));case"Released":return ya(P(l(bA,0,0,1),Fk,"Seller released the "+Qf(e)+" and closed the contract"));default:return ya(P(l(bA,0,0,1),Fk,"Seller burned the "+Qf(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(bA,1,0,1)),cN,Lk(h)]),f(vN,F([wA(p)]),F([Jp(g)])))}),PO=n(function(e,t,r){if(r.b){var n=r;return f(xO,F([AT(Nk),ET(Nk),Yk(5),d$(1),f$(IR),KN(10)]),f(AN,F([AT(Nk),ET(Nk),hN(10)]),f(tu,f(LO,e,t),n)))}return f(Bk,F([AT(Nk),ET(Nk),Yk(5),d$(1),f$(IR),cN,wA(l(bA,.5,.5,.5)),CN]),Jp("no messages found."))}),DO=Sr,UO=function(e){return f(AN,F([AT(Nk),ET(Nk),hN(10),d$(1),Yk(5),KN(20)]),F([l(PO,e.web3Context.factoryType,e.userRole,f(DO,function(e){return e.blocknum},Ma(e.history))),RO(e)]))},OO=function(e){return f(Bk,F([Lk(Fk),Yk(8),nD,AT(Nk),ET(Nk)]),UO(e))},MO={$:"ToggleChat"},FO=function(e){if(e.showChatHistory){var t=f(ec,Rk,f(jf,OO,e.chatHistoryModel));return f(Bk,F([ET(Nk),AT(xk(500)),KN(20),TN]),l(G$,F([ET(Nk),AT(Nk)]),f(Lf,xS,t),MO))}return Rk},VO=function(e){return"Buyer"===e.initiatorRole.$?Of:ry},KO=function(e){return qR(e)+" "+e.fiatType},HO={$:"AbortAction"},jO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),qO=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=KO(n.terms.price),u=n$(Fv(i)),s=n$(n.parameters.tradeAmount)+" "+Qf(e.web3Context.factoryType),c=function(){return"Buyer"===VO(n.parameters).$?L(f(Bk,F([jN,wA(IR)]),Jp("buyer")),F([Jp("pay the seller "),f(Bk,F([wA(T$)]),Jp(o)),Jp(" in exchange for the "),f(Bk,F([wA(T$)]),Jp(s)),Jp(" held in this contract.")])):L(f(Bk,F([jN,wA(IR)]),Jp("seller")),F([Jp("accept "),f(Bk,F([wA(T$)]),Jp(o)),Jp(" from the buyer in exchange for the "),f(Bk,F([wA(T$)]),Jp(s)),Jp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(G$,mr,f(AN,F([hN(20),KN(20),cN,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),O(F([O(F([Jp("You will deposit "),f(Bk,F([wA(T$)]),Jp(u+" "+Qf(e.web3Context.factoryType))),Jp(", thereby becoming the "),d,Jp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Jp("(This ususally requires two Metamask signatures. Your "+Qf(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(jO,n,a,i)))])),HO);case"ApproveNeedsSig":t.a;return sx(F([Jp("Waiting for user signature for the approve call."),Jp("(check Metamask!)"),Jp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return sx(F([Jp("Mining the initial approve transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("See the transaction on Etherscan"),url:f(cx,e.web3Context.factoryType,p)}),Jp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return sx(F([Jp("Waiting for user signature for the final commit call."),Jp("(check Metamask!)"),Jp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return sx(F([Jp("Mining the final commit transaction..."),f(yA,F([dx,wA(T$)]),{label:Jp("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,ET(Nk),ux]),F([f(Bk,F([aN(26),tN,cN,ON]),Jp("Just to Confirm...")),f(AN,F([hN(20),cN,ON]),f(tu,vN(F([cN,aN(18),jN,wA(ex)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Jp('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 '+Qf(e.web3Context.factoryType)+" rather than release it to you.")])]);case"Abort":return F([F([Jp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Qf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Jp("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([Jp("This will destroy the "+Qf(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,HS(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 "+Qf(e.web3Context.factoryType)+".";default:return"I understand. Burn the "+Qf(e.web3Context.factoryType)+"."}}()))])),HO);case"ActionNeedsSig":var g=t.a.a;return sx(F([Jp("Waiting for user signature for the "+qS(g)+" call."),Jp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return Rk}},GO=NN(F([AT(Nk),Lk(Fk),Yk(5),KN(20),aD,nD])),zO=function(e){return f(NN,F([hN(8)]),F([f(WR,mr,t$),f(Bk,F([aN(24),jN]),Jp(n$(e)))]))},YO=r(function(e,t){var r=f(ng,yb(e),f(jf,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"}(),zO(e.parameters.tradeAmount))}),WO=function(e){return f(NN,F([hN(5)]),F([w_(e.fiatType),f(Bk,F([aN(24),jN]),Jp(KO(e)))]))},JO=function(e){return f(v_,"For Fiat",WO(e.terms.price))},QO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},XO=l(Tk,250,165,22),ZO=l(Tk,255,0,0),eM=l(Tk,0,255,0),tM=MR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),rM=MR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),nM=MR({description:"released",src:"/DAIHard/static/img/released.svg"}),aM={$:"ToggleStatsModal"},iM=function(e){return f(DO,to,e)},oM=n(function(e,t,n){var a=f(Zd,function(e){return $(f(CS,e,n),ya(t))},f(qE,function(e){if("LoadedTrade"===e.$){var t=e.a;return ya(t)}return ma},Ma(e.trades))),i=Oi(a),o=l(za,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(fd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(fd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wf,amountReleased:Wf,numAborts:0,numBurns:0,numReleases:0},a),u=f(jf,Ff,Xf(iM(f(qE,function(e){return function(e){return e?ya(e):ma}(Gl(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}}),uM=function(e){return{$:"ViewUserHistory",a:e}},sM=f(_B,0,mr),cM=f(qk,eN,PT.textNormalWeight),fM=r(function(e,t){return gi(e/t)}),lM=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}}),dM=r(function(e,t){var r=e.a,n=e.b;return l(lM,r,f(fM,Gl(t),6e4),n)}),hM=r(function(e,t){return f(Xu,24,f(fM,f(dM,e,t),60))}),pM=r(function(e,t){return f(Xu,1e3,Gl(t))}),gM=r(function(e,t){return f(Xu,60,f(dM,e,t))}),vM={$:"Apr"},yM={$:"Aug"},mM={$:"Dec"},bM={$:"Feb"},CM={$:"Jan"},SM={$:"Jul"},EM={$:"Jun"},TM={$:"Mar"},wM={$:"May"},IM={$:"Nov"},AM={$:"Oct"},BM={$:"Sep"},kM=function(e){var t=f(fM,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)}},NM=r(function(e,t){switch(kM(f(dM,e,t)).month){case 1:return CM;case 2:return bM;case 3:return TM;case 4:return vM;case 5:return wM;case 6:return EM;case 7:return SM;case 8:return yM;case 9:return BM;case 10:return AM;case 11:return IM;default:return mM}}),RM=r(function(e,t){return f(Xu,60,f(fM,Gl(t),1e3))}),$M={$:"Fri"},xM={$:"Mon"},_M={$:"Sat"},LM={$:"Sun"},PM={$:"Thu"},DM={$:"Tue"},UM={$:"Wed"},OM=r(function(e,t){switch(f(Xu,7,f(fM,f(dM,e,t),1440))){case 0:return PM;case 1:return $M;case 2:return _M;case 3:return LM;case 4:return xM;case 5:return DM;default:return UM}}),MM=n(function(e,t,r){return e.toAmPm(f(hM,t,r))}),FM=r(function(e,t){return kM(f(dM,e,t)).day}),VM=FM,KM=F([LM,xM,DM,UM,PM,$M,_M]),HM=r(function(e,t){return function(e){return e.a}(f(ec,L(0,LM),Xf(f(Zd,function(r){return $(r.b,f(OM,e,t))},f(Ki,r(function(e,t){return L(e,t)}),KM)))))}),jM=function(e){return l(za,Ga,0,e)},qM=r(function(e,t){return kM(f(dM,e,t)).year}),GM=function(e){return!f(Xu,4,e)&&(!!f(Xu,100,e)||!f(Xu,400,e))},zM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return GM(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}}),YM=F([CM,bM,TM,vM,wM,EM,SM,yM,BM,AM,IM,mM]),WM=r(function(e,t){return f(ec,L(0,CM),Xf(f(Zd,function(r){r.a;return $(r.b,f(NM,e,t))},f(Ki,r(function(e,t){return L(e,t)}),YM))))}),JM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(WM,e,t))}),QM=r(function(e,t){var r=f($s,f(JM,e,t)-1,YM);return jM(f(tu,zM(f(qM,e,t)),r))+f(VM,e,t)}),XM=r(function(e,t){return f(JM,e,t)/4|0}),ZM=r(function(e,t){var r=ji(t),n=e-go(r);return O(f(qi,"",f(tu,function(e){return"0"},f(Vi,1,n))),r)}),eF=function(e){return e?e<=12?e:e-12:12},tF=Ag(315576e5),rF=r(function(e,t){return Ff(tF*f(qM,e,t))}),nF=r(function(e,t){var r=f(rF,e,t),n=f(HM,e,r);return 1+((f(QM,e,t)+n)/7|0)}),aF=r(function(e,t){return ji(f(qM,e,t))}),iF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return ji(f(JM,t,r));case"MonthSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"MonthFixed":return f(ZM,2,f(JM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(NM,t,r));case"MonthNameFull":return e.toMonthName(f(NM,t,r));case"QuarterNumber":return ji(1+f(XM,t,r));case"QuarterSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(1+f(XM,t,r));case"DayOfMonthNumber":return ji(f(VM,t,r));case"DayOfMonthSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(VM,t,r));case"DayOfMonthFixed":return f(ZM,2,f(VM,t,r));case"DayOfYearNumber":return ji(f(QM,t,r));case"DayOfYearSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"DayOfYearFixed":return f(ZM,3,f(QM,t,r));case"DayOfWeekNumber":return ji(f(HM,t,r));case"DayOfWeekSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(HM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(OM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(OM,t,r));case"WeekOfYearNumber":return ji(f(nF,t,r));case"WeekOfYearSuffix":return function(t){return O(ji(t),e.toOrdinalSuffix(t))}(f(nF,t,r));case"WeekOfYearFixed":return f(ZM,2,f(nF,t,r));case"YearNumberLastTwo":return f(wo,2,f(aF,t,r));case"YearNumber":return f(aF,t,r);case"AmPmUppercase":return HP(l(MM,e,t,r));case"AmPmLowercase":return cl(l(MM,e,t,r));case"HourMilitaryNumber":return ji(f(hM,t,r));case"HourMilitaryFixed":return f(ZM,2,f(hM,t,r));case"HourNumber":return ji(eF(f(hM,t,r)));case"HourFixed":return f(ZM,2,eF(f(hM,t,r)));case"HourMilitaryFromOneNumber":return ji(1+f(hM,t,r));case"HourMilitaryFromOneFixed":return f(ZM,2,1+f(hM,t,r));case"MinuteNumber":return ji(f(gM,t,r));case"MinuteFixed":return f(ZM,2,f(gM,t,r));case"SecondNumber":return ji(f(RM,t,r));case"SecondFixed":return f(ZM,2,f(RM,t,r));case"MillisecondNumber":return ji(f(pM,t,r));case"MillisecondFixed":return f(ZM,3,f(pM,t,r));default:return n.a}}),oF=a(function(e,t,r,n){return f(qi,"",f(tu,l(iF,e,r,n),t))}),uF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),sF=function(e){return e>11?"pm":"am"},cF=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"}},fF=function(e){switch(f(Xu,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Xu,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},lF=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"}},dF=p(uF,cF,f($a,cF,Co(3)),lF,f($a,lF,Co(3)),sF,fF),hF=oF(dF),pF={$:"MonthNameFull"},gF=pF,vF=function(e){return{$:"Text",a:e}},yF=vF,mF={$:"YearNumber"},bF=mF,CF=n(function(e,t,n){var a=r(function(e,t){return f(AN,F([aN(18),hN(6)]),F([f(Bk,F([yN]),Jp(e)),f(Bk,F([cM]),Jp(t))]))}),i=hF(F([gF,yF(", "),bF])),o=f(AN,F([hN(23),AT(Nk)]),O(f(tu,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,sM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",ji(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+Qf(e)+" Released"),L("Abort Outcomes",ji(n.numAborts)+" trades"),L("Burn Outcomes",ji(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+Qf(e)+" Burned")])),F([f(Bk,F([cN]),f(hO,"View User History",uM(n.asRole)))])));return f(AN,F([Yk(8),ID,AD,Lk(AR),hN(1),rD({blur:20,color:d(JR,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Bk,F([AT(Nk),Lk(Fk),KN(17)]),f(m$,18,t)),f(Bk,F([AT(Nk),Lk(Fk),KN(17)]),o)]))}),SF=a(function(e,t,r,n){var a=l(oM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=QO(t.parameters.initiatorRole)+" Stats";return f(Bk,n?F([f_(f(Bk,F([l_(30),TN]),l(CF,e,t.parameters.initiatorAddress,a)))]):mr,f(v_,i,f(NN,F([AT(Nk),hN(20),Gk,Zk(aM)]),f(tu,NN(F([hN(5)])),F([F([f(WR,F([ET(xk(28))]),nM),f(Bk,F([aN(24),jN,wA(eM)]),Jp(l(Ju,2,D("0"),ji(a.numReleases))))]),F([f(WR,F([ET(xk(28))]),tM),f(Bk,F([aN(24),jN,wA(XO)]),Jp(l(Ju,2,D("0"),ji(a.numAborts))))]),F([f(WR,F([ET(xk(28))]),rM),f(Bk,F([aN(24),jN,wA(ZO)]),Jp(l(Ju,2,D("0"),ji(a.numBurns))))])])))))}),EF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Xd(t)}e.a;return"https://kovan.etherscan.io/address/"+Xd(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Xd(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Xd(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Xd(t)}}),TF=n(function(e,t,r){return f(yA,e,{label:Jp(Xd(r)),url:f(EF,t,r)})}),wF=r(function(e,t){return f(v_,"Trade Status",f(AN,F([aN(24),jN,hN(8)]),F([Jp(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(TF,F([aN(12),wA(T$),dx]),t,e.creationInfo.address)])))}),IF=o(function(e,t,r,n,a,i){return GO(F([f(wF,t,n),f(YO,t,r),JO(t),d(SF,n,t,a,i)]))}),AF=l(Tk,9,32,107),BF=MR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),kF=f(Bk,F([Yk(4),Gk,Zk(MO),KN(5),Lk(l(Tk,22,0,255))]),f(WR,F([AT(xk(42))]),BF)),NF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},RF=function(e){return f(AN,F([Yk(12),Lk(AR),KN(15),hN(15)]),F([f(Bk,F([aN(24),tN,CN]),Jp("Fiat Payment Method")),f(vN,F([aN(18),ET(wT),Lk(Fk),rD({blur:5,color:d(JR,0,0,0,.2),offset:L(-3,3),size:0}),Yk(3),KN(5)]),F([f(ec,f(Bk,F([wA(B$),CN]),Jp("No payment methods found.")),f(jf,Jp,f(jf,function(e){return e.info},Xf(e))))]))]))},$F={$:"Active"},xF=function(e){return{$:"ExpandPhase",a:e}},_F=F([Lk(AF),wA(Fk)]),LF=r(function(e,t){return{$:"Min",a:e,b:t}}),PF=r(function(e,t){return f(LF,e,t)}),DF=function(e){return F(e?[Yk(12),V$,ET(f(PF,380,wT))]:[Yk(12),cN])},UF=F([Lk(Fk)]),OF=MR({description:"flame",src:"/DAIHard/static/img/flame.png"}),MF=r(function(e,t){return Kf(f(xu,Hf(e),Hf(t)))}),FF=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)}),VF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),KF=function(e){return{$:"ContractActionClicked",a:e}},HF={$:"Web3Connect"},jF=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(yb,t,n.address),f(CS,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(Lf,HS,f(hO,"Remove and Refund this Trade",VS))])}break e}var r=(e.a,e.b,Hf(mb(t.parameters)));return F([f(ix,"Deposit and Commit to Trade",l(VF,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Lf,KF,f(FF,"Abort Trade",IS)),f(Lf,KF,f(ix,"Confirm Payment",_S)),kF])}e.a,e.c.a;return F([kF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Lf,KF,f(ix,"Burn it All!",$S)),f(Lf,KF,f(hO,"Release Everything",KS)),kF])}e.a,e.c.a;return F([kF])}break e;default:break e}return mr}())}return f(ix,"Connect to Wallet",HF)}),qF={$:"Finished"},GF={$:"NotStarted"},zF=r(function(e,t){var r=L(xN(t),xN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?GF:$(n,a)?$F:qF}),YF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(qa,r,e),a=t-1,i=r;e=n,t=a,r=i}}),WF=r(function(e,t){return l(YF,mr,e,t)}),JF=i(function(e,t,r,n,a){var i=n$(f(fd,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Qf(e),o=n$(n.parameters.tradeAmount)+" "+Qf(e),u=f(NN,mr,f(WF,3,f(WR,F([ET(xk(18))]),OF))),s=f(wf,Bk(F([wA(l(bA,1,0,0))])),Jp),c=$(t,n.state.phase),d=f(ng,CS(n),f(jf,function(e){return e.address},a)),h=c?Fk:IR,p=vN(F([wA(h),aN(18),tN])),g=KO(n.terms.price),v=c?l(Tk,0,226,255):l(Tk,16,7,234),y=f(wf,Bk(F([wA(v)])),Jp),m=n$(n.parameters.buyerDeposit)+" "+Qf(e),b=n.parameters.abortPunishment,C=n$(b)+" "+Qf(e),S=n$(f(MF,n.parameters.buyerDeposit,b))+" "+Qf(e),E=n$(f(MF,n.parameters.tradeAmount,b))+" "+Qf(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(tu,p,F([F([Jp("Your "),s("burnable deposit"),Jp(" of "),y(m),Jp(" is now held in this contract, and your offer to buy "),y(o),Jp(" for "),y(g),Jp(" is now listed in the marketplace.")]),F([Jp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Jp(" into this contract.")]),F([Jp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Jp(" to you.")])])):f(tu,p,F([F([Jp("Your offer to sell the "),y(o),Jp(" held in this contract for "),y(g),Jp(" is now listed in the marketplace.")]),F([Jp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Jp(" of 1/3 of the trade amount "),y("("+m+")"),Jp(" into this contract.")]),F([Jp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Jp(" to you.")])]))}());case"Committed":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Time to Pay Up",f(tu,p,F([F([Jp("You must now pay the Seller "),y(g),Jp(" via the Fiat Payment Method, "),f(Bk,F([tN]),Jp("and then click ")),s("Confirm Payment"),Jp(" before the payment window runs out. Use the chat to coordinate.")]),F([Jp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(") will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to the Seller, "),y(S),Jp(" to you).")]),F([Jp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Jp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(tu,p,F([F([Jp("Work and communicate with the Buyer to receive "),y(g),Jp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Jp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(") will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to you, "),y(S),Jp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(tu,p,F([F([Jp("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),y(i),Jp(" will be released to you.")]),F([Jp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Jp(" In this case the "),y(i),Jp(" will be lost to both parties.")]),F([Jp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(tu,p,F([F([Jp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Jp("So, have you recieved the "),y(g),Jp("? If so, you can click "),y("Release Everything"),Jp(".")]),F([Jp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Jp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Jp("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:r.a;return L("Contract closed.",F([p(F([Jp("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(tu,p,F([F([Jp("The Seller has deposited "),y(o),Jp(" into this contract, and offers to sell it for "),y(g),Jp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Jp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Jp(".")]),F([Jp("If the trade is successful, the combined "+Qf(e)+" balance "),y("("+i+")"),Jp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Jp(" for both parties (see Payment Window for more on this).")]),F([Jp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Jp(" within the payment window.")])])):f(tu,p,F([F([Jp("The Buyer is offering to buy "),y(o),Jp(" for "),y(g),Jp(", and has deposited "),y(m),Jp(" into this contract as a "),s("burnable deposit"),Jp(". To become the Seller, deposit "),y(o),Jp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Jp(".")]),F([Jp("When you receive the "),y(g),Jp(" from the Buyer, the combined "+Qf(e)+" balance "),y("("+i+")"),Jp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Jp(" for both parties (see Payment Window for more on this).")]),F([Jp("Don't commit unless you can receive "),y(g),Jp(" 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(tu,p,F([F([Jp("During this phase, the Buyer is expected to transfer "),y(g),Jp(" to the Seller, as described in Fiat Payment Method, "),f(Bk,F([tN]),Jp("and ")),s("Confirm the Payment "),Jp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Jp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Jp(" (1/4 of the "),s("burnable deposit"),Jp(" amount) will be "),s("burned"),Jp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Jp(" to the Seller, "),y(S),Jp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(tu,p,F([F([Jp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Jp("If the Seller can verify he has received the "),y(g),Jp(", he will probably release the total balance of "),y(o),Jp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Jp(".")]),F([Jp("If the Seller has not made a decision before the Burn/Release Window expires, the "),y(o),Jp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(AN,F([AT(Nk),ET(Nk),KN(20),hN(30)]),F([f(NN,F([AT(Nk)]),F([f(Bk,F([aN(24),tN,wA(v),Sx]),Jp(w))])),f(AN,F([AT(Nk),ON,hN(13)]),I),f(Bk,F([TN]),function(){switch(f(zF,n,t).$){case"Active":return l(jF,r,n,a);case"NotStarted":return f(Bk,F([aN(20),tN,CN,wA(g$)]),Jp("Phase not yet started."));default:return f(Bk,F([aN(20),tN,CN]),Jp("Phase no longer active."))}}())]))}),QF=MR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),XF=MR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),ZF={$:"None"},eV=ZF,tV=MR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),rV=function(e){switch(e.$){case"Open":return tV;case"Committed":return QF;case"Judgment":return XF;default:return eV}},nV=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),aV=a(function(e,t,r,n){return d(nV,e,t,r,n)}),iV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},oV=function(e){return function(e){return d(aV,e.red,e.green,e.blue,e.alpha)}(iV(e))},uV=function(e){return{$:"Circle",a:e}},sV=uV,cV=d(nV,0,0,0,1),fV={$:"Flat"},lV={$:"Sharp"},dV=function(e){return{$:"Uniform",a:e}},hV=dV,pV={cap:fV,dashPattern:mr,dashPhase:0,fill:hV(cV),join:lV,thickness:2},gV=n(function(e,t,r){return U(pV,{dashPattern:e,fill:r,thickness:t})}),vV=gV(mr),yV={$:"Transparent"},mV=yV,bV=f(vV,0,mV),CV=r(function(e,t){return{$:"Shape",a:e,b:t}}),SV=function(e){return{basic:e,handlers:mr,name:ma,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},EV=function(e){return f(wf,SV,CV(e))},TV=function(e){return EV(L(e,bV))},wV=function(e){return L(-e.a,-e.b)},IV=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)})}),AV=r(function(e,t){return f(IV,wV(e(t)),t)}),BV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(qa,r,a),f(qa,n,i))});return l(Ja,t,L(mr,mr),e)},kV=r(function(e,t){return{$:"Path",a:e,b:t}}),NV=Nr,RV=Rr,$V=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=RV(n),i=NV(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(wf,f(wf,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},xV=function(e){return tu(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)})},_V=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(xV,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),LV=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)])},PV=function(e){var t=DV(e.basic),r=BV(f(tu,$V(e),t)),n=r.a,a=r.b;return{toBottom:-f(ec,0,CI(a)),toLeft:-f(ec,0,CI(n)),toRight:f(ec,0,bI(n)),toTop:f(ec,0,bI(a))}},DV=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(_V,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(_V,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(_V,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(xV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(kV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(xV,$(C,fV)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(_V,0,S);case"Group":var E=e.a;return f(xV,0,uy(f(tu,f($a,PV,LV),E)));default:var T=e.b;return f(xV,0,LV(PV(T)))}},UV=function(e){var t=PV(e);return t.toTop+t.toBottom},OV=function(e){var t=PV(e);return L(-t.toLeft,t.toTop)},MV=function(e){var t=PV(e);return t.toLeft+t.toRight},FV=Un("http://www.w3.org/2000/svg"),VV=FV("svg"),KV=qn("height"),HV=qn("version"),jV=qn("width"),qV=FV("circle"),GV=FV("ellipse"),zV=FV("foreignObject"),YV=FV("g"),WV=FV("image"),JV=FV("polygon"),QV=FV("polyline"),XV=FV("rect"),ZV=kw,eK=FV("text"),tK=qn("id"),rK=qn("points"),nK=qn("r"),aK=qn("rx"),iK=qn("ry"),oK=function(e){return l(Gn,"http://www.w3.org/1999/xlink","xlink:href",it(e))},uK=function(e){return{$:"Group",a:e}},sK=qn("dominant-baseline"),cK=qn("fill"),fK=qn("fill-opacity"),lK=qn("font-family"),dK=qn("font-size"),hK=qn("font-style"),pK=qn("font-variant"),gK=qn("font-weight"),vK=qn("opacity"),yK=qn("stroke"),mK=qn("stroke-dasharray"),bK=qn("stroke-dashoffset"),CK=qn("stroke-linecap"),SK=qn("stroke-linejoin"),EK=qn("stroke-opacity"),TK=qn("stroke-width"),wK=qn("text-anchor"),IK=qn("text-decoration"),AK=qn("transform"),BK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},kK=function(e){return f(qi," ",f(tu,function(e){var t=e.a,r=e.b;return f(qi,",",F([ji(t),ji(r)]))},e))},NK=n(function(e,t,r){return d(nV,e,t,r,1)}),RK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Ag(1e4*e)/100};return Sl(F(["rgba(",Tw(i(t)),"%,",Tw(i(r)),"%,",Tw(i(n)),"%,",Tw(function(e){return Ag(1e3*e)/1e3}(a)),")"]))},$K=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},xK=function(e){var t=$K(e),r=t.red,n=t.green,a=t.blue;return RK(l(NK,r,n,a))},_K=function(e){if("Uniform"===e.$){var t=e.a;return xK(t)}return"none"},LK=function(e){var t=$K(e),r=t.alpha;return Tw(r)},PK=function(e){if("Uniform"===e.$){var t=e.a;return LK(t)}return"0"},DK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},UK=kr,OK=function(e){var t=Tw(e.scale.b),r=Tw(e.scale.a),n=Tw(-e.rotation/2/UK*360),a=Tw(-e.shift.b),i=Tw(e.shift.a);return Sl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},MK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([yK(_K(r.fill)),EK(PK(r.fill)),TK(Tw(r.thickness)),CK(BK(r.cap)),SK(DK(r.join)),cK("none"),vK(Tw(e.opacity)),AK(OK(e)),bK(ji(r.dashPhase)),mK(kK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([cK(_K(a)),fK(PK(a)),yK(_K(r.fill)),EK(PK(r.fill)),TK(Tw(r.thickness)),CK(BK(r.cap)),SK(DK(r.join)),vK(Tw(e.opacity)),AK(OK(e)),bK(ji(r.dashPhase)),mK(kK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([cK(_K(dV(o.color))),lK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),dK(ji(o.size)),gK(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"}}()),hK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),pK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),IK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),wK("middle"),sK("middle"),AK(OK(e))]);default:return F([AK(OK(e))])}},FK=qn("x"),VK=qn("y"),KK=r(function(e,t){return F([jV(Tw(e)),KV(Tw(t)),FK(Tw(-e/2)),VK(Tw(-t/2))])}),HK=function(e){return f(qi," ",f(tu,function(e){var t=e.a,r=e.b;return f(qi,",",F([Tw(t),Tw(-r)]))},e))},jK=Qk,qK=r(function(e,t){return f(e,t.a,t.b)}),GK=function(e){return f(tu,qK(jK),e)},zK=function(e){e:for(;;){var t=f(ec,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(QV,O(F([tK(t),rK(HK(i))]),O(MK(e),GK(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(JV,O(F([tK(t),rK(HK(i))]),O(MK(e),GK(e.handlers))),mr);case"Circle":var c=s.a;return f(qV,O(F([tK(t),nK(Tw(c))]),O(MK(e),GK(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(GV,O(F([tK(t),aK(Tw(d)),iK(Tw(h))]),O(MK(e),GK(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(XV,O(F([tK(t),aK(Tw(c)),iK(Tw(c))]),O(f(KK,p,g),O(MK(e),GK(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(kV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(eK,O(F([tK(t)]),O(MK(e),GK(e.handlers))),F([ZV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(WV,O(F([tK(t),oK(C)]),O(f(KK,p,g),O(MK(e),GK(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(zV,O(F([tK(t)]),O(f(KK,p,g),O(MK(e),GK(e.handlers)))),F([E]));case"Group":var T=n.a;return f(YV,f(qa,tK(t),O(MK(e),GK(e.handlers))),l(za,r(function(e,t){return f(qa,zK(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:uK(F([w,I]))});e=v;continue e}}},YK=r(function(e,t){var r=e.a,n=e.b,a=Tw(r),i=Tw(n);return f(WT,mr,F([f(VV,F([jV(a),KV(i),HV("1.1")]),F([zK(t)]))]))}),WK=function(e){return f(YK,L(MV(e),UV(e)),f(AV,OV,e))},JK=r(function(e,t){var r=rV(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_(WK(f(TV,hV(oV(n)),sV(50))));return f(Bk,F([cN,H$(f(WR,F([cN,ON,ET(xk(50))]),r))]),a)}),QK=function(e){var t=F([CN,tN,aN(20)]);switch(e.$){case"Active":return f(Bk,O(t,F([wA(oN)])),Jp("Active"));case"NotStarted":return f(Bk,O(t,F([wA(g$)])),Jp("Not Started"));default:return f(Bk,t,Jp("Finished"))}},XK=n(function(e,t,r){var n=f(zF,t,e),a=function(){return"Active"===n.$?l(Tk,0,226,255):IR}(),i=f(Bk,F([wA(a),aN(20),tN,cN]),Jp(function(){switch(e.$){case"Open":return"Open Window";case"Committed":return"Payment Window";case"Judgment":return"Burn/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]),Jp(wR(e))),f(hO,"Poke",HS(FS))]));default:return f(Bk,F([ET(xk(1))]),Rk)}}();return f(AN,F([KN(20),hN(10),ET(Nk)]),F([f(Bk,F([V$,cN]),i),f(Bk,F([ET(Nk),cN]),f(Bk,F([ON]),f(JK,e,n))),f(AN,F([hN(10),lx,cN]),F([f(Bk,F([cN]),QK(n)),o]))]))}),ZK=u(function(e,t,r,n,a,i,o){var u=f(zF,n,r),s=f(Bk,F([KN(10),AT(Nk),ET(Nk)]),h(JF,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 Ff(0)}}(),d=l(XK,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(ER,f(Tb,n.state.phaseStartTime,c),o);default:Ff(0)}}(),f(Bk,F([ET(Nk),AT(xk(1)),Lk(function(){return"Active"===u.$?l(bA,0,0,1):AR}())]),Rk)),g=i?f(NN,O(DF(e),O($(u,$F)?_F:UF,F([AT(Nk)]))),F([d,p,s])):f(NN,O(DF(e),O($(u,$F)?_F:UF,F([Gk,Zk(xF(r))]))),F([d]));return!e&&$(u,$F)?f(AN,F([AT(Nk),hN(20),C$({bottom:20,left:0,right:0,top:0})]),F([g,RF(n.terms.paymentMethods)])):g}),eH=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f(NN,F([cN,Yk(12),KN(30),hN(10),Lk(AF),aN(24),tN,wA(Fk)]),F([Jp("Trade "+NF(r.state.closedReason)),kF])):e?f(AN,F([AT(Nk),hN(10)]),F([f(NN,F([AT(Nk),ET(wT),hN(20)]),F([g(ZK,e,t,no,r,a,$(n,no),i),g(ZK,e,t,nC,r,a,$(n,nC),i),g(ZK,e,t,aC,r,a,$(n,aC),i)])),RF(r.terms.paymentMethods)])):f(AN,F([AT(Nk),ET(wT),hN(20)]),F([g(ZK,e,t,no,r,a,$(n,no),i),g(ZK,e,t,nC,r,a,$(n,nC),i),g(ZK,e,t,aC,r,a,$(n,aC),i)]))}),tH=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([AT(Nk),ET(Nk),hN(40)]),F([p(IF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Bk,F([AT(Nk),f(Hk,40,0),hN(40)]),p(eH,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Bk,F([cN,ON,aN(30)]),Jp("Loading trade info..."));default:return f(Bk,F([cN,ON,aN(30)]),Jp("Invalid trade"))}}(),F([FO(n),qO(n)]))}),rH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),nH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(GD(Dk(Jv(ry))),mr);case"CreateModel":var n=r.a;return L(f(Lf,Uy,UD(n)),mr);case"QuickCreateModel":var a=r.a;return l(rH,Lf(Fy),tu(Lf(Fy)),BO(a));case"TradeModel":var i=r.a;return l(rH,Lf(Ky),tu(Lf(Ky)),d(tH,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Lf,gT,l(ZU,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Lf,lT,l(R$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Bk,F([AT(Nk),ET(Nk),Yk(10)]),n),a)}),aH=function(e){return{$:"DismissNotice",a:e}},iH=function(e){return f(ZN,$U,xU(e))},oH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(bA,1,1,1):l(bA,0,0,0)}(),i=function(){switch(n.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)}}(),o=f(Bk,F([TN,V$,X$(5),iH(5)]),P$(aH(t)));return f(Bk,F([Lk(i),Yk(10),KN(8),AT(Nk),d$(1),f$(d(JR,0,0,0,.15)),nD]),f(AN,F([hN(4),AT(Nk)]),f(Ki,r(function(e,t){return f(vN,F([AT(Nk),wA(a)]),e?t:f(qa,o,t))}),n.mainParagraphs)))},uH=function(e){return $(e,mr)?mr:F([f(AN,F([_U(20),X$(20),hN(10),TN,lx,AT(xk(300)),aN(15)]),f(tu,oH,f(Zd,function(e){return $(e.b.align,Yp)},f(Ki,r(function(e,t){return L(e,t)}),e)))),f(AN,F([iH(20),l_(100),hN(10),Sx,V$,AT(xk(300)),aN(15)]),f(tu,oH,f(Zd,function(e){return $(e.b.align,yB)},f(Ki,r(function(e,t){return L(e,t)}),e))))])},sH=r(function(e,t){var r=f(nH,e,t),n=r.a,a=r.b;return L(f(AN,F([kR(Pk),H$(RN(t)),AT(Nk),ET(Nk),KN(30)]),F([f(Bk,F([ET(xk(50))]),Rk),n])),O(a,uH(t.userNotices)))}),cH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),fH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),lH={$:"AllowHover"},dH={$:"Layout"},hH={backgroundColor:ma,borderColor:ma,shadow:ya({blur:3,color:d(mA,155/255,203/255,1,1),offset:L(0,0),size:3})},pH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ya(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ya(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ya(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?hH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?lH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?dH:t.a}()}}(l(Ja,t,{focus:ma,hover:ma,mode:ma},e))},gH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r($T);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),$T);case"Text":var a=t.a;return DI(a);default:return DI("")}}),vH=n(function(e,t,r){var n=pH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?cH(n):fH(n)}();return f(gH,a,d(gA,$T,Ak,t,NT(F([r]))))}),yH=aw(5),mH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),bH={$:"SansSerif"},CH=function(e){return{$:"Typeface",a:e}},SH=W,EH=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(qi,"-",SH(cl(t)));case"ImportFont":var t=e.a;e.b;return f(qi,"-",SH(cl(t)));default:var t=e.a.name;return f(qi,"-",SH(cl(t)))}}())}),TH=function(){var e=F([CH("Open Sans"),CH("Helvetica"),CH("Verdana"),bH]);return F([f(EA,_k,l(SA,"bg-color-"+TA(d(mA,1,1,1,0)),"background-color",d(mA,1,1,1,0))),f(EA,CA,l(SA,"font-color-"+TA(d(mA,0,0,0,1)),"color",d(mA,0,0,0,1))),f(EA,rN,nN(20)),f(EA,yH,f(mH,l(za,EH,"font-",e),e))])}(),wH=n(function(e,t,r){var n=e.options;return l(vH,n,f(qa,vA(f(qi," ",F([PT.root,PT.any,PT.single]))),O(TH,t)),r)}),IH=wH({options:mr}),AH=function(e){return f(EA,yH,f(mH,l(za,EH,"ff-",e),e))},BH=bH,kH=CH,NH=function(e){return{body:F([function(){var t=f(sH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([AT(Nk),ET(Nk),AH(F([kH("Soleil"),BH]))]),f(tu,H$,n));return f(IH,a,r)}()]),title:"DAIHard"}},RH=jt,$H=RH({init:CB,onUrlChange:Ek,onUrlRequest:Sk,subscriptions:Ck,update:fB,view:NH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:$H(f(Ro,function(e){return f(Ro,function(t){return f(Ro,function(r){return _o({height:r,networkId:t,width:e})},f(Od,"height",ZC))},f(Od,"networkId",ZC))},f(Od,"width",ZC)))(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/package.json b/package.json index 5a9837f..c577fb3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "daihard", "description": "decentralized fiat/crypto transfers, using threat of burn", - "version": "0.9.1", + "version": "0.9.2", "license": "UNLICENSED", "author": "Logan Brutsche", "repository": { diff --git a/solidity/DAIHard.sol b/solidity/DAIHard.sol index d168ea2..41d14e9 100644 --- a/solidity/DAIHard.sol +++ b/solidity/DAIHard.sol @@ -130,7 +130,7 @@ contract DAIHardFactory { */ function createOpenTrade(address[2] calldata addressArgs, - bool initiatorIsCustodian, + bool initiatedByCustodian, uint[8] calldata uintArgs, string calldata terms, string calldata _commPubkey @@ -140,7 +140,7 @@ contract DAIHardFactory { uint initialTransfer; uint[8] memory newUintArgs; // Note that this structure is not the same as the above comment describes. See below in DAIHardTrade.open. - if (initiatorIsCustodian) { + if (initiatedByCustodian) { initialTransfer = uintArgs[0].add(uintArgs[3]).add(getFounderFee(uintArgs[0])).add(uintArgs[7]); // tradeAmount + pokeReward + getFounderFee(tradeAmount) + devFee @@ -166,7 +166,7 @@ contract DAIHardFactory { require(daiContract.transferFrom(msg.sender, address(newTrade), initialTransfer), "Token transfer failed. Did you call approve() on the DAI contract?" ); - newTrade.beginInOpenPhase(addressArgs[0], initiatorIsCustodian, newUintArgs, terms, _commPubkey); + newTrade.beginInOpenPhase(addressArgs[0], initiatedByCustodian, newUintArgs, terms, _commPubkey); return newTrade; } @@ -190,7 +190,7 @@ contract DAIHardFactory { */ function createCommittedTrade(address[3] calldata addressArgs, - bool initiatorIsCustodian, + bool initiatedByCustodian, uint[7] calldata uintArgs, string calldata _terms, string calldata _initiatorCommPubkey, @@ -207,7 +207,7 @@ contract DAIHardFactory { DAIHardTrade newTrade = new DAIHardTrade(daiContract, founderFeeAddress, addressArgs[2]); createdTrades.push(CreationInfo(address(newTrade), block.number)); - if (initiatorIsCustodian) { + if (initiatedByCustodian) { emit NewTrade(createdTrades.length - 1, address(newTrade), addressArgs[0]); } else { @@ -219,7 +219,7 @@ contract DAIHardFactory { ); newTrade.beginInCommittedPhase(addressArgs[0], addressArgs[1], - initiatorIsCustodian, + initiatedByCustodian, newUintArgs, _terms, _initiatorCommPubkey, @@ -269,6 +269,7 @@ contract DAIHardTrade { // the initiator for example might be either the custodian OR the beneficiary, // so we need four 'role' variables to capture each possible combination. + bool public initiatedByCustodian; address public custodian; address public beneficiary; @@ -356,7 +357,7 @@ contract DAIHardTrade { */ function beginInOpenPhase(address _initiator, - bool initiatorIsCustodian, + bool _initiatedByCustodian, uint[8] calldata uintArgs, string calldata terms, string calldata commPubkey @@ -377,7 +378,9 @@ contract DAIHardTrade { require(_initiator != address(0x0), "0x0 is an invalid initiator address!"); initiator = _initiator; - if (initiatorIsCustodian) { + initiatedByCustodian = _initiatedByCustodian; + + if (initiatedByCustodian) { custodian = initiator; tradeAmount = getBalance().sub(pokeReward.add(founderFee).add(devFee)); beneficiaryDeposit = responderDeposit; @@ -408,7 +411,7 @@ contract DAIHardTrade { function beginInCommittedPhase(address _custodian, address _beneficiary, - bool initiatorIsCustodian, + bool _initiatedByCustodian, uint[7] calldata uintArgs, string calldata terms, string calldata initiatorCommPubkey, @@ -431,8 +434,9 @@ contract DAIHardTrade { require(_beneficiary != address(0x0), "0x0 is an invalid beneficiary address!"); custodian = _custodian; beneficiary = _beneficiary; + initiatedByCustodian = _initiatedByCustodian; - if (initiatorIsCustodian) { + if (initiatedByCustodian) { initiator = custodian; responder = beneficiary; } @@ -507,7 +511,7 @@ contract DAIHardTrade { require(_responder != address(0x0), "0x0 is an invalid responder address!"); responder = _responder; - if (initiator == custodian) { + if (initiatedByCustodian) { beneficiary = responder; } else { @@ -747,7 +751,7 @@ contract DAIHardTrade { /* any phase */ /* any msg.sender */ returns(uint responderDeposit) { - if (initiator == custodian) { + if (initiatedByCustodian) { return beneficiaryDeposit; } else { @@ -779,6 +783,7 @@ contract DAIHardTrade { /* any phase */ /* any msg.sender */ returns (address initiator, + bool initiatedByCustodian, uint tradeAmount, uint beneficiaryDeposit, uint abortPunishment, @@ -789,6 +794,7 @@ contract DAIHardTrade { ) { return (this.initiator(), + this.initiatedByCustodian(), this.tradeAmount(), this.beneficiaryDeposit(), this.abortPunishment(), diff --git a/solidity/DAIHardFactoryABI.json b/solidity/DAIHardFactoryABI.json index 7e6fae9..4633880 100644 --- a/solidity/DAIHardFactoryABI.json +++ b/solidity/DAIHardFactoryABI.json @@ -35,7 +35,7 @@ "type": "address[2]" }, { - "name": "initiatorIsCustodian", + "name": "initiatedByCustodian", "type": "bool" }, { @@ -70,7 +70,7 @@ "type": "address[3]" }, { - "name": "initiatorIsCustodian", + "name": "initiatedByCustodian", "type": "bool" }, { @@ -187,8 +187,8 @@ }, { "indexed": true, - "name": "initiatorIsCustodian", - "type": "bool" + "name": "initiator", + "type": "address" } ], "name": "NewTrade", diff --git a/solidity/DAIHardNative.sol b/solidity/DAIHardNative.sol index 669352b..f0a0149 100644 --- a/solidity/DAIHardNative.sol +++ b/solidity/DAIHardNative.sol @@ -114,7 +114,7 @@ contract DAIHardNativeFactory { */ function createOpenTrade(address payable[2] calldata addressArgs, - bool initiatorIsCustodian, + bool initiatedByCustodian, uint[8] calldata uintArgs, string calldata terms, string calldata _commPubkey @@ -124,7 +124,7 @@ contract DAIHardNativeFactory { returns (DAIHardNativeTrade) { uint[8] memory newUintArgs; // Note that this structure is not the same as the above comment describes. See below in DAIHardNativeTrade.open. - if (initiatorIsCustodian) { + if (initiatedByCustodian) { // require: msg.value == tradeAmount + pokeReward + getFounderFee(tradeAmount) + devFee require(msg.value == uintArgs[0].add(uintArgs[3]).add(getFounderFee(uintArgs[0])).add(uintArgs[7]),"You didn't include the correct amount of value!"); @@ -147,7 +147,7 @@ contract DAIHardNativeFactory { emit NewTrade(createdTrades.length - 1, address(newTrade), addressArgs[0]); // transfer value to the trade and open it - newTrade.beginInOpenPhase.value(msg.value)(addressArgs[0], initiatorIsCustodian, newUintArgs, terms, _commPubkey); + newTrade.beginInOpenPhase.value(msg.value)(addressArgs[0], initiatedByCustodian, newUintArgs, terms, _commPubkey); return newTrade; } @@ -171,7 +171,7 @@ contract DAIHardNativeFactory { */ function createCommittedTrade(address payable[3] calldata addressArgs, - bool initiatorIsCustodian, + bool initiatedByCustodian, uint[7] calldata uintArgs, string calldata _terms, string calldata _initiatorCommPubkey, @@ -191,7 +191,7 @@ contract DAIHardNativeFactory { DAIHardNativeTrade newTrade = new DAIHardNativeTrade(founderFeeAddress, addressArgs[2]); createdTrades.push(CreationInfo(address(newTrade), block.number)); - if (initiatorIsCustodian) { + if (initiatedByCustodian) { emit NewTrade(createdTrades.length - 1, address(newTrade), addressArgs[0]); } else { @@ -200,7 +200,7 @@ contract DAIHardNativeFactory { newTrade.beginInCommittedPhase.value(msg.value)(addressArgs[0], addressArgs[1], - initiatorIsCustodian, + initiatedByCustodian, newUintArgs, _terms, _initiatorCommPubkey, @@ -242,7 +242,6 @@ contract DAIHardNativeTrade { phaseStartBlocknums[uint(p)] = block.number; } - address payable public initiator; address payable public responder; @@ -250,6 +249,7 @@ contract DAIHardNativeTrade { // the initiator for example might be either the custodian OR the beneficiary, // so we need four 'role' variables to capture each possible combination. + bool public initiatedByCustodian; address payable public custodian; address payable public beneficiary; @@ -335,7 +335,7 @@ contract DAIHardNativeTrade { */ function beginInOpenPhase(address payable _initiator, - bool initiatorIsCustodian, + bool _initiatedByCustodian, uint[8] calldata uintArgs, string calldata terms, string calldata commPubkey @@ -359,7 +359,9 @@ contract DAIHardNativeTrade { require(_initiator != address(0x0), "0x0 is an invalid initiator address!"); initiator = _initiator; - if (initiatorIsCustodian) { + initiatedByCustodian = _initiatedByCustodian; + + if (initiatedByCustodian) { custodian = initiator; tradeAmount = startingBalance.sub(pokeReward.add(founderFee).add(devFee)); beneficiaryDeposit = responderDeposit; @@ -390,7 +392,7 @@ contract DAIHardNativeTrade { function beginInCommittedPhase(address payable _custodian, address payable _beneficiary, - bool initiatorIsCustodian, + bool _initiatedByCustodian, uint[7] calldata uintArgs, string calldata terms, string calldata initiatorCommPubkey, @@ -416,8 +418,9 @@ contract DAIHardNativeTrade { require(_beneficiary != address(0x0), "0x0 is an invalid beneficiary address!"); custodian = _custodian; beneficiary = _beneficiary; + initiatedByCustodian = _initiatedByCustodian; - if (initiatorIsCustodian) { + if (initiatedByCustodian) { initiator = custodian; responder = beneficiary; } @@ -495,7 +498,7 @@ contract DAIHardNativeTrade { require(_responder != address(0x0), "0x0 is an invalid responder address!"); responder = _responder; - if (initiator == custodian) { + if (initiatedByCustodian) { beneficiary = responder; } else { @@ -733,7 +736,7 @@ contract DAIHardNativeTrade { /* any phase */ /* any msg.sender */ returns(uint responderDeposit) { - if (initiator == custodian) { + if (initiatedByCustodian) { return beneficiaryDeposit; } else { @@ -765,6 +768,7 @@ contract DAIHardNativeTrade { /* any phase */ /* any msg.sender */ returns (address initiator, + bool initiatedByCustodian, uint tradeAmount, uint beneficiaryDeposit, uint abortPunishment, @@ -775,6 +779,7 @@ contract DAIHardNativeTrade { ) { return (this.initiator(), + this.initiatedByCustodian(), this.tradeAmount(), this.beneficiaryDeposit(), this.abortPunishment(), diff --git a/solidity/DAIHardNativeFactoryABI.json b/solidity/DAIHardNativeFactoryABI.json index 0d3dfac..ecb7fc9 100644 --- a/solidity/DAIHardNativeFactoryABI.json +++ b/solidity/DAIHardNativeFactoryABI.json @@ -7,7 +7,7 @@ "type": "address[3]" }, { - "name": "initiatorIsCustodian", + "name": "initiatedByCustodian", "type": "bool" }, { @@ -46,7 +46,7 @@ "type": "address[2]" }, { - "name": "initiatorIsCustodian", + "name": "initiatedByCustodian", "type": "bool" }, { @@ -73,17 +73,6 @@ "stateMutability": "payable", "type": "function" }, - { - "inputs": [ - { - "name": "_founderFeeAddress", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, { "anonymous": false, "inputs": [ @@ -99,13 +88,24 @@ }, { "indexed": true, - "name": "initiatorIsCustodian", - "type": "bool" + "name": "initiator", + "type": "address" } ], "name": "NewTrade", "type": "event" }, + { + "inputs": [ + { + "name": "_founderFeeAddress", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, { "constant": true, "inputs": [ diff --git a/solidity/DAIHardNativeTradeABI.json b/solidity/DAIHardNativeTradeABI.json index 184d797..f852c24 100644 --- a/solidity/DAIHardNativeTradeABI.json +++ b/solidity/DAIHardNativeTradeABI.json @@ -311,20 +311,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "initiatorIsCustodian", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -400,6 +386,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "initiatedByCustodian", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -449,7 +449,7 @@ "type": "address" }, { - "name": "_initiatorIsCustodian", + "name": "_initiatedByCustodian", "type": "bool" }, { @@ -513,7 +513,7 @@ "type": "address" }, { - "name": "initiatorIsCustodian", + "name": "initiatedByCustodian", "type": "bool" }, { @@ -585,7 +585,7 @@ "type": "address" }, { - "name": "_initiatorIsCustodian", + "name": "_initiatedByCustodian", "type": "bool" }, { diff --git a/solidity/DAIHardTradeABI.json b/solidity/DAIHardTradeABI.json index f17e0bf..03e7e8b 100644 --- a/solidity/DAIHardTradeABI.json +++ b/solidity/DAIHardTradeABI.json @@ -325,20 +325,6 @@ "stateMutability": "view", "type": "function" }, - { - "constant": true, - "inputs": [], - "name": "initiatorIsCustodian", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": true, "inputs": [], @@ -414,6 +400,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "initiatedByCustodian", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [], @@ -463,7 +463,7 @@ "type": "address" }, { - "name": "_initiatorIsCustodian", + "name": "_initiatedByCustodian", "type": "bool" }, { @@ -527,7 +527,7 @@ "type": "address" }, { - "name": "initiatorIsCustodian", + "name": "initiatedByCustodian", "type": "bool" }, { @@ -599,7 +599,7 @@ "type": "address" }, { - "name": "_initiatorIsCustodian", + "name": "_initiatedByCustodian", "type": "bool" }, { diff --git a/src/CommonTypes.elm b/src/CommonTypes.elm index e23fc2b..f7761bf 100644 --- a/src/CommonTypes.elm +++ b/src/CommonTypes.elm @@ -13,8 +13,6 @@ type FactoryType type NativeFactoryType = Eth | Kovan - | Rootstock - | RootstockTest | XDai diff --git a/src/Config.elm b/src/Config.elm index 39c090a..6d21e5e 100644 --- a/src/Config.elm +++ b/src/Config.elm @@ -25,12 +25,6 @@ tokenUnitName factoryType = Native Kovan -> "ETH" - Native Rootstock -> - "SBTC" - - Native RootstockTest -> - "SBTC" - Native XDai -> "xDai" @@ -49,27 +43,35 @@ factoryAddress : FactoryType -> Address factoryAddress factoryType = case factoryType of Token EthDai -> - Eth.Utils.unsafeToAddress "0x41a8a3C08932d285f2AF190c7338ABcC5cFfFBb4" + Eth.Utils.unsafeToAddress "0x5677CFbA35a0Db0469d3d56020d556B942E9ce90" Token KovanDai -> - Eth.Utils.unsafeToAddress "0x4cd4742b61A840630e3509eC0eDb988edB55673f" + Eth.Utils.unsafeToAddress "0xbC69Aff9d93C5EA4a841166C46C68518D02aF818" Native Eth -> - Eth.Utils.unsafeToAddress "" + Eth.Utils.unsafeToAddress "0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6" Native Kovan -> - Eth.Utils.unsafeToAddress "" + Eth.Utils.unsafeToAddress "0xA30773FD520cdf845E1a00441aB09cE39B31F676" - Native Rootstock -> - Eth.Utils.unsafeToAddress "" + Native XDai -> + Eth.Utils.unsafeToAddress "0x7E370099a7a789dC28810a72381bcd7Be834Ad74" - Native RootstockTest -> - Eth.Utils.unsafeToAddress "" - Native XDai -> - Eth.Utils.unsafeToAddress "0x4078E3f7a5d475Eb615C643ce5729Cc0cC9Fb11D" +devFeeAddress : FactoryType -> Address +devFeeAddress factoryType = + case factoryType of + Token EthDai -> + Eth.Utils.unsafeToAddress "0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35" + Token KovanDai -> + Eth.Utils.unsafeToAddress "0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21" + + Native Eth -> + Eth.Utils.unsafeToAddress "0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35" -devFeeAddress : Address -devFeeAddress = - Eth.Utils.unsafeToAddress "0x2b518987f8c21937B4d0b700b1224736a28fCA23" + Native Kovan -> + Eth.Utils.unsafeToAddress "0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21" + + Native XDai -> + Eth.Utils.unsafeToAddress "0x092110996699c3E06e998d89F0f4586026e44F0F" diff --git a/src/Contracts/Generated/DAIHardFactory.elm b/src/Contracts/Generated/DAIHardFactory.elm index 10bbcb6..0699346 100644 --- a/src/Contracts/Generated/DAIHardFactory.elm +++ b/src/Contracts/Generated/DAIHardFactory.elm @@ -33,7 +33,7 @@ import Json.Decode.Pipeline exposing (custom) {-| "createCommittedTrade(address[3],bool,uint256[7],string,string,string)" function -} createCommittedTrade : Address -> Address -> Address -> Address -> Bool -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> String -> String -> String -> Call Address -createCommittedTrade contractAddress custodianAddress beneficiaryAddress devFeeAddress initiatorIsCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autoabortInterval autoreleaseInterval devFee terms initiatorCommPubkey responderCommPubkey = +createCommittedTrade contractAddress custodian beneficiary devFeeAddress initiatedByCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autoabortInterval autoreleaseInterval devFee terms initiatorCommPubkey responderCommPubkey = { to = Just contractAddress , from = Nothing , gas = Nothing @@ -41,12 +41,11 @@ createCommittedTrade contractAddress custodianAddress beneficiaryAddress devFeeA , value = Nothing , data = Just <| - AbiEncode.functionCall - "createCommittedTrade(address[3],bool,uint256[7],string,string,string)" - [ AbiEncode.address custodianAddress - , AbiEncode.address beneficiaryAddress + AbiEncode.functionCall "createCommittedTrade(address[3],bool,uint256[7],string,string,string)" + [ AbiEncode.address custodian + , AbiEncode.address beneficiary , AbiEncode.address devFeeAddress - , AbiEncode.bool initiatorIsCustodian + , AbiEncode.bool initiatedByCustodian , AbiEncode.uint tradeAmount , AbiEncode.uint beneficiaryDeposit , AbiEncode.uint abortPunishment @@ -66,7 +65,7 @@ createCommittedTrade contractAddress custodianAddress beneficiaryAddress devFeeA {-| "createOpenTrade(address[2],bool,uint256[8],string,string)" function -} createOpenTrade : Address -> Address -> Address -> Bool -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> String -> String -> Call Address -createOpenTrade contractAddress initiatorAddress devFeeAddress initiatorIsCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autorecallInterval autoabortInterval autoreleaseInterval devFee terms commPubkey = +createOpenTrade contractAddress initiator devFeeAddress initiatedByCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autorecallInterval autoabortInterval autoreleaseInterval devFee terms commPubkey = { to = Just contractAddress , from = Nothing , gas = Nothing @@ -74,11 +73,10 @@ createOpenTrade contractAddress initiatorAddress devFeeAddress initiatorIsCustod , value = Nothing , data = Just <| - AbiEncode.functionCall - "createOpenTrade(address[2],bool,uint256[8],string,string)" - [ AbiEncode.address initiatorAddress + AbiEncode.functionCall "createOpenTrade(address[2],bool,uint256[8],string,string)" + [ AbiEncode.address initiator , AbiEncode.address devFeeAddress - , AbiEncode.bool initiatorIsCustodian + , AbiEncode.bool initiatedByCustodian , AbiEncode.uint tradeAmount , AbiEncode.uint beneficiaryDeposit , AbiEncode.uint abortPunishment @@ -184,23 +182,23 @@ numTrades contractAddress = } -{-| "NewTrade(uint256,address,bool)" event +{-| "NewTrade(uint256,address,address)" event -} type alias NewTrade = { id : BigInt , tradeAddress : Address - , initiatorIsCustodian : Bool + , initiator : Address } -newTradeEvent : Address -> Maybe Bool -> LogFilter -newTradeEvent contractAddress initiatorIsCustodian = +newTradeEvent : Address -> Maybe Address -> LogFilter +newTradeEvent contractAddress initiator = { fromBlock = LatestBlock , toBlock = LatestBlock , address = contractAddress , topics = - [ Just <| U.keccak256 "NewTrade(uint256,address,bool)" - , Maybe.map (abiEncode << AbiEncode.bool) initiatorIsCustodian + [ Just <| U.keccak256 "NewTrade(uint256,address,address)" + , Maybe.map (abiEncode << AbiEncode.address) initiator ] } @@ -210,4 +208,4 @@ newTradeDecoder = succeed NewTrade |> custom (data 0 AbiDecode.uint) |> custom (data 1 AbiDecode.address) - |> custom (topic 1 AbiDecode.bool) + |> custom (topic 1 AbiDecode.address) diff --git a/src/Contracts/Generated/DAIHardNativeFactory.elm b/src/Contracts/Generated/DAIHardNativeFactory.elm index 0c67eee..0562e05 100644 --- a/src/Contracts/Generated/DAIHardNativeFactory.elm +++ b/src/Contracts/Generated/DAIHardNativeFactory.elm @@ -32,7 +32,7 @@ import Json.Decode.Pipeline exposing (custom) {-| "createCommittedTrade(address[3],bool,uint256[7],string,string,string)" function -} createCommittedTrade : Address -> Address -> Address -> Address -> Bool -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> String -> String -> String -> Call Address -createCommittedTrade contractAddress custodianAddress beneficiaryAddress devFeeAddress initiatorIsCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autoabortInterval autoreleaseInterval devFee terms initiatorCommPubkey responderCommPubkey = +createCommittedTrade contractAddress custodian beneficiary devFeeAddress initiatedByCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autoabortInterval autoreleaseInterval devFee terms initiatorCommPubkey responderCommPubkey = { to = Just contractAddress , from = Nothing , gas = Nothing @@ -40,12 +40,11 @@ createCommittedTrade contractAddress custodianAddress beneficiaryAddress devFeeA , value = Nothing , data = Just <| - AbiEncode.functionCall - "createCommittedTrade(address[3],bool,uint256[7],string,string,string)" - [ AbiEncode.address custodianAddress - , AbiEncode.address beneficiaryAddress + AbiEncode.functionCall "createCommittedTrade(address[3],bool,uint256[7],string,string,string)" + [ AbiEncode.address custodian + , AbiEncode.address beneficiary , AbiEncode.address devFeeAddress - , AbiEncode.bool initiatorIsCustodian + , AbiEncode.bool initiatedByCustodian , AbiEncode.uint tradeAmount , AbiEncode.uint beneficiaryDeposit , AbiEncode.uint abortPunishment @@ -65,7 +64,7 @@ createCommittedTrade contractAddress custodianAddress beneficiaryAddress devFeeA {-| "createOpenTrade(address[2],bool,uint256[8],string,string)" function -} createOpenTrade : Address -> Address -> Address -> Bool -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> BigInt -> String -> String -> Call Address -createOpenTrade contractAddress initiatorAddress devFeeAddress initiatorIsCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autorecallInterval autoabortInterval autoreleaseInterval devFee terms commPubkey = +createOpenTrade contractAddress initiator devFeeAddress initiatedByCustodian tradeAmount beneficiaryDeposit abortPunishment pokeReward autorecallInterval autoabortInterval autoreleaseInterval devFee terms commPubkey = { to = Just contractAddress , from = Nothing , gas = Nothing @@ -73,11 +72,10 @@ createOpenTrade contractAddress initiatorAddress devFeeAddress initiatorIsCustod , value = Nothing , data = Just <| - AbiEncode.functionCall - "createOpenTrade(address[2],bool,uint256[8],string,string)" - [ AbiEncode.address initiatorAddress + AbiEncode.functionCall "createOpenTrade(address[2],bool,uint256[8],string,string)" + [ AbiEncode.address initiator , AbiEncode.address devFeeAddress - , AbiEncode.bool initiatorIsCustodian + , AbiEncode.bool initiatedByCustodian , AbiEncode.uint tradeAmount , AbiEncode.uint beneficiaryDeposit , AbiEncode.uint abortPunishment @@ -168,23 +166,23 @@ numTrades contractAddress = } -{-| "NewTrade(uint256,address,bool)" event +{-| "NewTrade(uint256,address,address)" event -} type alias NewTrade = { id : BigInt , tradeAddress : Address - , initiatorIsCustodian : Bool + , initiator : Address } -newTradeEvent : Address -> Maybe Bool -> LogFilter -newTradeEvent contractAddress initiatorIsCustodian = +newTradeEvent : Address -> Maybe Address -> LogFilter +newTradeEvent contractAddress initiator = { fromBlock = LatestBlock , toBlock = LatestBlock , address = contractAddress , topics = - [ Just <| U.keccak256 "NewTrade(uint256,address,bool)" - , Maybe.map (abiEncode << AbiEncode.bool) initiatorIsCustodian + [ Just <| U.keccak256 "NewTrade(uint256,address,address)" + , Maybe.map (abiEncode << AbiEncode.address) initiator ] } @@ -194,4 +192,4 @@ newTradeDecoder = succeed NewTrade |> custom (data 0 AbiDecode.uint) |> custom (data 1 AbiDecode.address) - |> custom (topic 1 AbiDecode.bool) + |> custom (topic 1 AbiDecode.address) diff --git a/src/Contracts/Generated/DAIHardNativeTrade.elm b/src/Contracts/Generated/DAIHardNativeTrade.elm index 6ac3316..a8f03a5 100644 --- a/src/Contracts/Generated/DAIHardNativeTrade.elm +++ b/src/Contracts/Generated/DAIHardNativeTrade.elm @@ -15,8 +15,6 @@ module Contracts.Generated.DAIHardNativeTrade exposing , autorecallInterval , autoreleaseAvailable , autoreleaseInterval - , beginInCommittedPhase - , beginInOpenPhase , beneficiary , beneficiaryDeposit , burn @@ -40,10 +38,10 @@ module Contracts.Generated.DAIHardNativeTrade exposing , getResponderDeposit , getState , getStateDecoder + , initiatedByCustodian , initiatedDecoder , initiatedEvent , initiator - , initiatorIsCustodian , initiatorStatement , initiatorStatementLogDecoder , initiatorStatementLogEvent @@ -203,36 +201,6 @@ autoreleaseInterval contractAddress = } -{-| "beginInCommittedPhase(address,address,bool,uint256[7],string,string,string)" function --} -beginInCommittedPhase : Address -> Address -> Address -> Bool -> BigInt -> String -> String -> String -> Call () -beginInCommittedPhase contractAddress custodian_ beneficiary_ initiatorIsCustodian_ uintArgs terms initiatorCommPubkey responderCommPubkey = - { to = Just contractAddress - , from = Nothing - , gas = Nothing - , gasPrice = Nothing - , value = Nothing - , data = Just <| AbiEncode.functionCall "beginInCommittedPhase(address,address,bool,uint256[7],string,string,string)" [ AbiEncode.address custodian_, AbiEncode.address beneficiary_, AbiEncode.bool initiatorIsCustodian_, AbiEncode.uint uintArgs, AbiEncode.string terms, AbiEncode.string initiatorCommPubkey, AbiEncode.string responderCommPubkey ] - , nonce = Nothing - , decoder = Decode.succeed () - } - - -{-| "beginInOpenPhase(address,bool,uint256[8],string,string)" function --} -beginInOpenPhase : Address -> Address -> Bool -> BigInt -> String -> String -> Call () -beginInOpenPhase contractAddress initiator_ initiatorIsCustodian_ uintArgs terms commPubkey = - { to = Just contractAddress - , from = Nothing - , gas = Nothing - , gasPrice = Nothing - , value = Nothing - , data = Just <| AbiEncode.functionCall "beginInOpenPhase(address,bool,uint256[8],string,string)" [ AbiEncode.address initiator_, AbiEncode.bool initiatorIsCustodian_, AbiEncode.uint uintArgs, AbiEncode.string terms, AbiEncode.string commPubkey ] - , nonce = Nothing - , decoder = Decode.succeed () - } - - {-| "beneficiary()" function -} beneficiary : Address -> Call Address @@ -417,7 +385,7 @@ getBalance contractAddress = -} type alias GetParameters = { initiator : Address - , initiatorIsCustodian : Bool + , initiatedByCustodian : Bool , tradeAmount : BigInt , beneficiaryDeposit : BigInt , abortPunishment : BigInt @@ -551,33 +519,33 @@ getStateDecoder = |> toElmDecoder -{-| "initiator()" function +{-| "initiatedByCustodian()" function -} -initiator : Address -> Call Address -initiator contractAddress = +initiatedByCustodian : Address -> Call Bool +initiatedByCustodian contractAddress = { to = Just contractAddress , from = Nothing , gas = Nothing , gasPrice = Nothing , value = Nothing - , data = Just <| AbiEncode.functionCall "initiator()" [] + , data = Just <| AbiEncode.functionCall "initiatedByCustodian()" [] , nonce = Nothing - , decoder = toElmDecoder AbiDecode.address + , decoder = toElmDecoder AbiDecode.bool } -{-| "initiatorIsCustodian()" function +{-| "initiator()" function -} -initiatorIsCustodian : Address -> Call Bool -initiatorIsCustodian contractAddress = +initiator : Address -> Call Address +initiator contractAddress = { to = Just contractAddress , from = Nothing , gas = Nothing , gasPrice = Nothing , value = Nothing - , data = Just <| AbiEncode.functionCall "initiatorIsCustodian()" [] + , data = Just <| AbiEncode.functionCall "initiator()" [] , nonce = Nothing - , decoder = toElmDecoder AbiDecode.bool + , decoder = toElmDecoder AbiDecode.address } diff --git a/src/Contracts/Generated/DAIHardTrade.elm b/src/Contracts/Generated/DAIHardTrade.elm index 81ed3ad..5b21686 100644 --- a/src/Contracts/Generated/DAIHardTrade.elm +++ b/src/Contracts/Generated/DAIHardTrade.elm @@ -15,8 +15,6 @@ module Contracts.Generated.DAIHardTrade exposing , autorecallInterval , autoreleaseAvailable , autoreleaseInterval - , beginInCommittedPhase - , beginInOpenPhase , beneficiary , beneficiaryDeposit , burn @@ -44,7 +42,6 @@ module Contracts.Generated.DAIHardTrade exposing , initiatedDecoder , initiatedEvent , initiator - , initiatorIsCustodian , initiatorStatement , initiatorStatementLogDecoder , initiatorStatementLogEvent @@ -204,36 +201,6 @@ autoreleaseInterval contractAddress = } -{-| "beginInCommittedPhase(address,address,bool,uint256[7],string,string,string)" function --} -beginInCommittedPhase : Address -> Address -> Address -> Bool -> BigInt -> String -> String -> String -> Call () -beginInCommittedPhase contractAddress custodian_ beneficiary_ initiatorIsCustodian_ uintArgs terms initiatorCommPubkey responderCommPubkey = - { to = Just contractAddress - , from = Nothing - , gas = Nothing - , gasPrice = Nothing - , value = Nothing - , data = Just <| AbiEncode.functionCall "beginInCommittedPhase(address,address,bool,uint256[7],string,string,string)" [ AbiEncode.address custodian_, AbiEncode.address beneficiary_, AbiEncode.bool initiatorIsCustodian_, AbiEncode.uint uintArgs, AbiEncode.string terms, AbiEncode.string initiatorCommPubkey, AbiEncode.string responderCommPubkey ] - , nonce = Nothing - , decoder = Decode.succeed () - } - - -{-| "beginInOpenPhase(address,bool,uint256[8],string,string)" function --} -beginInOpenPhase : Address -> Address -> Bool -> BigInt -> String -> String -> Call () -beginInOpenPhase contractAddress initiator_ initiatorIsCustodian_ uintArgs terms commPubkey = - { to = Just contractAddress - , from = Nothing - , gas = Nothing - , gasPrice = Nothing - , value = Nothing - , data = Just <| AbiEncode.functionCall "beginInOpenPhase(address,bool,uint256[8],string,string)" [ AbiEncode.address initiator_, AbiEncode.bool initiatorIsCustodian_, AbiEncode.uint uintArgs, AbiEncode.string terms, AbiEncode.string commPubkey ] - , nonce = Nothing - , decoder = Decode.succeed () - } - - {-| "beneficiary()" function -} beneficiary : Address -> Call Address @@ -433,7 +400,7 @@ getBalance contractAddress = -} type alias GetParameters = { initiator : Address - , initiatorIsCustodian : Bool + , initiatedByCustodian : Bool , tradeAmount : BigInt , beneficiaryDeposit : BigInt , abortPunishment : BigInt @@ -567,33 +534,33 @@ getStateDecoder = |> toElmDecoder -{-| "initiator()" function +{-| "initiatedByCustodian()" function -} -initiator : Address -> Call Address -initiator contractAddress = +initiatedByCustodian : Address -> Call Bool +initiatedByCustodian contractAddress = { to = Just contractAddress , from = Nothing , gas = Nothing , gasPrice = Nothing , value = Nothing - , data = Just <| AbiEncode.functionCall "initiator()" [] + , data = Just <| AbiEncode.functionCall "initiatedByCustodian()" [] , nonce = Nothing - , decoder = toElmDecoder AbiDecode.address + , decoder = toElmDecoder AbiDecode.bool } -{-| "initiatorIsCustodian()" function +{-| "initiator()" function -} -initiatorIsCustodian : Address -> Call Bool -initiatorIsCustodian contractAddress = +initiator : Address -> Call Address +initiator contractAddress = { to = Just contractAddress , from = Nothing , gas = Nothing , gasPrice = Nothing , value = Nothing - , data = Just <| AbiEncode.functionCall "initiatorIsCustodian()" [] + , data = Just <| AbiEncode.functionCall "initiator()" [] , nonce = Nothing - , decoder = toElmDecoder AbiDecode.bool + , decoder = toElmDecoder AbiDecode.address } diff --git a/src/Contracts/Types.elm b/src/Contracts/Types.elm index 735c5bc..d715b2b 100644 --- a/src/Contracts/Types.elm +++ b/src/Contracts/Types.elm @@ -505,7 +505,7 @@ decodeParameters encodedParameters = Result.map3 (\autorecallInterval depositDeadlineInterval autoreleaseInterval -> { initiatorRole = - if encodedParameters.initiatorIsCustodian then + if encodedParameters.initiatedByCustodian then Seller else diff --git a/src/Contracts/Wrappers.elm b/src/Contracts/Wrappers.elm index 7e22313..c4ea368 100644 --- a/src/Contracts/Wrappers.elm +++ b/src/Contracts/Wrappers.elm @@ -41,7 +41,7 @@ openTrade factoryType parameters = callConstructor (Config.factoryAddress factoryType) parameters.initiatorAddress - Config.devFeeAddress + (Config.devFeeAddress factoryType) (parameters.initiatorRole == Seller) (TokenValue.getEvmValue parameters.tradeAmount) (TokenValue.getEvmValue <| defaultBuyerDeposit parameters.tradeAmount) diff --git a/src/Create/View.elm b/src/Create/View.elm index 611a782..a7644f0 100644 --- a/src/Create/View.elm +++ b/src/Create/View.elm @@ -246,7 +246,6 @@ phasesElement : Model -> Element Msg phasesElement model = Element.column [ Element.width Element.fill - , Element.paddingXY 10 0 , Element.spacing 20 ] [ openPhaseElement @@ -269,15 +268,10 @@ phasesElement model = openPhaseElement : Time.Posix -> Maybe String -> BuyerOrSeller -> Element Msg openPhaseElement interval maybeError userRole = Element.el - [ Element.padding 8 - , Element.Border.rounded 8 - , Element.Background.color EH.lightBlue - , Element.Border.shadow - { offset = ( -3, 3 ) - , size = 0 - , blur = 5 - , color = Element.rgba 0 0 0 0.3 - } + [ Element.Border.rounded 8 + , Element.Background.color EH.white + , Element.clipX + , Element.clipY ] <| phaseElement @@ -292,19 +286,14 @@ openPhaseElement interval maybeError userRole = committedPhaseElement : String -> Maybe String -> Time.Posix -> Maybe String -> BuyerOrSeller -> Element Msg committedPhaseElement paymentMethodText maybeTextError interval maybeIntervalError userRole = Element.column - [ Element.padding 8 - , Element.spacing 15 + [ Element.spacing 15 , Element.Border.rounded 8 - , Element.Background.color EH.lightBlue - , Element.Border.shadow - { offset = ( -3, 3 ) - , size = 0 - , blur = 5 - , color = Element.rgba 0 0 0 0.3 - } + , Element.clipX + , Element.clipY + , Element.Background.color EH.white ] [ phaseElement - Images.paymentWindowIcon + Images.fiatBag "Payment Window" (paymentWindowSummary userRole) interval @@ -317,20 +306,15 @@ committedPhaseElement paymentMethodText maybeTextError interval maybeIntervalErr judgmentPhaseElement : Time.Posix -> Maybe String -> BuyerOrSeller -> Element Msg judgmentPhaseElement interval maybeError userRole = Element.el - [ Element.padding 8 - , Element.Border.rounded 8 - , Element.Background.color EH.lightBlue - , Element.Border.shadow - { offset = ( -3, 3 ) - , size = 0 - , blur = 5 - , color = Element.rgba 0 0 0 0.3 - } + [ Element.Border.rounded 8 + , Element.clipX + , Element.clipY + , Element.Background.color EH.white ] <| phaseElement Images.releaseWindowIcon - "Judgment Window" + "Burn/Release Window" (releaseWindowSummary userRole) interval maybeError @@ -389,7 +373,8 @@ paymentMethodsElement maybeError initiatorRole inputText = Element.Input.multiline [ Element.width Element.fill , Element.height <| Element.px 150 - , Element.Background.color <| Element.rgba 1 1 1 0.5 + , Element.Background.color <| Element.rgba255 155 203 255 0.2 + , Element.Border.width 0 ] { onChange = ChangePaymentMethodText , text = inputText @@ -404,7 +389,13 @@ paymentMethodsElement maybeError initiatorRole inputText = } in Element.column - [ Element.spacing 10 + [ Element.spacing 20 + , Element.paddingEach + { left = 45 + , right = 45 + , top = 0 + , bottom = 15 + } , Element.width Element.fill , Element.above <| EH.maybeErrorElement @@ -424,10 +415,18 @@ paymentMethodsElement maybeError initiatorRole inputText = phaseElement : Image -> String -> String -> Time.Posix -> Maybe String -> (Time.Posix -> Msg) -> Element Msg phaseElement icon title summary interval maybeError newIntervalMsg = let - iconElement = - Element.el - [ Element.width <| Element.px 80 ] - (Images.toElement [ Element.centerX ] icon) + iconAndTitleElement = + Element.row + [ Element.spacing 30 ] + [ Images.toElement + [ Element.height <| Element.px 40 ] + icon + , Element.el + [ Element.Font.size 22 + , Element.Font.semiBold + ] + (Element.text title) + ] descriptionElement = Element.paragraph @@ -437,41 +436,42 @@ phaseElement icon title summary interval maybeError newIntervalMsg = ] [ Element.text summary ] - intervalAndTitleElement = - Element.column - [ Element.spacing 6 ] - [ Element.el - [ Element.Font.size 22 - , Element.Font.semiBold - ] - (Element.text title) - , Element.el - [ Element.Background.color <| Element.rgba 1 1 1 0.5 - , Element.Border.rounded 5 - , Element.padding 5 - , Element.Border.shadow - { offset = ( -3, 3 ) - , size = 0 - , blur = 4 - , color = Element.rgba 0 0 0 0.15 - } - , Element.above <| - EH.maybeErrorElement - [ inputErrorTag ] - maybeError - ] - (EH.intervalInput EH.black interval newIntervalMsg) + intervalElement = + Element.el + [ Element.Background.color <| Element.rgba255 155 203 255 0.2 + , Element.Border.rounded 5 + , Element.padding 15 + , Element.above <| + EH.maybeErrorElement + [ inputErrorTag ] + maybeError ] + (EH.intervalInput EH.black interval newIntervalMsg) in - Element.row + Element.column [ Element.width Element.fill - , Element.spacing 15 , Element.Border.rounded 10 + , Element.Background.color <| Element.rgb255 237 237 237 + , Element.spacing 2 ] - [ iconElement - , intervalAndTitleElement - , descriptionElement - ] + (List.map + (Element.el + [ Element.Background.color EH.white + , Element.paddingXY 45 18 + , Element.width Element.fill + ] + ) + [ iconAndTitleElement + , Element.row + [ Element.width Element.fill + , Element.spacing 25 + , Element.Background.color EH.white + ] + [ intervalElement + , descriptionElement + ] + ] + ) getModalOrNone : Model -> Element Msg @@ -599,10 +599,10 @@ getWarningParagraphs createParameters = Just <| case createParameters.initiatorRole of Buyer -> - "That Release Window time is quite small! It might take a while to find a committed Seller." + "That Burn/Release Window time is quite small! It might take a while to find a committed Seller." Seller -> - "That Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing." + "That Burn/Release Window time is quite small! This may attract scammers. Only create this trade if you know what you're doing." else Nothing @@ -630,7 +630,7 @@ getWarningParagraphs createParameters = inputPlaceholder : BuyerOrSeller -> Element.Input.Placeholder Msg inputPlaceholder initiatorRole = Element.Input.placeholder - [] + [ Element.Font.color <| Element.rgba 0 0 0 0.2 ] (case initiatorRole of Seller -> Element.text """Some examples: diff --git a/src/Helpers/Element.elm b/src/Helpers/Element.elm index d8d6747..abde318 100644 --- a/src/Helpers/Element.elm +++ b/src/Helpers/Element.elm @@ -1,4 +1,4 @@ -module Helpers.Element exposing (activePhaseBackgroundColor, bigTimeUnitElement, black, blue, blueButton, bulletPointString, button, closeButton, closeableModal, coloredMargin, comingSoonMsg, coolCurrencyHbreak, currencyLabelColor, currencySelector, daiSymbol, daiSymbolAndLabel, daiValue, daiYellow, darkGray, darkYellow, disabledButton, disabledTextColor, dollarGreen, elOnCircle, elapsedBar, elementColorToAvh4Color, ethAddress, etherscanAddressLink, fakeLink, fancyInput, fiatTypeToSymbolElement, fiatValue, green, headerBackgroundColor, interval, intervalInput, intervalWithElapsedBar, inverseBlueButton, lightBlue, lightGray, lightRed, marginFloatToConciseUnsignedString, marginSymbol, maybeErrorElement, mediumGray, modal, niceBottomBorderEl, niceFloatingRow, onClickNoPropagation, orangeButton, pageBackgroundColor, permanentTextColor, pokeButton, red, redButton, roundBottomCorners, roundTopCorners, scrollbarYEl, subtleShadow, testBorderStyles, textInputWithElement, textWithoutTextCursor, txProcessModal, uncoloredMargin, white, withHeader, yellow) +module Helpers.Element exposing (abortedIconColor, activePhaseBackgroundColor, bigTimeUnitElement, black, blue, blueButton, bulletPointString, burnedIconColor, button, closeButton, closeableModal, coloredMargin, comingSoonMsg, coolCurrencyHbreak, currencyLabelColor, currencySelector, daiSymbol, daiSymbolAndLabel, daiValue, daiYellow, darkGray, darkYellow, disabledButton, disabledTextColor, dollarGreen, elOnCircle, elapsedBar, elementColorToAvh4Color, ethAddress, etherscanAddressLink, fakeLink, fancyInput, fiatTypeToSymbolElement, fiatValue, green, headerBackgroundColor, interval, intervalInput, intervalWithElapsedBar, inverseBlueButton, lightBlue, lightGray, lightRed, marginFloatToConciseUnsignedString, marginSymbol, maybeErrorElement, mediumGray, modal, niceBottomBorderEl, niceFloatingRow, onClickNoPropagation, orangeButton, pageBackgroundColor, permanentTextColor, pokeButton, red, redButton, releasedIconColor, roundBottomCorners, roundTopCorners, scrollbarYEl, subtleShadow, testBorderStyles, textInputWithElement, textWithoutTextCursor, txProcessModal, uncoloredMargin, white, withHeader, yellow) import Browser.Dom import Collage exposing (Collage) @@ -101,7 +101,7 @@ permanentTextColor = pageBackgroundColor = - Element.rgb 0.9 0.9 0.9 + Element.rgb255 242 243 247 headerBackgroundColor = @@ -116,6 +116,18 @@ currencyLabelColor = Element.rgb255 109 127 138 +releasedIconColor = + Element.rgb255 0 255 0 + + +abortedIconColor = + Element.rgb255 250 165 22 + + +burnedIconColor = + Element.rgb255 255 0 0 + + -- LINKS diff --git a/src/Helpers/Eth.elm b/src/Helpers/Eth.elm index 7d905ce..d0c1c8e 100644 --- a/src/Helpers/Eth.elm +++ b/src/Helpers/Eth.elm @@ -26,12 +26,10 @@ networkIdToFactoryType networkId = Net.Kovan -> Just <| Token KovanDai - Net.RskMain -> - Just <| Native Rootstock - - Net.RskTest -> - Just <| Native RootstockTest - + -- Net.RskMain -> + -- Just <| Native Rootstock + -- Net.RskTest -> + -- Just <| Native RootstockTest Net.Private 100 -> Just <| Native XDai @@ -54,12 +52,10 @@ factoryTypeToNetworkId factoryType = Native Kovan -> Net.Kovan - Native Rootstock -> - Net.RskMain - - Native RootstockTest -> - Net.RskTest - + -- Native Rootstock -> + -- Net.RskMain + -- Native RootstockTest -> + -- Net.RskTest Native XDai -> Net.Private 100 @@ -102,17 +98,18 @@ web3Context factoryType = "https://dai.poa.network" "" - Native Rootstock -> - Web3Context - factoryType - "https://public-node.rsk.co" - "" - Native RootstockTest -> - Web3Context - factoryType - "https://public-node.testnet.rsk.co" - "" + +-- Native Rootstock -> +-- Web3Context +-- factoryType +-- "https://public-node.rsk.co" +-- "" +-- Native RootstockTest -> +-- Web3Context +-- factoryType +-- "https://public-node.testnet.rsk.co" +-- "" addressIfNot0x0 : Address -> Maybe Address @@ -148,12 +145,6 @@ makeViewTxUrl factoryType txHash = Native XDai -> "https://blockscout.com/poa/dai/tx/" ++ Eth.Utils.txHashToString txHash - Native Rootstock -> - "https://explorer.rsk.co/tx/" ++ Eth.Utils.txHashToString txHash - - Native RootstockTest -> - "" - makeViewAddressUrl : FactoryType -> Address -> String makeViewAddressUrl factoryType address = @@ -173,12 +164,6 @@ makeViewAddressUrl factoryType address = Native XDai -> "https://blockscout.com/poa/dai/address/" ++ Eth.Utils.addressToString address - Native Rootstock -> - "https://explorer.rsk.co/address/" ++ Eth.Utils.addressToString address - - Native RootstockTest -> - "" - updateCallValue : BigInt -> Eth.Types.Call a -> Eth.Types.Call a updateCallValue value call = diff --git a/src/Images.elm b/src/Images.elm index 59a29c1..6ce0b87 100644 --- a/src/Images.elm +++ b/src/Images.elm @@ -1,12 +1,15 @@ module Images exposing ( Image + , aborted , addButton , backButton + , burned , chatIcon , closeIcon , committedPhase , daiSymbol , downArrow + , fiatBag , flame , image , judgmentPhase @@ -16,13 +19,14 @@ module Images exposing , numberOnCircleEl , openPhase , openWindowIcon - , paymentWindowIcon , pmBank , pmCash , pmCustom , qmarkCircle , release , releaseWindowIcon + , released + , stopWhite , toElement , upArrow ) @@ -123,11 +127,19 @@ openWindowIcon = } -paymentWindowIcon : Image -paymentWindowIcon = +fiatBag : Image +fiatBag = JustImage - { src = "/DAIHard/static/img/payment-window-icon.svg" - , description = "" + { src = "/DAIHard/static/img/fiat-bag-white.svg" + , description = "fiat" + } + + +stopWhite : Image +stopWhite = + JustImage + { src = "/DAIHard/static/img/stop-white.svg" + , description = "stop" } @@ -182,7 +194,7 @@ backButton = chatIcon : Image chatIcon = JustImage - { src = "/DAIHard/static/img/chat-icon.svg" + { src = "/DAIHard/static/img/chat.svg" , description = "chat" } @@ -219,10 +231,34 @@ release = } +released : Image +released = + JustImage + { src = "/DAIHard/static/img/released.svg" + , description = "released" + } + + +aborted : Image +aborted = + JustImage + { src = "/DAIHard/static/img/aborted.svg" + , description = "aborted" + } + + +burned : Image +burned = + JustImage + { src = "/DAIHard/static/img/burned.svg" + , description = "burned" + } + + openPhase : Image openPhase = JustImage - { src = "/DAIHard/static/img/phase-open.svg" + { src = "/DAIHard/static/img/diamond-give-white.svg" , description = "open phase" } @@ -238,7 +274,7 @@ committedPhase = judgmentPhase : Image judgmentPhase = JustImage - { src = "/DAIHard/static/img/phase-judgment.svg" + { src = "/DAIHard/static/img/time-clock-fire.svg" , description = "judgment phase" } diff --git a/src/Trade/View.elm b/src/Trade/View.elm index 4875efc..9001508 100644 --- a/src/Trade/View.elm +++ b/src/Trade/View.elm @@ -309,47 +309,47 @@ statsElement factoryType trade tradeCache showModal = headerText (Element.row [ Element.width Element.fill - , Element.spacing 30 + , Element.spacing 20 , Element.pointer , Element.Events.onClick ToggleStatsModal ] - [ Element.row - [] - [ Images.toElement - [ Element.height <| Element.px 28 - ] - Images.release - , Element.el - [ Element.Font.size 24 - , Element.Font.medium - ] - (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numReleases)) - ] - , Element.row - [] - [ Images.toElement - [ Element.height <| Element.px 28 - ] - Images.flame - , Element.el - [ Element.Font.size 24 - , Element.Font.medium - ] - (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numAborts)) - ] - , Element.row - [] - [ Images.toElement - [ Element.height <| Element.px 28 - ] - Images.flame - , Element.el - [ Element.Font.size 24 - , Element.Font.medium - ] - (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numBurns)) + (List.map + (Element.row [ Element.spacing 5 ]) + [ [ Images.toElement + [ Element.height <| Element.px 28 + ] + Images.released + , Element.el + [ Element.Font.size 24 + , Element.Font.medium + , Element.Font.color <| EH.releasedIconColor + ] + (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numReleases)) + ] + , [ Images.toElement + [ Element.height <| Element.px 28 + ] + Images.aborted + , Element.el + [ Element.Font.size 24 + , Element.Font.medium + , Element.Font.color <| EH.abortedIconColor + ] + (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numAborts)) + ] + , [ Images.toElement + [ Element.height <| Element.px 28 + ] + Images.burned + , Element.el + [ Element.Font.size 24 + , Element.Font.medium + , Element.Font.color <| EH.burnedIconColor + ] + (Element.text (String.padLeft 2 '0' <| String.fromInt userStats.numBurns)) + ] ] - ] + ) ) @@ -714,7 +714,7 @@ phaseStatusElement viewPhase trade currentTime = "Payment Window" CTypes.Judgment -> - "Release Window" + "Burn/Release Window" CTypes.Closed -> "Closed" @@ -815,6 +815,7 @@ phaseIconElement viewPhase viewPhaseState = (Images.toElement [ Element.centerX , Element.centerY + , Element.height <| Element.px 60 ] image ) @@ -1126,7 +1127,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = ( CTypes.Judgment, Just Buyer ) -> ( "Judgement" , List.map makeParagraph - [ [ Element.text "If the Seller confirms receipt of payment, or fails to decide within the release window, the combined balance of " + [ [ Element.text "If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of " , emphasizedText tradePlusDepositString , Element.text " will be released to you." ] @@ -1158,7 +1159,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = , scaryText "burn it all" , Element.text ". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?" ] - , [ Element.text "If you don't decide within the Release Window, the balance will be automatically released." + , [ Element.text "If you don't decide within the Burn/Release Window, the balance will be automatically released." ] ] ) @@ -1176,7 +1177,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = , scaryText "burn it all" , Element.text "." ] - , [ Element.text "If the Seller has not made a decision before the Release Window expires, the " + , [ Element.text "If the Seller has not made a decision before the Burn/Release Window expires, the " , emphasizedText tradeAmountString , Element.text " will be automaticall released." ] @@ -1298,19 +1299,18 @@ actionButtonsElement currentTime trade maybeUserInfo = chatHistoryButton : Element Msg chatHistoryButton = - EH.elOnCircle - [ Element.pointer + Element.el + [ Element.Border.rounded 4 + , Element.pointer , Element.Events.onClick ToggleChat + , Element.padding 5 + , Element.Background.color <| Element.rgb255 22 0 255 ] - 80 - (Element.rgb 1 1 1) - (Images.toElement - [ Element.centerX - , Element.centerY - , Element.moveRight 5 + <| + Images.toElement + [ Element.width <| Element.px 42 ] Images.chatIcon - ) chatOverlayElement : Model -> Element Msg diff --git a/src/View.elm b/src/View.elm index 8772504..1690bfc 100644 --- a/src/View.elm +++ b/src/View.elm @@ -182,12 +182,6 @@ networkModeText model = Native Kovan -> "Testnet ETH" - Native Rootstock -> - "Rootstock SBTC" - - Native RootstockTest -> - "RskTest SBTC" - Native XDai -> "xDai"